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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2010-10-19 04:45:37 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2010-10-19 04:45:37 +0400
commita377a7edf67869722c585086ac6ab1f295cbff87 (patch)
tree1736de08fe9174761607dce5d54a16af25eba049
parent08232350d5797302e3638e69ec78657d853976aa (diff)
parentb743454ce1c361e6161da8ae5f840c2befe3a081 (diff)
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r32300:32571soc-2010-nicolasbishop
-rw-r--r--CMakeLists.txt69
-rw-r--r--COPYING2
-rw-r--r--build_files/cmake/macros.cmake8
-rw-r--r--build_files/scons/config/darwin-config.py2
-rw-r--r--build_files/scons/config/freebsd7-config.py2
-rw-r--r--build_files/scons/config/freebsd8-config.py2
-rw-r--r--build_files/scons/config/freebsd9-config.py2
-rw-r--r--build_files/scons/config/linux2-config.py12
-rw-r--r--build_files/scons/config/linuxcross-config.py2
-rw-r--r--build_files/scons/config/openbsd3-config.py2
-rw-r--r--build_files/scons/config/sunos5-config.py2
-rw-r--r--build_files/scons/config/win32-mingw-config.py2
-rw-r--r--build_files/scons/config/win32-vc-config.py7
-rw-r--r--build_files/scons/config/win64-vc-config.py35
-rw-r--r--build_files/scons/tools/Blender.py16
-rw-r--r--build_files/scons/tools/btools.py16
-rw-r--r--doc/build_systems/README.windows-gcc (renamed from doc/README.windows-gcc)0
-rw-r--r--doc/build_systems/cmake.txt (renamed from doc/blender-cmake.txt)0
-rw-r--r--doc/build_systems/scons-dev.txt (renamed from doc/blender-scons-dev.txt)0
-rw-r--r--doc/build_systems/scons.txt (renamed from doc/blender-scons.txt)2
-rw-r--r--doc/guides/blender-guardedalloc.txt (renamed from doc/blender-guardedalloc.txt)0
-rw-r--r--doc/guides/interface_API.txt (renamed from doc/interface_API.txt)0
-rw-r--r--doc/guides/python-dev-guide.txt170
-rw-r--r--doc/license/BL-license.txt (renamed from doc/BL-license.txt)0
-rw-r--r--doc/license/GPL-license.txt (renamed from doc/GPL-license.txt)0
-rw-r--r--doc/license/bf-members.txt (renamed from doc/bf-members.txt)0
-rw-r--r--doc/manpage/blender.1 (renamed from doc/blender.1)0
-rw-r--r--doc/manpage/blender.1.py (renamed from doc/blender.1.py)2
-rw-r--r--doc/python_api/blender-org/layout.html201
-rw-r--r--doc/python_api/blender-org/page.html4
-rw-r--r--doc/python_api/blender-org/static/bg.pngbin0 -> 55840 bytes
-rw-r--r--doc/python_api/blender-org/static/default.css_t654
-rw-r--r--doc/python_api/blender-org/static/favicon.icobin0 -> 1150 bytes
-rw-r--r--doc/python_api/blender-org/static/jquery.sidebar.js26
-rw-r--r--doc/python_api/blender-org/static/pygments.css61
-rw-r--r--doc/python_api/blender-org/static/rnd.pngbin0 -> 173 bytes
-rw-r--r--doc/python_api/blender-org/static/rndbl.pngbin0 -> 190 bytes
-rw-r--r--doc/python_api/blender-org/static/rndbr.pngbin0 -> 188 bytes
-rw-r--r--doc/python_api/blender-org/theme.conf30
-rw-r--r--doc/python_api/epy/BGL.py (renamed from source/blender/python/doc/epy/BGL.py)0
-rw-r--r--doc/python_api/epy/Geometry.py (renamed from source/blender/python/doc/epy/Geometry.py)0
-rw-r--r--doc/python_api/epy/IDProp.py (renamed from source/blender/python/doc/epy/IDProp.py)0
-rw-r--r--doc/python_api/epy/Mathutils.py (renamed from source/blender/python/doc/epy/Mathutils.py)0
-rw-r--r--doc/python_api/epy/testbgl.py (renamed from source/blender/python/doc/epy/testbgl.py)0
-rw-r--r--doc/python_api/examples/bpy.data.py (renamed from source/blender/python/doc/examples/bpy.data.py)0
-rw-r--r--doc/python_api/examples/mathutils.Euler.py (renamed from source/blender/python/doc/examples/mathutils.Euler.py)0
-rw-r--r--doc/python_api/examples/mathutils.Matrix.py (renamed from source/blender/python/doc/examples/mathutils.Matrix.py)0
-rw-r--r--doc/python_api/examples/mathutils.Quaternion.py (renamed from source/blender/python/doc/examples/mathutils.Quaternion.py)0
-rw-r--r--doc/python_api/examples/mathutils.Vector.py (renamed from source/blender/python/doc/examples/mathutils.Vector.py)0
-rw-r--r--doc/python_api/examples/mathutils.py (renamed from source/blender/python/doc/examples/mathutils.py)0
-rw-r--r--doc/python_api/rst/bge.events.rst (renamed from source/gameengine/PyDoc/bge.events.rst)35
-rw-r--r--doc/python_api/rst/bge.logic.rst (renamed from source/gameengine/PyDoc/bge.logic.rst)2
-rw-r--r--doc/python_api/rst/bge.render.rst (renamed from source/gameengine/PyDoc/bge.render.rst)0
-rw-r--r--doc/python_api/rst/bge.types.rst (renamed from source/gameengine/PyDoc/bge.types.rst)62
-rw-r--r--doc/python_api/sphinx_doc_gen.py (renamed from source/blender/python/doc/sphinx_doc_gen.py)44
-rwxr-xr-xdoc/python_api/sphinx_doc_gen.sh (renamed from source/blender/python/doc/sphinx_doc_gen.sh)20
-rw-r--r--extern/CMakeLists.txt3
-rw-r--r--intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp27
-rw-r--r--intern/boolop/intern/BOP_Interface.cpp20
-rw-r--r--intern/boolop/intern/BOP_Merge2.cpp46
-rw-r--r--intern/ghost/GHOST_Types.h4
-rw-r--r--intern/ghost/intern/GHOST_Debug.h4
-rw-r--r--intern/ghost/intern/GHOST_EventPrinter.cpp5
-rw-r--r--intern/ghost/intern/GHOST_ModifierKeys.cpp14
-rw-r--r--intern/ghost/intern/GHOST_ModifierKeys.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp4
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm8
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp249
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h33
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp10
-rw-r--r--intern/ghost/test/multitest/EventToBuf.c2
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h4
-rw-r--r--intern/guardedalloc/SConscript11
-rw-r--r--intern/guardedalloc/cpp/mallocn.cpp2
-rw-r--r--intern/guardedalloc/intern/mallocn.c14
-rw-r--r--intern/iksolver/intern/IK_Solver.cpp1
-rw-r--r--intern/moto/include/MT_assert.h4
-rw-r--r--intern/opennl/superlu/ssp_defs.h2
-rw-r--r--intern/string/SConscript8
-rw-r--r--release/scripts/io/netrender/client.py29
-rw-r--r--release/scripts/io/netrender/operators.py9
-rw-r--r--release/scripts/io/netrender/slave.py11
-rw-r--r--release/scripts/modules/animsys_refactor.py64
-rw-r--r--release/scripts/modules/bpy/ops.py11
-rw-r--r--release/scripts/modules/bpy_types.py6
-rw-r--r--release/scripts/modules/console/intellisense.py6
-rw-r--r--release/scripts/modules/rigify/__init__.py6
-rw-r--r--release/scripts/modules/rna_info.py6
-rw-r--r--release/scripts/modules/sys_info.py103
-rw-r--r--release/scripts/op/image.py14
-rw-r--r--release/scripts/op/io_scene_3ds/export_3ds.py1
-rw-r--r--release/scripts/op/io_scene_obj/export_obj.py4
-rw-r--r--release/scripts/op/presets.py10
-rw-r--r--release/scripts/op/screen_play_rendered_anim.py8
-rw-r--r--release/scripts/op/uv.py4
-rw-r--r--release/scripts/op/wm.py9
-rw-r--r--release/scripts/presets/interaction/maya.py386
-rw-r--r--release/scripts/presets/render/HDV_1080p.py2
-rw-r--r--release/scripts/presets/render/HDV_NTSC_1080p.py8
-rw-r--r--release/scripts/presets/render/HDV_PAL_1080p.py8
-rw-r--r--release/scripts/templates/gamelogic.py9
-rw-r--r--release/scripts/templates/gamelogic_basic.py3
-rw-r--r--release/scripts/templates/gamelogic_module.py4
-rw-r--r--release/scripts/ui/properties_data_armature_rigify.py13
-rw-r--r--release/scripts/ui/properties_data_mesh.py4
-rw-r--r--release/scripts/ui/properties_object.py28
-rw-r--r--release/scripts/ui/properties_particle.py6
-rw-r--r--release/scripts/ui/properties_render.py5
-rw-r--r--release/scripts/ui/properties_texture.py9
-rw-r--r--release/scripts/ui/space_image.py41
-rw-r--r--release/scripts/ui/space_info.py20
-rw-r--r--release/scripts/ui/space_userpref.py6
-rw-r--r--release/scripts/ui/space_userpref_keymap.py4
-rw-r--r--release/scripts/ui/space_view3d.py97
-rw-r--r--release/scripts/ui/space_view3d_toolbar.py2
-rw-r--r--source/blender/CMakeLists.txt18
-rw-r--r--source/blender/avi/intern/avirgb.c4
-rw-r--r--source/blender/avi/intern/endian.c2
-rw-r--r--source/blender/avi/intern/mjpeg.c11
-rw-r--r--source/blender/avi/intern/options.c2
-rw-r--r--source/blender/avi/intern/rgb32.c4
-rw-r--r--source/blender/blenfont/intern/blf_lang.c2
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h4
-rw-r--r--source/blender/blenkernel/BKE_blender.h4
-rw-r--r--source/blender/blenkernel/BKE_cloth.h2
-rw-r--r--source/blender/blenkernel/BKE_context.h6
-rw-r--r--source/blender/blenkernel/BKE_customdata.h8
-rw-r--r--source/blender/blenkernel/BKE_depsgraph.h8
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h8
-rw-r--r--source/blender/blenkernel/BKE_global.h4
-rw-r--r--source/blender/blenkernel/BKE_image.h2
-rw-r--r--source/blender/blenkernel/BKE_library.h8
-rw-r--r--source/blender/blenkernel/BKE_main.h8
-rw-r--r--source/blender/blenkernel/BKE_mesh.h4
-rw-r--r--source/blender/blenkernel/BKE_modifier.h2
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/BKE_scene.h10
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h6
-rw-r--r--source/blender/blenkernel/BKE_texture.h8
-rw-r--r--source/blender/blenkernel/BKE_utildefines.h8
-rw-r--r--source/blender/blenkernel/SConscript2
-rw-r--r--source/blender/blenkernel/intern/BME_tools.c18
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c19
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c25
-rw-r--r--source/blender/blenkernel/intern/action.c2
-rw-r--r--source/blender/blenkernel/intern/anim.c4
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c44
-rw-r--r--source/blender/blenkernel/intern/armature.c27
-rw-r--r--source/blender/blenkernel/intern/blender.c21
-rw-r--r--source/blender/blenkernel/intern/boids.c8
-rw-r--r--source/blender/blenkernel/intern/brush.c6
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c96
-rw-r--r--source/blender/blenkernel/intern/cloth.c37
-rw-r--r--source/blender/blenkernel/intern/collision.c4
-rw-r--r--source/blender/blenkernel/intern/colortools.c10
-rw-r--r--source/blender/blenkernel/intern/constraint.c48
-rw-r--r--source/blender/blenkernel/intern/curve.c8
-rw-r--r--source/blender/blenkernel/intern/customdata.c53
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c2
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c4
-rw-r--r--source/blender/blenkernel/intern/displist.c6
-rw-r--r--source/blender/blenkernel/intern/effect.c9
-rw-r--r--source/blender/blenkernel/intern/exotic.c14
-rw-r--r--source/blender/blenkernel/intern/fcurve.c4
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c60
-rw-r--r--source/blender/blenkernel/intern/font.c8
-rw-r--r--source/blender/blenkernel/intern/group.c3
-rw-r--r--source/blender/blenkernel/intern/idprop.c9
-rw-r--r--source/blender/blenkernel/intern/image.c56
-rw-r--r--source/blender/blenkernel/intern/implicit.c10
-rw-r--r--source/blender/blenkernel/intern/ipo.c4
-rw-r--r--source/blender/blenkernel/intern/key.c4
-rw-r--r--source/blender/blenkernel/intern/lattice.c65
-rw-r--r--source/blender/blenkernel/intern/library.c20
-rw-r--r--source/blender/blenkernel/intern/mesh.c14
-rw-r--r--source/blender/blenkernel/intern/modifier.c8
-rw-r--r--source/blender/blenkernel/intern/multires.c6
-rw-r--r--source/blender/blenkernel/intern/nla.c2
-rw-r--r--source/blender/blenkernel/intern/object.c86
-rw-r--r--source/blender/blenkernel/intern/packedFile.c21
-rw-r--r--source/blender/blenkernel/intern/paint.c3
-rw-r--r--source/blender/blenkernel/intern/particle.c19
-rw-r--r--source/blender/blenkernel/intern/particle_system.c22
-rw-r--r--source/blender/blenkernel/intern/pointcache.c46
-rw-r--r--source/blender/blenkernel/intern/scene.c13
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c130
-rw-r--r--source/blender/blenkernel/intern/sequencer.c66
-rw-r--r--source/blender/blenkernel/intern/smoke.c4
-rw-r--r--source/blender/blenkernel/intern/softbody.c26
-rw-r--r--source/blender/blenkernel/intern/sound.c9
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c31
-rw-r--r--source/blender/blenkernel/intern/text.c2
-rw-r--r--source/blender/blenkernel/intern/unit.c3
-rw-r--r--source/blender/blenkernel/intern/writeavi.c7
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c4
-rw-r--r--source/blender/blenkernel/intern/writeframeserver.c9
-rw-r--r--source/blender/blenlib/BLI_bpath.h2
-rw-r--r--source/blender/blenlib/BLI_fileops.h8
-rw-r--r--source/blender/blenlib/BLI_math_base.h5
-rw-r--r--source/blender/blenlib/BLI_math_color.h1
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h2
-rw-r--r--source/blender/blenlib/BLI_math_rotation.h3
-rw-r--r--source/blender/blenlib/BLI_math_vector.h2
-rw-r--r--source/blender/blenlib/BLI_scanfill.h2
-rw-r--r--source/blender/blenlib/intern/BLI_kdtree.c1
-rw-r--r--source/blender/blenlib/intern/bpath.c2
-rw-r--r--source/blender/blenlib/intern/dynlib.c1
-rw-r--r--source/blender/blenlib/intern/math_color.c34
-rw-r--r--source/blender/blenlib/intern/math_geom.c27
-rw-r--r--source/blender/blenlib/intern/math_matrix.c20
-rw-r--r--source/blender/blenlib/intern/math_rotation.c67
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c6
-rw-r--r--source/blender/blenlib/intern/noise.c10
-rw-r--r--source/blender/blenlib/intern/path_util.c4
-rw-r--r--source/blender/blenlib/intern/pbvh.c1
-rw-r--r--source/blender/blenlib/intern/scanfill.c2
-rw-r--r--source/blender/blenlib/intern/threads.c2
-rw-r--r--source/blender/blenloader/BLO_writefile.h3
-rw-r--r--source/blender/blenloader/intern/readblenentry.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c61
-rw-r--r--source/blender/blenloader/intern/readfile.h2
-rw-r--r--source/blender/blenloader/intern/writefile.c8
-rw-r--r--source/blender/blenpluginapi/iff.h2
-rw-r--r--source/blender/blenpluginapi/intern/pluginapi.c5
-rw-r--r--source/blender/collada/AnimationImporter.cpp1149
-rw-r--r--source/blender/collada/AnimationImporter.h132
-rw-r--r--source/blender/collada/ArmatureExporter.cpp469
-rw-r--r--source/blender/collada/ArmatureExporter.h137
-rw-r--r--source/blender/collada/ArmatureImporter.cpp585
-rw-r--r--source/blender/collada/ArmatureImporter.h160
-rw-r--r--source/blender/collada/CameraExporter.cpp86
-rw-r--r--source/blender/collada/CameraExporter.h (renamed from source/blender/verify/BLO_signer_info.h)34
-rw-r--r--source/blender/collada/DocumentExporter.cpp1798
-rw-r--r--source/blender/collada/DocumentExporter.h6
-rw-r--r--source/blender/collada/DocumentImporter.cpp3253
-rw-r--r--source/blender/collada/DocumentImporter.h5
-rw-r--r--source/blender/collada/EffectExporter.cpp306
-rw-r--r--source/blender/collada/EffectExporter.h62
-rw-r--r--source/blender/collada/GeometryExporter.cpp472
-rw-r--r--source/blender/collada/GeometryExporter.h114
-rw-r--r--source/blender/collada/ImageExporter.cpp94
-rw-r--r--source/blender/collada/ImageExporter.h50
-rw-r--r--source/blender/collada/InstanceWriter.cpp64
-rw-r--r--source/blender/collada/InstanceWriter.h39
-rw-r--r--source/blender/collada/LightExporter.cpp139
-rw-r--r--source/blender/collada/LightExporter.h43
-rw-r--r--source/blender/collada/MaterialExporter.cpp53
-rw-r--r--source/blender/collada/MaterialExporter.h94
-rw-r--r--source/blender/collada/MeshImporter.cpp912
-rw-r--r--source/blender/collada/MeshImporter.h152
-rw-r--r--source/blender/collada/SkinInfo.cpp324
-rw-r--r--source/blender/collada/SkinInfo.h133
-rw-r--r--source/blender/collada/TransformReader.cpp125
-rw-r--r--source/blender/collada/TransformReader.h70
-rw-r--r--source/blender/collada/TransformWriter.cpp100
-rw-r--r--source/blender/collada/TransformWriter.h48
-rw-r--r--source/blender/collada/collada.cpp6
-rw-r--r--source/blender/collada/collada_internal.cpp266
-rw-r--r--source/blender/collada/collada_internal.h87
-rw-r--r--source/blender/collada/collada_utils.cpp106
-rw-r--r--source/blender/collada/collada_utils.h50
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c128
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c8
-rw-r--r--source/blender/editors/animation/anim_deps.c6
-rw-r--r--source/blender/editors/animation/anim_draw.c2
-rw-r--r--source/blender/editors/animation/anim_filter.c6
-rw-r--r--source/blender/editors/animation/anim_markers.c22
-rw-r--r--source/blender/editors/animation/anim_ops.c4
-rw-r--r--source/blender/editors/animation/drivers.c12
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c18
-rw-r--r--source/blender/editors/animation/keyframes_draw.c4
-rw-r--r--source/blender/editors/animation/keyframes_edit.c36
-rw-r--r--source/blender/editors/animation/keyframes_general.c2
-rw-r--r--source/blender/editors/animation/keyframing.c4
-rw-r--r--source/blender/editors/animation/keyingsets.c6
-rw-r--r--source/blender/editors/armature/armature_intern.h4
-rw-r--r--source/blender/editors/armature/armature_ops.c4
-rw-r--r--source/blender/editors/armature/editarmature.c200
-rw-r--r--source/blender/editors/armature/editarmature_generate.c6
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c6
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c46
-rw-r--r--source/blender/editors/armature/meshlaplacian.c23
-rw-r--r--source/blender/editors/armature/meshlaplacian.h2
-rw-r--r--source/blender/editors/armature/poseSlide.c46
-rw-r--r--source/blender/editors/armature/poselib.c26
-rw-r--r--source/blender/editors/armature/poseobject.c113
-rw-r--r--source/blender/editors/armature/reeb.c12
-rw-r--r--source/blender/editors/curve/curve_ops.c4
-rw-r--r--source/blender/editors/curve/editcurve.c73
-rw-r--r--source/blender/editors/curve/editfont.c18
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c14
-rw-r--r--source/blender/editors/include/ED_armature.h14
-rw-r--r--source/blender/editors/include/ED_keyframes_draw.h2
-rw-r--r--source/blender/editors/include/ED_keyframing.h10
-rw-r--r--source/blender/editors/include/ED_mesh.h12
-rw-r--r--source/blender/editors/include/ED_node.h2
-rw-r--r--source/blender/editors/include/ED_object.h10
-rw-r--r--source/blender/editors/include/ED_screen.h2
-rw-r--r--source/blender/editors/include/ED_screen_types.h3
-rw-r--r--source/blender/editors/include/ED_types.h5
-rw-r--r--source/blender/editors/include/ED_uvedit.h1
-rw-r--r--source/blender/editors/include/UI_interface.h21
-rw-r--r--source/blender/editors/include/UI_view2d.h10
-rw-r--r--source/blender/editors/interface/interface.c27
-rw-r--r--source/blender/editors/interface/interface_draw.c14
-rw-r--r--source/blender/editors/interface/interface_handlers.c118
-rw-r--r--source/blender/editors/interface/interface_icons.c108
-rw-r--r--source/blender/editors/interface/interface_intern.h37
-rw-r--r--source/blender/editors/interface/interface_layout.c20
-rw-r--r--source/blender/editors/interface/interface_ops.c6
-rw-r--r--source/blender/editors/interface/interface_panel.c14
-rw-r--r--source/blender/editors/interface/interface_regions.c138
-rw-r--r--source/blender/editors/interface/interface_templates.c46
-rw-r--r--source/blender/editors/interface/interface_utils.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c93
-rw-r--r--source/blender/editors/interface/view2d.c31
-rw-r--r--source/blender/editors/interface/view2d_ops.c68
-rw-r--r--source/blender/editors/mesh/editface.c16
-rw-r--r--source/blender/editors/mesh/editmesh.c12
-rw-r--r--source/blender/editors/mesh/editmesh_add.c108
-rw-r--r--source/blender/editors/mesh/editmesh_lib.c24
-rw-r--r--source/blender/editors/mesh/editmesh_loop.c4
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c26
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c52
-rw-r--r--source/blender/editors/mesh/loopcut.c30
-rw-r--r--source/blender/editors/mesh/mesh_data.c20
-rw-r--r--source/blender/editors/mesh/mesh_ops.c7
-rw-r--r--source/blender/editors/mesh/meshtools.c6
-rw-r--r--source/blender/editors/metaball/mball_edit.c14
-rw-r--r--source/blender/editors/object/object_add.c27
-rw-r--r--source/blender/editors/object/object_bake.c6
-rw-r--r--source/blender/editors/object/object_constraint.c47
-rw-r--r--source/blender/editors/object/object_edit.c40
-rw-r--r--source/blender/editors/object/object_group.c6
-rw-r--r--source/blender/editors/object/object_hook.c4
-rw-r--r--source/blender/editors/object/object_lattice.c2
-rw-r--r--source/blender/editors/object/object_modifier.c68
-rw-r--r--source/blender/editors/object/object_ops.c2
-rw-r--r--source/blender/editors/object/object_relations.c20
-rw-r--r--source/blender/editors/object/object_select.c6
-rw-r--r--source/blender/editors/object/object_shapekey.c31
-rw-r--r--source/blender/editors/object/object_transform.c22
-rw-r--r--source/blender/editors/object/object_vgroup.c18
-rw-r--r--source/blender/editors/physics/particle_boids.c14
-rw-r--r--source/blender/editors/physics/particle_edit.c60
-rw-r--r--source/blender/editors/physics/particle_object.c22
-rw-r--r--source/blender/editors/physics/physics_fluid.c22
-rw-r--r--source/blender/editors/physics/physics_pointcache.c16
-rw-r--r--source/blender/editors/render/render_internal.c6
-rw-r--r--source/blender/editors/render/render_preview.c22
-rw-r--r--source/blender/editors/render/render_shading.c56
-rw-r--r--source/blender/editors/screen/area.c20
-rw-r--r--source/blender/editors/screen/glutil.c3
-rw-r--r--source/blender/editors/screen/screen_context.c23
-rw-r--r--source/blender/editors/screen/screen_edit.c18
-rw-r--r--source/blender/editors/screen/screen_intern.h4
-rw-r--r--source/blender/editors/screen/screen_ops.c118
-rw-r--r--source/blender/editors/screen/screendump.c11
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c81
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h2
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_undo.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c14
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c12
-rw-r--r--source/blender/editors/sound/sound_ops.c2
-rw-r--r--source/blender/editors/space_action/action_draw.c6
-rw-r--r--source/blender/editors/space_action/action_edit.c18
-rw-r--r--source/blender/editors/space_action/action_intern.h2
-rw-r--r--source/blender/editors/space_action/action_select.c8
-rw-r--r--source/blender/editors/space_action/space_action.c28
-rw-r--r--source/blender/editors/space_api/spacetypes.c11
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c16
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c3
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c7
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c8
-rw-r--r--source/blender/editors/space_console/console_draw.c40
-rw-r--r--source/blender/editors/space_console/console_intern.h7
-rw-r--r--source/blender/editors/space_console/console_ops.c45
-rw-r--r--source/blender/editors/space_console/console_report.c10
-rw-r--r--source/blender/editors/space_console/space_console.c12
-rw-r--r--source/blender/editors/space_file/file_draw.c9
-rw-r--r--source/blender/editors/space_file/file_ops.c47
-rw-r--r--source/blender/editors/space_file/file_panels.c4
-rw-r--r--source/blender/editors/space_file/filelist.c18
-rw-r--r--source/blender/editors/space_file/filesel.c11
-rw-r--r--source/blender/editors/space_file/space_file.c12
-rw-r--r--source/blender/editors/space_file/writeimage.c15
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c51
-rw-r--r--source/blender/editors/space_graph/graph_draw.c52
-rw-r--r--source/blender/editors/space_graph/graph_edit.c28
-rw-r--r--source/blender/editors/space_graph/graph_intern.h4
-rw-r--r--source/blender/editors/space_graph/graph_ops.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c10
-rw-r--r--source/blender/editors/space_graph/space_graph.c21
-rw-r--r--source/blender/editors/space_image/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_image/SConscript2
-rw-r--r--source/blender/editors/space_image/image_buttons.c15
-rw-r--r--source/blender/editors/space_image/image_draw.c12
-rw-r--r--source/blender/editors/space_image/image_header.c2
-rw-r--r--source/blender/editors/space_image/image_ops.c44
-rw-r--r--source/blender/editors/space_image/image_render.c2
-rw-r--r--source/blender/editors/space_image/space_image.c18
-rw-r--r--source/blender/editors/space_info/info_ops.c24
-rw-r--r--source/blender/editors/space_info/space_info.c18
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c4
-rw-r--r--source/blender/editors/space_logic/logic_ops.c12
-rw-r--r--source/blender/editors/space_logic/logic_window.c42
-rw-r--r--source/blender/editors/space_logic/space_logic.c16
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c12
-rw-r--r--source/blender/editors/space_nla/nla_channels.c2
-rw-r--r--source/blender/editors/space_nla/nla_draw.c14
-rw-r--r--source/blender/editors/space_nla/nla_edit.c30
-rw-r--r--source/blender/editors/space_nla/nla_intern.h2
-rw-r--r--source/blender/editors/space_nla/nla_ops.c4
-rw-r--r--source/blender/editors/space_nla/space_nla.c26
-rw-r--r--source/blender/editors/space_node/drawnode.c98
-rw-r--r--source/blender/editors/space_node/node_buttons.c6
-rw-r--r--source/blender/editors/space_node/node_draw.c33
-rw-r--r--source/blender/editors/space_node/node_edit.c37
-rw-r--r--source/blender/editors/space_node/node_header.c4
-rw-r--r--source/blender/editors/space_node/node_intern.h2
-rw-r--r--source/blender/editors/space_node/node_select.c12
-rw-r--r--source/blender/editors/space_node/node_state.c8
-rw-r--r--source/blender/editors/space_node/space_node.c12
-rw-r--r--source/blender/editors/space_outliner/outliner.c274
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c33
-rw-r--r--source/blender/editors/space_script/script_edit.c2
-rw-r--r--source/blender/editors/space_script/script_header.c8
-rw-r--r--source/blender/editors/space_script/space_script.c10
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c34
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c90
-rw-r--r--source/blender/editors/space_sequencer/sequencer_scopes.c18
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c12
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c12
-rw-r--r--source/blender/editors/space_sound/sound_header.c7
-rw-r--r--source/blender/editors/space_sound/space_sound.c16
-rw-r--r--source/blender/editors/space_text/space_text.c24
-rw-r--r--source/blender/editors/space_text/text_draw.c639
-rw-r--r--source/blender/editors/space_text/text_header.c2
-rw-r--r--source/blender/editors/space_text/text_intern.h10
-rw-r--r--source/blender/editors/space_text/text_ops.c626
-rw-r--r--source/blender/editors/space_text/text_python.c16
-rw-r--r--source/blender/editors/space_time/space_time.c31
-rw-r--r--source/blender/editors/space_time/time_ops.c6
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c17
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c6
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c75
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c21
-rw-r--r--source/blender/editors/space_view3d/drawobject.c151
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c43
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c32
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c64
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h12
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c24
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c25
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c50
-rw-r--r--source/blender/editors/transform/transform.c85
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_constraints.c2
-rw-r--r--source/blender/editors/transform/transform_conversions.c110
-rw-r--r--source/blender/editors/transform/transform_input.c12
-rw-r--r--source/blender/editors/transform/transform_manipulator.c24
-rw-r--r--source/blender/editors/transform/transform_ndofinput.c2
-rw-r--r--source/blender/editors/transform/transform_ops.c12
-rw-r--r--source/blender/editors/transform/transform_orientations.c2
-rw-r--r--source/blender/editors/transform/transform_snap.c27
-rw-r--r--source/blender/editors/util/editmode_undo.c7
-rw-r--r--source/blender/editors/util/undo.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c8
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c92
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c8
-rw-r--r--source/blender/gpu/GPU_draw.h2
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c10
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c6
-rw-r--r--source/blender/gpu/intern/gpu_draw.c14
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c10
-rw-r--r--source/blender/gpu/intern/gpu_material.c2
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.c4
-rw-r--r--source/blender/imbuf/IMB_imbuf.h3
-rw-r--r--source/blender/imbuf/intern/allocimbuf.c4
-rw-r--r--source/blender/imbuf/intern/anim.c27
-rw-r--r--source/blender/imbuf/intern/bmp.c8
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c4
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c4
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c9
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.cpp2
-rw-r--r--source/blender/imbuf/intern/divers.c8
-rw-r--r--source/blender/imbuf/intern/filetype.c2
-rw-r--r--source/blender/imbuf/intern/filter.c2
-rw-r--r--source/blender/imbuf/intern/imbuf_cocoa.m2
-rw-r--r--source/blender/imbuf/intern/iris.c16
-rw-r--r--source/blender/imbuf/intern/jp2.c4
-rw-r--r--source/blender/imbuf/intern/jpeg.c8
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp2
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_multi.h25
-rw-r--r--source/blender/imbuf/intern/png.c5
-rw-r--r--source/blender/imbuf/intern/radiance_hdr.c6
-rw-r--r--source/blender/imbuf/intern/scaling.c10
-rw-r--r--source/blender/imbuf/intern/targa.c6
-rw-r--r--source/blender/imbuf/intern/thumbs.c2
-rw-r--r--source/blender/imbuf/intern/thumbs_blend.c4
-rw-r--r--source/blender/imbuf/intern/tiff.c19
-rw-r--r--source/blender/makesdna/DNA_customdata_types.h8
-rw-r--r--source/blender/makesdna/DNA_scene_types.h1
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/makesdna/DNA_texture_types.h8
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h8
-rw-r--r--source/blender/makesrna/RNA_access.h4
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt3
-rw-r--r--source/blender/makesrna/intern/rna_animation.c2
-rw-r--r--source/blender/makesrna/intern/rna_color.c2
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c14
-rw-r--r--source/blender/makesrna/intern/rna_curve.c2
-rw-r--r--source/blender/makesrna/intern/rna_define.c3
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c8
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_main.c18
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c6
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c11
-rw-r--r--source/blender/makesrna/intern/rna_object.c16
-rw-r--r--source/blender/makesrna/intern/rna_particle.c8
-rw-r--r--source/blender/makesrna/intern/rna_scene.c3
-rw-r--r--source/blender/makesrna/intern/rna_screen.c4
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c10
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c5
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c3
-rw-r--r--source/blender/makesrna/intern/rna_wm.c2
-rw-r--r--source/blender/makesrna/intern/rna_world.c5
-rw-r--r--source/blender/modifiers/MOD_modifiertypes.h2
-rw-r--r--source/blender/modifiers/intern/MOD_armature.c21
-rw-r--r--source/blender/modifiers/intern/MOD_array.c8
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c15
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c19
-rw-r--r--source/blender/modifiers/intern/MOD_build.c7
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c25
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c5
-rw-r--r--source/blender/modifiers/intern/MOD_collision.c12
-rw-r--r--source/blender/modifiers/intern/MOD_curve.c21
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c8
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c25
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c37
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c23
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim.c3
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c29
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c196
-rw-r--r--source/blender/modifiers/intern/MOD_lattice.c20
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c13
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c35
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c19
-rw-r--r--source/blender/modifiers/intern/MOD_none.c3
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c19
-rw-r--r--source/blender/modifiers/intern/MOD_particlesystem.c12
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c19
-rw-r--r--source/blender/modifiers/intern/MOD_shapekey.c30
-rw-r--r--source/blender/modifiers/intern/MOD_shrinkwrap.c21
-rw-r--r--source/blender/modifiers/intern/MOD_simpledeform.c24
-rw-r--r--source/blender/modifiers/intern/MOD_smoke.c21
-rw-r--r--source/blender/modifiers/intern/MOD_smooth.c11
-rw-r--r--source/blender/modifiers/intern/MOD_softbody.c12
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c13
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c14
-rw-r--r--source/blender/modifiers/intern/MOD_surface.c14
-rw-r--r--source/blender/modifiers/intern/MOD_util.c12
-rw-r--r--source/blender/modifiers/intern/MOD_util.h6
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c22
-rw-r--r--source/blender/modifiers/intern/MOD_wave.c29
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c6
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_blur.c187
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_brightness.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c4
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c4
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_composite.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_crop.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_curves.c6
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_defocus.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_dilate.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_displace.c6
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_flip.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_gamma.c4
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_glare.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_image.c38
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_invert.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c4
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_math.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_normal.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_normalize.c4
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c4
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_rgb.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_rotate.c6
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_scale.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c8
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c6
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c8
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c8
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c4
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_translate.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c6
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_value.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_viewer.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c2
-rw-r--r--source/blender/nodes/intern/CMP_util.c20
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_camera.c4
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_curves.c4
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_geom.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c6
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_invert.c4
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_mapping.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_math.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_normal.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_output.c4
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_rgb.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c8
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c4
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c6
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_value.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_at.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_checker.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_compose.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_coord.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_curves.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_decompose.c8
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_distance.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_image.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_invert.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_output.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_proc.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_rotate.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_scale.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_translate.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_viewer.c2
-rw-r--r--source/blender/nodes/intern/TEX_util.c2
-rw-r--r--source/blender/python/generic/IDProp.c9
-rw-r--r--source/blender/python/generic/bgl.c10
-rw-r--r--source/blender/python/generic/blf_api.c27
-rw-r--r--source/blender/python/generic/bpy_internal_import.c17
-rw-r--r--source/blender/python/generic/geometry.c26
-rw-r--r--source/blender/python/generic/mathutils.c6
-rw-r--r--source/blender/python/generic/mathutils_color.c19
-rw-r--r--source/blender/python/generic/mathutils_euler.c25
-rw-r--r--source/blender/python/generic/mathutils_matrix.c17
-rw-r--r--source/blender/python/generic/mathutils_quat.c21
-rw-r--r--source/blender/python/generic/mathutils_vector.c4
-rw-r--r--source/blender/python/generic/noise.c66
-rw-r--r--source/blender/python/intern/bpy.c10
-rw-r--r--source/blender/python/intern/bpy_app.c66
-rw-r--r--source/blender/python/intern/bpy_array.c10
-rw-r--r--source/blender/python/intern/bpy_interface.c4
-rw-r--r--source/blender/python/intern/bpy_operator.c10
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c59
-rw-r--r--source/blender/python/intern/bpy_rna.h2
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c3
-rw-r--r--source/blender/quicktime/apple/qtkit_export.m5
-rw-r--r--source/blender/quicktime/apple/qtkit_import.m6
-rw-r--r--source/blender/quicktime/apple/quicktime_export.c7
-rw-r--r--source/blender/quicktime/apple/quicktime_import.c12
-rw-r--r--source/blender/readblenfile/stub/BLO_readblenfileSTUB.c10
-rw-r--r--source/blender/render/CMakeLists.txt3
-rw-r--r--source/blender/render/intern/source/convertblender.c8
-rw-r--r--source/blender/render/intern/source/envmap.c4
-rw-r--r--source/blender/render/intern/source/imagetexture.c32
-rw-r--r--source/blender/render/intern/source/pipeline.c34
-rw-r--r--source/blender/render/intern/source/pointdensity.c2
-rw-r--r--source/blender/render/intern/source/rayobject_instance.c2
-rw-r--r--source/blender/render/intern/source/rayshade.c19
-rw-r--r--source/blender/render/intern/source/shadbuf.c2
-rw-r--r--source/blender/render/intern/source/shadeoutput.c5
-rw-r--r--source/blender/render/intern/source/sss.c4
-rw-r--r--source/blender/render/intern/source/texture.c2
-rw-r--r--source/blender/render/intern/source/volume_precache.c2
-rw-r--r--source/blender/render/intern/source/volumetric.c6
-rw-r--r--source/blender/render/intern/source/voxeldata.c4
-rw-r--r--source/blender/verify/BLO_sign_verify_Header.h80
-rw-r--r--source/blender/verify/BLO_verify.h76
-rw-r--r--source/blender/verify/Makefile34
-rw-r--r--source/blender/verify/intern/BLO_verify.c420
-rw-r--r--source/blender/verify/intern/Makefile50
-rw-r--r--source/blender/windowmanager/WM_api.h19
-rw-r--r--source/blender/windowmanager/WM_types.h9
-rw-r--r--source/blender/windowmanager/intern/wm.c2
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c8
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c29
-rw-r--r--source/blender/windowmanager/intern/wm_files.c38
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c28
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c6
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c4
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c163
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c3
-rw-r--r--source/blender/windowmanager/intern/wm_window.c86
-rw-r--r--source/blender/windowmanager/wm.h2
-rw-r--r--source/blender/windowmanager/wm_event_system.h1
-rw-r--r--source/blender/windowmanager/wm_event_types.h4
-rw-r--r--source/blender/windowmanager/wm_window.h6
-rw-r--r--source/blenderplayer/CMakeLists.txt12
-rw-r--r--source/blenderplayer/bad_level_call_stubs/CMakeLists.txt4
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c8
-rw-r--r--source/creator/CMakeLists.txt45
-rw-r--r--source/creator/buildinfo.c11
-rw-r--r--source/creator/creator.c67
-rw-r--r--source/darwin/Makefile16
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp16
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp8
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.cpp60
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.h2
-rw-r--r--source/gameengine/BlenderRoutines/Makefile2
-rw-r--r--source/gameengine/BlenderRoutines/SConscript3
-rw-r--r--source/gameengine/CMakeLists.txt5
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp2
-rw-r--r--source/gameengine/Converter/CMakeLists.txt4
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp41
-rw-r--r--source/gameengine/Converter/SConscript6
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h11
-rw-r--r--source/gameengine/Expressions/SConscript3
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.h1
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp2
-rw-r--r--source/gameengine/GameLogic/SConscript4
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.cpp3
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp22
-rw-r--r--source/gameengine/Ketsji/BL_Texture.cpp2
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt8
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.h5
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObject.h13
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp18
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h1
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp28
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp30
-rw-r--r--source/gameengine/Ketsji/SConscript9
-rw-r--r--source/gameengine/Network/SConscript8
-rw-r--r--source/gameengine/Physics/Bullet/CMakeLists.txt4
-rw-r--r--source/gameengine/Physics/Bullet/SConscript6
-rw-r--r--source/gameengine/Physics/Dummy/SConscript8
-rw-r--r--source/gameengine/Physics/common/SConscript8
-rw-r--r--source/gameengine/Rasterizer/RAS_2DFilterManager.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript3
-rw-r--r--source/gameengine/Rasterizer/SConscript3
-rw-r--r--source/gameengine/SConscript4
-rw-r--r--source/gameengine/SceneGraph/SConscript8
-rw-r--r--source/gameengine/VideoTexture/ImageBuff.cpp8
770 files changed, 15595 insertions, 11321 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 63cade84647..39ef55f351f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,6 @@ GET_BLENDER_VERSION()
# Blender internal features
OPTION(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
-OPTION(WITH_LCMS "Enable color correction with lcms" OFF)
OPTION(WITH_PYTHON "Enable Embedded Python API" ON)
OPTION(WITH_BUILDINFO "Include extra build details" ON)
OPTION(WITH_FLUID "Enable Elbeem (Fluid Simulation)" ON)
@@ -126,12 +125,11 @@ IF(APPLE)
OPTION(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF)
ENDIF(APPLE)
-IF(NOT WITH_BULLET AND WITH_GAMEENGINE)
- MESSAGE("WARNING: WITH_GAMEENGINE needs WITH_BULLET")
-ENDIF(NOT WITH_BULLET AND WITH_GAMEENGINE)
+# only for developers who want to make this functional
+# OPTION(WITH_LCMS "Enable color correction with lcms" OFF)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
- MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
+ MESSAGE(FATAL_ERROR "WITH_PLAYER needs WITH_GAMEENGINE")
ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
IF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL)
@@ -149,7 +147,7 @@ TEST_SSE_SUPPORT()
# On Macs:
# cmake -D PYTHON_INC=/System/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/config -G Xcode ../blender
#
-# When changing any of this remember to update the notes in doc/blender-cmake.txt
+# When changing any of this remember to update the notes in doc/build_systems/cmake.txt
#-----------------------------------------------------------------------------
#Platform specifics
@@ -297,7 +295,8 @@ IF(UNIX AND NOT APPLE)
FIND_PACKAGE(X11 REQUIRED)
- SET(LLIBS "-lc -lm -lpthread -lstdc++ ${X11_X11_LIB} ${X11_Xinput_LIB}")
+ # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
+ SET(LLIBS "-lutil -lc -lm -lpthread -lstdc++ ${X11_X11_LIB} ${X11_Xinput_LIB}")
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# BSD's dont use libdl.so
@@ -314,12 +313,12 @@ IF(UNIX AND NOT APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(WITH_OPENMP)
-
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
SET(PLATFORM_LINKFLAGS "-pthread")
# Better warnings
+ # note: -Wunused-parameter is added below for all GCC compilers
SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
@@ -331,12 +330,12 @@ IF(WIN32)
# this file is included anyway when building under Windows with cl.exe
# INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
-
+
SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
# Setup 64bit and 64bit windows systems
IF(CMAKE_CL_64)
- message("64 bit compiler detected.")
+ MESSAGE("64 bit compiler detected.")
SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
ENDIF(CMAKE_CL_64)
@@ -477,14 +476,16 @@ IF(WIN32)
SET(OPENCOLLADA_INC ${OPENCOLLADA}/include)
SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
SET(OPENCOLLADA_LIB OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser xml2 buffer ftoa)
- #pcre is bundled with openCollada
- #SET(PCRE ${LIBDIR}/pcre)
- #SET(PCRE_LIBPATH ${PCRE}/lib)
SET(PCRE_LIB pcre)
ENDIF(WITH_OPENCOLLADA)
- # TODO: IF(WITH_LCMS)
-
+ IF(WITH_LCMS)
+ SET(LCMS ${LIBDIR}/lcms)
+ SET(LCMS_INCLUDE_DIR ${LCMS}/include)
+ SET(LCMS_LIBPATH ${LCMS}/lib)
+ SET(LCMS_LIB lcms)
+ ENDIF(WITH_LCMS)
+
IF(WITH_FFMPEG)
SET(FFMPEG ${LIBDIR}/ffmpeg)
SET(FFMPEG_INC ${FFMPEG}/include ${FFMPEG}/include/msvc)
@@ -535,7 +536,7 @@ IF(WIN32)
ELSE(CMAKE_CL_64)
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
ENDIF(CMAKE_CL_64)
-
+
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
ELSE(MSVC) # MINGW
@@ -551,17 +552,6 @@ IF(WIN32)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
-
- SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
- SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
-
- SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG")
- SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG")
-
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG")
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG")
-
-
IF(WITH_OPENMP)
SET(LLIBS "${LLIBS} -lgomp")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
@@ -605,9 +595,6 @@ IF(WIN32)
SET(OPENCOLLADA_INC ${OPENCOLLADA}/include)
SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
SET(OPENCOLLADA_LIB OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
- #pcre is bundled with openCollada
- #SET(PCRE ${LIBDIR}/pcre)
- #SET(PCRE_LIBPATH ${PCRE}/lib)
SET(PCRE_LIB pcre)
ENDIF(WITH_OPENCOLLADA)
@@ -922,6 +909,26 @@ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
#-----------------------------------------------------------------------------
# Extra compile flags
+
+IF((NOT WIN32) AND (NOT MSVC))
+ # used for internal debug checks
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
+
+ # assert() checks for this.
+ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
+ SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG")
+
+ SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
+ SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG")
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG")
+ENDIF((NOT WIN32) AND (NOT MSVC))
+
+IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(C_WARNINGS "${C_WARNINGS} -Wunused-parameter -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
@@ -933,9 +940,9 @@ ENDIF(WITH_CXX_GUARDEDALLOC)
#-----------------------------------------------------------------------------
# Libraries
FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "")
+ADD_SUBDIRECTORY(source)
ADD_SUBDIRECTORY(intern)
ADD_SUBDIRECTORY(extern)
-ADD_SUBDIRECTORY(source)
#-----------------------------------------------------------------------------
diff --git a/COPYING b/COPYING
index 6e1e14ac224..3be7c91320a 100644
--- a/COPYING
+++ b/COPYING
@@ -2,7 +2,7 @@ Blender uses the GNU General Public License, which describes the rights
to distribute or change the code.
Please read this file for the full license.
-doc/GPL-license.txt
+doc/license/GPL-license.txt
Apart from the GNU GPL, Blender is not available under other licenses.
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 0957ace301c..08a571cceaf 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -172,11 +172,17 @@ MACRO(SETUP_LIBLINKS
TARGET_LINK_LIBRARIES(${target} optimized ${EXPAT_LIB})
ENDIF(EXPAT_LIB)
ELSE(WIN32)
- TARGET_LINK_LIBRARIES(${target} ${OPENCOLLADA_LIB})
+ TARGET_LINK_LIBRARIES(${target} ${OPENCOLLADA_LIB})
TARGET_LINK_LIBRARIES(${target} ${PCRE_LIB})
TARGET_LINK_LIBRARIES(${target} ${EXPAT_LIB})
ENDIF(WIN32)
ENDIF(WITH_OPENCOLLADA)
+ IF(WITH_LCMS)
+ IF(WIN32)
+ TARGET_LINK_LIBRARIES(${target} debug ${LCMS_LIB}_d)
+ TARGET_LINK_LIBRARIES(${target} optimized ${LCMS_LIB})
+ ENDIF(WIN32)
+ ENDIF(WITH_LCMS)
IF(WIN32)
TARGET_LINK_LIBRARIES(${target} ${PTHREADS_LIB})
ENDIF(WIN32)
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index 1423e8fb392..f23d4a6390b 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -340,7 +340,7 @@ BF_PROFILE_LINKFLAGS = ['-pg']
BF_PROFILE = False
BF_DEBUG = False
-BF_DEBUG_CCFLAGS = ['-g']
+BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG']
#############################################################################
################### Output directories ##################
diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py
index 5678b4bda0a..afc71d01c94 100644
--- a/build_files/scons/config/freebsd7-config.py
+++ b/build_files/scons/config/freebsd7-config.py
@@ -204,7 +204,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_DEBUG = False
-BF_DEBUG_CCFLAGS = ['-g']
+BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG']
BF_BUILDDIR = '../build/freebsd7'
BF_INSTALLDIR='../install/freebsd7'
diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py
index bc09e87d59f..d11618b6293 100644
--- a/build_files/scons/config/freebsd8-config.py
+++ b/build_files/scons/config/freebsd8-config.py
@@ -204,7 +204,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_DEBUG = False
-BF_DEBUG_CCFLAGS = ['-g']
+BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG']
BF_BUILDDIR = '../build/freebsd8'
BF_INSTALLDIR='../install/freebsd8'
diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py
index 3fb4ebe7cd6..2aadbf0f960 100644
--- a/build_files/scons/config/freebsd9-config.py
+++ b/build_files/scons/config/freebsd9-config.py
@@ -204,7 +204,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_DEBUG = False
-BF_DEBUG_CCFLAGS = ['-g']
+BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG']
BF_BUILDDIR = '../build/freebsd9'
BF_INSTALLDIR='../install/freebsd9'
diff --git a/build_files/scons/config/linux2-config.py b/build_files/scons/config/linux2-config.py
index 75428937b39..fd0364f9ce9 100644
--- a/build_files/scons/config/linux2-config.py
+++ b/build_files/scons/config/linux2-config.py
@@ -23,9 +23,11 @@ WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
BF_LIBSAMPLERATE = '/usr'
+WITH_BF_STATICLIBSAMPLERATE = False
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
BF_LIBSAMPLERATE_LIB = 'samplerate'
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
+BF_LIBSAMPLERATE_LIB_STATIC = '${BF_LIBSAMPLERATE}/lib/libsamplerate.a'
WITH_BF_JACK = False
BF_JACK = '/usr'
@@ -34,10 +36,12 @@ BF_JACK_LIB = 'jack'
BF_JACK_LIBPATH = '${BF_JACK}/lib'
WITH_BF_SNDFILE = False
+WITH_BF_STATICSNDFILE = False
BF_SNDFILE = '/usr'
BF_SNDFILE_INC = '${BF_SNDFILE}/include/sndfile'
BF_SNDFILE_LIB = 'sndfile'
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
+BF_SNDFILE_LIB_STATIC = '${BF_SNDFILE}/lib/libsndfile.a ${BF_OGG}/lib/libvorbis.a ${BF_OGG}/lib/libFLAC.a ${BF_OGG}/lib/libvorbisenc.a ${BF_OGG}/lib/libogg.a'
WITH_BF_SDL = True
BF_SDL = '/usr' #$(shell sdl-config --prefix)
@@ -136,10 +140,12 @@ BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_FFTW3 = False
-BF_FFTW3 = LIBDIR + '/usr'
+WITH_BF_STATICFFTW3 = False
+BF_FFTW3 = '/usr'
BF_FFTW3_INC = '${BF_FFTW3}/include'
BF_FFTW3_LIB = 'fftw3'
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
+BF_FFTW3_LIB_STATIC = '${BF_FFTW3_LIBPATH}/libfftw3.a'
WITH_BF_REDCODE = False
BF_REDCODE = '#extern/libredcode'
@@ -198,7 +204,7 @@ REL_CCFLAGS = ['-O2']
##ARFLAGS = ruv
##ARFLAGSQUIET = ru
##
-C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement']
+C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter', '-Werror=declaration-after-statement', '-Werror=implicit-function-declaration', '-Werror=return-type']
CC_WARN = ['-Wall']
CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
@@ -214,7 +220,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_DEBUG = False
-BF_DEBUG_CCFLAGS = ['-g']
+BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG']
BF_BUILDDIR = '../build/linux2'
BF_INSTALLDIR='../install/linux2'
diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py
index 1650201f8c6..263cfd89a8b 100644
--- a/build_files/scons/config/linuxcross-config.py
+++ b/build_files/scons/config/linuxcross-config.py
@@ -185,7 +185,7 @@ CC_WARN = [ '-Wall' ]
LLIBS = [ '-ldxguid', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++', '-luuid', '-lole32'] #'-lutil', '-lc', '-lm', '-ldl', '-lpthread' ]
BF_DEBUG = False
-BF_DEBUG_CCFLAGS = ['-g']
+BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG']
BF_PROFILE = False
BF_PROFILE_CCFLAGS = ['-pg','-g']
diff --git a/build_files/scons/config/openbsd3-config.py b/build_files/scons/config/openbsd3-config.py
index 0ef9ba5d0a4..65c2a1a2585 100644
--- a/build_files/scons/config/openbsd3-config.py
+++ b/build_files/scons/config/openbsd3-config.py
@@ -147,7 +147,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_DEBUG = False
-BF_DEBUG_CCFLAGS = ['-g']
+BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG']
BF_BUILDDIR='../build/openbsd3'
BF_INSTALLDIR='../install/openbsd3'
diff --git a/build_files/scons/config/sunos5-config.py b/build_files/scons/config/sunos5-config.py
index a0713735a5b..168fb4271a8 100644
--- a/build_files/scons/config/sunos5-config.py
+++ b/build_files/scons/config/sunos5-config.py
@@ -161,7 +161,7 @@ BF_PROFILE_LINKFLAGS = ['-pg']
BF_PROFILE = False
BF_DEBUG = False
-BF_DEBUG_CCFLAGS = []
+BF_DEBUG_CCFLAGS = ['-DDEBUG']
BF_BUILDDIR = '../build/sunos5'
BF_INSTALLDIR='../install/sunos5'
diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py
index f8b67781172..7189522809e 100644
--- a/build_files/scons/config/win32-mingw-config.py
+++ b/build_files/scons/config/win32-mingw-config.py
@@ -176,7 +176,7 @@ CC_WARN = [ '-Wall' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid']
BF_DEBUG = False
-BF_DEBUG_CCFLAGS= ['-g']
+BF_DEBUG_CCFLAGS= ['-g', '-DDEBUG']
BF_PROFILE_CCFLAGS = ['-pg', '-g']
BF_PROFILE_LINKFLAGS = ['-pg']
diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py
index 3572dd113bf..c8c04e74068 100644
--- a/build_files/scons/config/win32-vc-config.py
+++ b/build_files/scons/config/win32-vc-config.py
@@ -149,6 +149,12 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
+WITH_BF_LCMS = True
+BF_LCMS = LIBDIR + '/lcms'
+BF_LCMS_INC = '${BF_LCMS}/include'
+BF_LCMS_LIB = 'lcms'
+BF_LCMS_LIBPATH = '${BF_LCMS}/lib'
+
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
@@ -188,7 +194,6 @@ PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/INCREMENTAL:NO','/N
# BF_PROFILE_LINKFLAGS = ['-pg']
# BF_PROFILE = False
-#turn off makebsc by default ( as 64 bit version does ) .. takes ages to build .. for nothing ( well some M$ addicts may disagree )
BF_BSC=False
BF_BUILDDIR = '..\\build\\win32-vc'
diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py
index 0a4b05a28bf..78d90187abf 100644
--- a/build_files/scons/config/win64-vc-config.py
+++ b/build_files/scons/config/win64-vc-config.py
@@ -107,23 +107,6 @@ BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
WITH_BF_BINRELOC = False
-#WITH_BF_NSPR = True
-#BF_NSPR = $(LIBDIR)/nspr
-#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
-#BF_NSPR_LIB =
-
-# Uncomment the following line to use Mozilla inplace of netscape
-#CPPFLAGS += -DMOZ_NOT_NET
-# Location of MOZILLA/Netscape header files...
-#BF_MOZILLA = $(LIBDIR)/mozilla
-#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
-#BF_MOZILLA_LIB =
-# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
-# if this is not set.
-#
-# Be paranoid regarding library creation (do not update archives)
-#BF_PARANOID = True
-
# enable freetype2 support for text objects
BF_WITH_FREETYPE = True
BF_FREETYPE = LIBDIR + '/freetype'
@@ -162,6 +145,12 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
+WITH_BF_LCMS = True
+BF_LCMS = LIBDIR + '/lcms'
+BF_LCMS_INC = '${BF_LCMS}/include'
+BF_LCMS_LIB = 'lcms'
+BF_LCMS_LIBPATH = '${BF_LCMS}/lib'
+
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2']
@@ -183,7 +172,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast']
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
-CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
+CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
REL_CFLAGS = ['-O2', '-DNDEBUG']
REL_CCFLAGS = ['-O2', '-DNDEBUG']
REL_CXXFLAGS = ['-O2', '-DNDEBUG']
@@ -194,9 +183,6 @@ CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
-BF_DEBUG=False
-BF_BSC=False
-
if BF_DEBUG:
BF_NUMJOBS=1
else:
@@ -207,10 +193,3 @@ PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/INCREMENTAL:NO','/NO
BF_BUILDDIR = '..\\build\\blender25-win64-vc'
BF_INSTALLDIR='..\\install\\blender25-win64-vc'
-
-
-######################### MERGE WITH ABOVE ################################
-
-
-
-
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index c855d9ee07e..1f503a5ea2d 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -158,6 +158,8 @@ def setup_staticlibs(lenv):
statlibs += Split(lenv['BF_ZLIB_LIB_STATIC'])
if lenv['WITH_BF_FFTW3']:
libincs += Split(lenv['BF_FFTW3_LIBPATH'])
+ if lenv['WITH_BF_STATICFFTW3']:
+ statlibs += Split(lenv['BF_FFTW3_LIB_STATIC'])
if lenv['WITH_BF_FFMPEG'] and lenv['WITH_BF_STATICFFMPEG']:
statlibs += Split(lenv['BF_FFMPEG_LIB_STATIC'])
if lenv['WITH_BF_INTERNATIONAL']:
@@ -178,6 +180,9 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_PYTHON'] and lenv['WITH_BF_STATICPYTHON']:
statlibs += Split(lenv['BF_PYTHON_LIB_STATIC'])
+ if lenv['WITH_BF_SNDFILE'] and lenv['WITH_BF_STATICSNDFILE']:
+ statlibs += Split(lenv['BF_SNDFILE_LIB_STATIC'])
+
if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
libincs += Split(lenv['BF_PTHREADS_LIBPATH'])
@@ -191,6 +196,9 @@ def setup_staticlibs(lenv):
if lenv['OURPLATFORM'] == 'linuxcross':
libincs += Split(lenv['BF_OPENMP_LIBPATH'])
+ if lenv['WITH_BF_STATICLIBSAMPLERATE']:
+ statlibs += Split(lenv['BF_LIBSAMPLERATE_LIB_STATIC'])
+
# setting this last so any overriding of manually libs could be handled
if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
libincs.append('/usr/lib')
@@ -202,7 +210,6 @@ def setup_syslibs(lenv):
lenv['BF_JPEG_LIB'],
lenv['BF_PNG_LIB'],
- lenv['BF_LIBSAMPLERATE_LIB']
]
if not lenv['WITH_BF_FREETYPE_STATIC']:
@@ -236,9 +243,9 @@ def setup_syslibs(lenv):
syslibs += Split(lenv['BF_OGG_LIB'])
if lenv['WITH_BF_JACK']:
syslibs += Split(lenv['BF_JACK_LIB'])
- if lenv['WITH_BF_SNDFILE']:
+ if lenv['WITH_BF_SNDFILE'] and not lenv['WITH_BF_STATICSNDFILE']:
syslibs += Split(lenv['BF_SNDFILE_LIB'])
- if lenv['WITH_BF_FFTW3']:
+ if lenv['WITH_BF_FFTW3'] and not lenv['WITH_BF_STATICFFTW3']:
syslibs += Split(lenv['BF_FFTW3_LIB'])
if lenv['WITH_BF_SDL']:
syslibs += Split(lenv['BF_SDL_LIB'])
@@ -253,6 +260,9 @@ def setup_syslibs(lenv):
syslibs += Split(lenv['BF_OPENCOLLADA_LIB'])
syslibs.append(lenv['BF_EXPAT_LIB'])
+ if not lenv['WITH_BF_STATICLIBSAMPLERATE']:
+ syslibs += Split(lenv['BF_LIBSAMPLERATE_LIB'])
+
syslibs += lenv['LLIBS']
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index da916a8e89c..737ce40d702 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -39,9 +39,9 @@ def validate_arguments(args, bc):
'WITH_BF_PYTHON', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL',
'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
- 'BF_LIBSAMPLERATE', 'BF_LIBSAMPLERATE_INC', 'BF_LIBSAMPLERATE_LIB', 'BF_LIBSAMPLERATE_LIBPATH',
+ 'BF_LIBSAMPLERATE', 'BF_LIBSAMPLERATE_INC', 'BF_LIBSAMPLERATE_LIB', 'BF_LIBSAMPLERATE_LIBPATH', 'WITH_BF_STATICLIBSAMPLERATE', 'BF_LIBSAMPLERATE_LIB_STATIC',
'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH',
- 'WITH_BF_SNDFILE', 'BF_SNDFILE', 'BF_SNDFILE_INC', 'BF_SNDFILE_LIB', 'BF_SNDFILE_LIBPATH',
+ 'WITH_BF_SNDFILE', 'BF_SNDFILE', 'BF_SNDFILE_INC', 'BF_SNDFILE_LIB', 'BF_SNDFILE_LIBPATH', 'WITH_BF_STATICSNDFILE', 'BF_SNDFILE_LIB_STATIC',
'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH',
'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
'WITH_BF_DDS', 'WITH_BF_CINEON', 'WITH_BF_HDR',
@@ -61,7 +61,7 @@ def validate_arguments(args, bc):
'BF_WINTAB', 'BF_WINTAB_INC',
'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC',
'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
- 'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH',
+ 'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH', 'WITH_BF_STATICFFTW3', 'BF_FFTW3_LIB_STATIC',
'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC',
'WITH_BF_COLLADA', 'BF_COLLADA', 'BF_COLLADA_INC', 'BF_COLLADA_LIB', 'BF_OPENCOLLADA', 'BF_OPENCOLLADA_INC', 'BF_OPENCOLLADA_LIB', 'BF_OPENCOLLADA_LIBPATH', 'BF_PCRE', 'BF_PCRE_LIB', 'BF_PCRE_LIBPATH', 'BF_EXPAT', 'BF_EXPAT_LIB', 'BF_EXPAT_LIBPATH',
'WITH_BF_PLAYER',
@@ -92,6 +92,7 @@ def validate_arguments(args, bc):
'WITH_BF_RAYOPTIMIZATION',
'BF_RAYOPTIMIZATION_SSE_FLAGS',
'BF_NO_ELBEEM',
+ 'WITH_BF_CXX_GUARDEDALLOC',
'BF_VCREDIST' # Windows-only, and useful only when creating installer
]
@@ -206,6 +207,8 @@ def read_opts(env, cfg, args):
('BF_LIBSAMPLERATE_INC', 'libsamplerate aka SRC include path', ''),
('BF_LIBSAMPLERATE_LIB', 'libsamplerate aka SRC library', ''),
('BF_LIBSAMPLERATE_LIBPATH', 'libsamplerate aka SRC library path', ''),
+ ('BF_LIBSAMPLERATE_LIB_STATIC', 'Path to libsamplerate static library', ''),
+ (BoolVariable('WITH_BF_STATICLIBSAMPLERATE', 'Staticly link to libsamplerate', False)),
(BoolVariable('WITH_BF_JACK', 'Enable jack support if true', True)),
('BF_JACK', 'jack base path', ''),
@@ -217,7 +220,9 @@ def read_opts(env, cfg, args):
('BF_SNDFILE', 'sndfile base path', ''),
('BF_SNDFILE_INC', 'sndfile include path', ''),
('BF_SNDFILE_LIB', 'sndfile library', ''),
+ ('BF_SNDFILE_LIB_STATIC', 'Path to sndfile static library', ''),
('BF_SNDFILE_LIBPATH', 'sndfile library path', ''),
+ (BoolVariable('WITH_BF_STATICSNDFILE', 'Staticly link to sndfile', False)),
('BF_PTHREADS', 'Pthreads base path', ''),
('BF_PTHREADS_INC', 'Pthreads include path', ''),
@@ -352,7 +357,9 @@ def read_opts(env, cfg, args):
('BF_FFTW3', 'FFTW3 base path', ''),
('BF_FFTW3_INC', 'FFTW3 include path', ''),
('BF_FFTW3_LIB', 'FFTW3 library', ''),
+ ('BF_FFTW3_LIB_STATIC', 'FFTW3 static libraries', ''),
('BF_FFTW3_LIBPATH', 'FFTW3 library path', ''),
+ (BoolVariable('WITH_BF_STATICFFTW3', 'Staticly link to FFTW3', False)),
(BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)),
('BF_OPENGL', 'OpenGL base path', ''),
@@ -408,7 +415,7 @@ def read_opts(env, cfg, args):
('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', ''),
('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', ''),
- (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', True)),
+ (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', False)),
('BF_BUILDDIR', 'Build dir', ''),
('BF_INSTALLDIR', 'Installation dir', ''),
@@ -447,6 +454,7 @@ def read_opts(env, cfg, args):
(BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)),
('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''),
+ (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)),
('BF_VCREDIST', 'Full path to vcredist', '')
) # end of opts.AddOptions()
diff --git a/doc/README.windows-gcc b/doc/build_systems/README.windows-gcc
index 78018eabbc0..78018eabbc0 100644
--- a/doc/README.windows-gcc
+++ b/doc/build_systems/README.windows-gcc
diff --git a/doc/blender-cmake.txt b/doc/build_systems/cmake.txt
index a49ff629b5b..a49ff629b5b 100644
--- a/doc/blender-cmake.txt
+++ b/doc/build_systems/cmake.txt
diff --git a/doc/blender-scons-dev.txt b/doc/build_systems/scons-dev.txt
index d13ea7c036f..d13ea7c036f 100644
--- a/doc/blender-scons-dev.txt
+++ b/doc/build_systems/scons-dev.txt
diff --git a/doc/blender-scons.txt b/doc/build_systems/scons.txt
index 016ba39fd09..b4d9a905885 100644
--- a/doc/blender-scons.txt
+++ b/doc/build_systems/scons.txt
@@ -20,7 +20,7 @@ $Id$
with the patch to get started.
This document describes the usage of the new SCons scripts. The
- inner workings are described in blender-scons-dev.txt.
+ inner workings are described in scons-dev.txt.
Building Blender
----------------
diff --git a/doc/blender-guardedalloc.txt b/doc/guides/blender-guardedalloc.txt
index 44a9722a4e4..44a9722a4e4 100644
--- a/doc/blender-guardedalloc.txt
+++ b/doc/guides/blender-guardedalloc.txt
diff --git a/doc/interface_API.txt b/doc/guides/interface_API.txt
index c98794444e6..c98794444e6 100644
--- a/doc/interface_API.txt
+++ b/doc/guides/interface_API.txt
diff --git a/doc/guides/python-dev-guide.txt b/doc/guides/python-dev-guide.txt
new file mode 100644
index 00000000000..75c9ccb57e5
--- /dev/null
+++ b/doc/guides/python-dev-guide.txt
@@ -0,0 +1,170 @@
+Simple Blender Python Developer's Guide
+---------------------------------------
+
+This is an outline for a future guide yet to be written. It is meant for
+programmers wanting to understand and maybe help with the embedding of Python
+inside Blender.
+
+I - Introduction
+
+We could praise Python here for its many qualities, but it's probably better
+to just give some links:
+
+The main site is at www.python.org , with documentation at www.python.org/doc/
+
+Also worth of mention: it's an interpreted language and is available for
+many different systems. The download includes the interpreter, many modules
+(think libs), good documentation and some programs / examples. If you use
+linux, there's a high chance you already have Python installed, just try
+"man python".
+
+The reason for embedding a language environment inside Blender is to give
+users the ability to access the program's internal data and functionality.
+This can be used to import / export (from / to other 2d / 3d formats) or
+change the data (to create new objects procedurally, among many other
+interesting possibilities). Script writers (Blender Python programmers) can
+also expand Blender in new ways, adding new features on-the-fly, without having
+to recompile it. It is usually much easier and faster to write scripts in
+Python than to code the equivalent in C.
+
+II - Reference material:
+
+There are two important texts for us in the documentation that comes
+with Python ( docs also available online at www.python.org ):
+
+- Extending and Embedding (tutorial for C/C++ programmers)
+
+and specially
+
+- Python/C API.
+
+You can read the first one to get a feel for how things are done
+(reference counting is probably the most important part), but the second
+doc is a must. Specially useful as a fast reference is its Index, at letter
+P, where all commands are.
+
+Specially useful commands are Py_BuildValue and the family of parsing
+functions, PyArg_Parse* (PyArg_Parse(), PyArg_ParseTuple(),
+PyArg_ParseTupleAndKeywords()). Py_BuildValue is usually the best way to make
+Python Objects (the 'variables' that the Python Interpreter understands)
+out of C ones. The PyArg_Parse* functions do the opposite, they parse
+Python Objects to C variables.
+
+So, understand PyArg_Parse* functions, Py_BuildValue and reference
+counting. The first doc has a good discussion about them.
+
+- C knowledge is also necessary, of course, use your favorite resource.
+
+- The Blender 2.25 API documentation ( www.blender.org ) is, along with
+the source, our basic API ref.
+
+III - Directories
+
+The previous Blender Python API's are spread in blender/intern/python
+and the C part of the current one, bpython, is at
+blender/source/blender/bpython/, specially in intern/. The current
+solution is a Python wrapper on top of this bpython one, at
+blender/intern/python/modules/Blender/
+
+Note: since it's in Python, they needed the freeze Python utility, a
+process/program that creates stand-alone executables out of Python
+source files -- that is, it packs together an interpreter, the needed
+modules and the source of a Python program so that users of this program
+don't need to have the Python interpreter already installed in their
+machines to run the program -- Blender, in this case.
+
+The new implementation is pure C, so we won't need to "freeze" it.
+
+Another important dir for starters is blender/source/blender/makesdna,
+where the headers with Blender structs lie.
+
+IV - Experimental Python
+
+The new implementation, currently referred to as experimental python -
+exppython - was started by Michel Selten. He chose to solve the mess in
+Blender Python by starting over from scratch, in C, but keeping API
+compatibility with the current 2.25 API used by Blender.
+
+It is in blender/source/blender/python , more specifically inside
+api2_2x/
+
+To make it clear, exppython is the new implementation being worked on. It
+will possibly become the de-facto implementation in Blender 2.28, the next
+Blender version. Currently, Blender still comes with the same implementation
+found in the 2.25 version of the program. So we call that the 2.25
+implementation, or bpython.
+
+BPython had plenty of "macro magic", lot's of complicate #define's, etc.,
+since a lot of the embedding work is quite repetitive. But that makes it
+much harder for newbies to jump in and learn, so the new files in exppython
+avoid that.
+
+This means: Blender, Object, Camera, Lamp, Image, Text, Window modules
+(the files have the same names, ending obviously with .c and .h)
+
+To speed things up, some independent parts of bpython are being
+integrated directly into exppython. That already happened with Draw and
+BGL, both taken from opy_draw.c in the bpython/intern dir. The same is
+happening with NMesh (Mesh is written in Python and imports NMesh to
+extend / change its functionality).
+
+For a good example of dexterity with macros (cheers to the NaN
+programmer(s)!), look at BGL.[ch], the OpenGL API wrapper. The defines
+are in the header.
+
+Besides keeping compatibility with the 2.25 API, there are already some
+additions to exppython:
+
+- some modules have access to more variables than 2.25 had;
+- there are more method functions and the access is safer;
+- the file selector (or file browser, if you prefer) is back:
+ It's now in the Window module, along with an image selector, too.
+- there are totally new modules, unavailable in 2.25:
+ Fellow new developers joining our team are contributing new modules
+ that have been requested by the community for a long time.
+
+
+V - Coding
+
+The Camera module is a good reference, since it is like most others, in
+terms of programming, but is smaller and simple. It's in Camera.c and
+Camera.h . To have it working, it was also necessary to include a line to
+the end of Blender.c (registering it as a Blender submodule) and another to
+modules.h (declaring its init and CreateObject method)
+
+Currently, one of our conventions is to prepend M_ to module functions,
+doc strings, etc. and C_ to the new types we had to create for Python,
+like C_Camera, C_Lamp, etc.
+
+If you look at Camera.[ch], you'll find code for creating the Camera
+module and the Camera "type", with all its methods and access policies.
+It's really a new type defined in Python, like PyInt or PyFloat,
+PyString, etc. In practice, it's a "thin" (because it doesn't make
+copies of the variables) wrapper for the Blender Camera Data Object.
+
+A note about Blender: objects in Blender share a common base, the
+Object, whose attributes are things like the matrix, the location, the
+rotation, the size, etc. A Camera is actually an Object of type Camera
+(which means that its "data" field points to a Camera Data obj) and a
+Camera Data object, which is the specific camera part of the object
+(attributes like lens, clip start, etc.). Same for other objects, like
+Lamp, Mesh, etc.
+
+That's why C_Camera is a wrapper for the Blender Camera **Data**
+object. The full wrapper is Object("Camera") linked with
+Camera("camera_name").
+
+How to write a new module for a simple object? Use Camera.[ch] as
+templates, check the specifics of your object in the makesdna dir
+(for example, the camera one is DNA_camera_types.h) and make the
+necessary changes.
+
+If you want to help exppython and in the process possibly learn more about
+embedding, the Python/C API and Blender internals, there's this mailing list:
+
+Bf-python mailing list
+Bf-python@blender.org
+http://www.blender.org/mailman/listinfo/bf-python
+
+There you can ask what hasn't been done yet, get help, make suggestions for
+new features we should consider, send bug reports, etc.
diff --git a/doc/BL-license.txt b/doc/license/BL-license.txt
index 3f079767198..3f079767198 100644
--- a/doc/BL-license.txt
+++ b/doc/license/BL-license.txt
diff --git a/doc/GPL-license.txt b/doc/license/GPL-license.txt
index 8860b2a8afa..8860b2a8afa 100644
--- a/doc/GPL-license.txt
+++ b/doc/license/GPL-license.txt
diff --git a/doc/bf-members.txt b/doc/license/bf-members.txt
index 41aad8b7264..41aad8b7264 100644
--- a/doc/bf-members.txt
+++ b/doc/license/bf-members.txt
diff --git a/doc/blender.1 b/doc/manpage/blender.1
index dd5e60ff900..dd5e60ff900 100644
--- a/doc/blender.1
+++ b/doc/manpage/blender.1
diff --git a/doc/blender.1.py b/doc/manpage/blender.1.py
index 086c99e70e5..805de1f24a1 100644
--- a/doc/blender.1.py
+++ b/doc/manpage/blender.1.py
@@ -44,7 +44,7 @@ def man_format(data):
return data
-blender_bin = os.path.join(os.path.dirname(__file__), "../blender")
+blender_bin = os.path.join(os.path.dirname(__file__), "../../blender")
blender_help = subprocess.Popen([blender_bin, "--help"], stdout=subprocess.PIPE).communicate()[0].decode()
diff --git a/doc/python_api/blender-org/layout.html b/doc/python_api/blender-org/layout.html
new file mode 100644
index 00000000000..a37ed730c22
--- /dev/null
+++ b/doc/python_api/blender-org/layout.html
@@ -0,0 +1,201 @@
+{%- block doctype -%}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+{%- endblock %}
+{%- set script_files = script_files + [pathto("_static/jquery.sidebar.js", 1)] %}
+{%- set reldelim1 = reldelim1 is not defined and ' &raquo;' or reldelim1 %}
+{%- set reldelim2 = reldelim2 is not defined and ' •' or reldelim2 %}
+
+{%- macro relbar() %}
+ <div class="subnav boxheader">
+ <ul class="noprint"><li><a href="http://www.blender.org/development/coding-guides/">Coding Guides</a></li><li>•</li><li><a href="http://www.blender.org/development/report-a-bug/">Report a Bug</a></li><li>•</li><li><a href="http://www.blender.org/development/submit-a-patch/">Submit a Patch</a></li><li>•</li><li><a href="http://www.blender.org/development/release-logs/">Release Logs</a></li><li>•</li><li><a href="http://www.blender.org/development/current-projects/">Current Projects</a></li><li>•</li><li><a href="http://www.blender.org/development/architecture/">Architecture</a></li><li>•</li><li><a href="http://www.blender.org/development/building-blender/">Building Blender</a></li><li>•</li><li class="subnav-active"><a href="http://www.blender.org/documentation/250PythonDoc/contents.html">PyAPI</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Main_Page">Wiki</a></li></ul>
+ </div>
+ <div class="related subnav">
+ <h3>{{ _('Navigation') }}</h3>
+ <ul>
+ {%- for rellink in rellinks %}
+ <li class="right">
+ <a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags }}"
+ {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a>
+ {%- if not loop.first %}{{ reldelim2 }}{% endif %}</li>
+ {%- endfor %}
+ {%- block rootrellink %}
+ <li><a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a>{{ reldelim1 }}</li>
+ {%- endblock %}
+ {%- for parent in parents %}
+ <li><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>{{ reldelim1 }}</li>
+ {%- endfor %}
+ {%- block relbaritems %} {% endblock %}
+ </ul>
+ </div>
+{%- endmacro %}
+
+{%- macro sidebar() %}
+ {%- if not embedded %}{% if not theme_nosidebar|tobool %}
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper">
+ {%- block sidebarlogo %}
+ {%- if logo %}
+ <p class="logo"><a href="{{ pathto(master_doc) }}">
+ <img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/>
+ </a></p>
+ {%- endif %}
+ {%- endblock %}
+ {%- block sidebartoc %}
+ {%- if display_toc %}
+ <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
+ {{ toc }}
+ {%- endif %}
+ {%- endblock %}
+ {%- block sidebarrel %}
+ {%- if prev %}
+ <h4>{{ _('Previous topic') }}</h4>
+ <p class="topless"><a href="{{ prev.link|e }}"
+ title="{{ _('previous chapter') }}">{{ prev.title }}</a></p>
+ {%- endif %}
+ {%- if next %}
+ <h4>{{ _('Next topic') }}</h4>
+ <p class="topless"><a href="{{ next.link|e }}"
+ title="{{ _('next chapter') }}">{{ next.title }}</a></p>
+ {%- endif %}
+ {%- endblock %}
+ {%- block sidebarsourcelink %}
+ {%- if show_source and has_source and sourcename %}
+ <h3>{{ _('This Page') }}</h3>
+ <ul class="this-page-menu">
+ <li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
+ rel="nofollow">{{ _('Show Source') }}</a></li>
+ </ul>
+ {%- endif %}
+ {%- endblock %}
+ {%- if customsidebar %}
+ {% include customsidebar %}
+ {%- endif %}
+ {%- block sidebarsearch %}
+ {%- if pagename != "search" %}
+ <div id="searchbox" style="display: none">
+ <h3>{{ _('Quick search') }}</h3>
+ <form class="search" action="{{ pathto('search') }}" method="get">
+ <input type="text" name="q" size="18" />
+ <input type="submit" value="{{ _('Go') }}" />
+ <input type="hidden" name="check_keywords" value="yes" />
+ <input type="hidden" name="area" value="default" />
+ </form>
+ <p class="searchtip">
+ {{ _('Enter search terms or a module, class or function name.') }}
+ </p>
+ </div>
+ <script type="text/javascript">$('#searchbox').show(0);</script>
+ {%- endif %}
+ {%- endblock %}
+ </div>
+ </div>
+ {%- endif %}{% endif %}
+{%- endmacro %}
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ {{ metatags }}
+ {%- if not embedded and docstitle %}
+ {%- set titlesuffix = " &mdash; "|safe + docstitle|e %}
+ {%- else %}
+ {%- set titlesuffix = "" %}
+ {%- endif %}
+ <title>{{ title|striptags }}{{ titlesuffix }}</title>
+ <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
+ <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
+ {%- if not embedded %}
+ <script type="text/javascript">
+ var DOCUMENTATION_OPTIONS = {
+ URL_ROOT: '{{ pathto("", 1) }}',
+ VERSION: '{{ release|e }}',
+ COLLAPSE_MODINDEX: false,
+ FILE_SUFFIX: '{{ file_suffix }}',
+ HAS_SOURCE: {{ has_source|lower }}
+ };
+ </script>
+ {%- for scriptfile in script_files %}
+ <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
+ {%- endfor %}
+ {%- if use_opensearch %}
+ <link rel="search" type="application/opensearchdescription+xml"
+ title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
+ href="{{ pathto('_static/opensearch.xml', 1) }}"/>
+ {%- endif %}
+ {%- if favicon %}
+ <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
+ {%- endif %}
+ {%- endif %}
+{%- block linktags %}
+ {%- if hasdoc('about') %}
+ <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
+ {%- endif %}
+ {%- if hasdoc('genindex') %}
+ <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
+ {%- endif %}
+ {%- if hasdoc('search') %}
+ <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
+ {%- endif %}
+ {%- if hasdoc('copyright') %}
+ <link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
+ {%- endif %}
+ <link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}" />
+ {%- if parents %}
+ <link rel="up" title="{{ parents[-1].title|striptags }}" href="{{ parents[-1].link|e }}" />
+ {%- endif %}
+ {%- if next %}
+ <link rel="next" title="{{ next.title|striptags }}" href="{{ next.link|e }}" />
+ {%- endif %}
+ {%- if prev %}
+ <link rel="prev" title="{{ prev.title|striptags }}" href="{{ prev.link|e }}" />
+ {%- endif %}
+{%- endblock %}
+{%- block extrahead %} {% endblock %}
+ </head>
+ <body>
+{%- block header %}
+<div class="noprint" id="navcontainer"><a href="http://www.blender.org/"><img width="140" height="50" title="blender.org home page" alt="blender.org home page" src="http://www.blender.org/fileadmin/site/_gfx/nav-home.png"></a><a href="http://www.blender.org/features-gallery/"><img width="140" height="50" title="Features &amp; Gallery" alt="Features &amp; Gallery" src="http://www.blender.org/fileadmin/site/_gfx/nav-features.png"></a><a href="http://www.blender.org/download/get-blender/"><img width="140" height="50" title="Download" alt="Download" src="http://www.blender.org/fileadmin/site/_gfx/nav-download.png"></a><a href="http://www.blender.org/education-help/"><img width="140" height="50" title="Tutorials &amp; Help" alt="Tutorials &amp; Help" src="http://www.blender.org/fileadmin/site/_gfx/nav-help.png"></a><a href="http://www.blender.org/community/user-community/"><img width="140" height="50" title="Community" alt="Community" src="http://www.blender.org/fileadmin/site/_gfx/nav-community.png"></a><a href="http://www.blender.org/development/"><img width="140" height="50" title="Development" alt="Development" src="http://www.blender.org/fileadmin/site/_gfx/nav-development-on.png"></a><a href="http://www.blender.org/e-shop/"><img width="140" height="50" title="e-Shop" alt="e-Shop" src="http://www.blender.org/fileadmin/site/_gfx/nav-eshop.png"></a></div>
+{% endblock %}
+
+ <div class="document">
+ <div id="pageheader"></div>
+{%- block relbar1 %}{{ relbar() }}{% endblock %}
+
+{%- block sidebar1 %} {# possible location for sidebar #} {% endblock %}
+
+{%- block document %}
+ <div class="documentwrapper">
+ {%- if not embedded %}{% if not theme_nosidebar|tobool %}
+ <div class="bodywrapper">
+ {%- endif %}{% endif %}
+ <div class="body">
+ {% block body %} {% endblock %}
+ </div>
+ {%- if not embedded %}{% if not theme_nosidebar|tobool %}
+ </div>
+ {%- endif %}{% endif %}
+ </div>
+{%- endblock %}
+
+{%- block sidebar2 %}{{ sidebar() }}{% endblock %}
+ <div class="clearer"></div>
+
+{%- block footer %}
+ <div class="footer">
+ {%- if hasdoc('copyright') %}
+ {% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
+ {%- else %}
+ {% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}
+ {%- endif %}
+ {%- if last_updated %}
+ {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
+ {%- endif %}
+ {%- if show_sphinx %}
+ {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
+ {%- endif %}
+ </div><b class="round"><b id="r1"></b><b id="r2"></b><b id="r3"></b><b id="r4"></b></b>
+{%- endblock %}
+ </div>
+ </body>
+</html>
diff --git a/doc/python_api/blender-org/page.html b/doc/python_api/blender-org/page.html
new file mode 100644
index 00000000000..17a93016533
--- /dev/null
+++ b/doc/python_api/blender-org/page.html
@@ -0,0 +1,4 @@
+{% extends "layout.html" %}
+{% block body %}
+ {{ body }}
+{% endblock %}
diff --git a/doc/python_api/blender-org/static/bg.png b/doc/python_api/blender-org/static/bg.png
new file mode 100644
index 00000000000..5393d4aa58f
--- /dev/null
+++ b/doc/python_api/blender-org/static/bg.png
Binary files differ
diff --git a/doc/python_api/blender-org/static/default.css_t b/doc/python_api/blender-org/static/default.css_t
new file mode 100644
index 00000000000..6f3f25d8a6a
--- /dev/null
+++ b/doc/python_api/blender-org/static/default.css_t
@@ -0,0 +1,654 @@
+/**
+ * Sphinx stylesheet -- default theme
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+@import url("basic.css");
+
+/* -- page layout ----------------------------------------------------------- */
+
+#navcontainer {
+ height: 50px;
+ margin: 0 auto;
+ position: relative;
+ width: 980px;
+}
+
+#navcontainer img {
+ width: 140px;
+ height: 50px;
+}
+
+#pageheader {
+ background-image:url("bg.png");
+ height:80px;
+ position:relative;
+}
+
+body {
+ font-family: {{ theme_bodyfont }};
+ font-size: 12px;
+ line-height: 145%;
+ background-color: {{ theme_footerbgcolor }};
+ color: {{ theme_textcolor }};
+ min-width: 980px;
+ margin: 0;
+ padding: 0;
+}
+
+div.document {
+ margin:20px auto 0;
+ position:relative;
+ text-align:left;
+ width:980px;
+/* background-color: {{ theme_sidebarbgcolor }};*/
+}
+
+div.documentwrapper {
+ float: left;
+ width: 100%;
+ background-color: {{ theme_bgcolor }};
+ border-color: {{ theme_bordercolor }};
+ border-style:solid;
+ border-width:0 1px;
+ margin:0 auto;
+ min-height:30em;
+ padding:35px;
+/* position:relative;*/
+ text-align:left;
+ width:908px;
+
+}
+
+div.bodywrapper {
+ margin: 0 0 0 230px;
+}
+
+div.body {
+ background-color: {{ theme_bgcolor }};
+ color: {{ theme_textcolor }};
+ padding: 0;
+ width: 640px;
+}
+
+{%- if theme_rightsidebar|tobool %}
+div.bodywrapper {
+ margin: 0 230px 0 0;
+}
+{%- endif %}
+
+div.footer {
+ background: #292929;
+ border-left: 1px solid #363636;
+ border-right: 1px solid #363636;
+ color: #ffffff;
+/* width: 100%;*/
+ margin: 0 auto;
+ padding: 20px 20px 15px 35px;
+ text-align: center;
+ font-size: 75%;
+}
+
+div.footer+.round b {
+ display: block;
+ background: #292929;
+ width: auto;
+}
+
+div.footer+.round #r1 {
+ border-left: 1px solid #363636;
+ border-right: 1px solid #363636;
+ height: 2px;
+ margin: 0 1px;
+}
+
+div.footer+.round #r2 {
+ border-left: 1px solid #363636;
+ border-right: 1px solid #363636;
+ height: 1px;
+ margin: 0 2px;
+}
+
+div.footer+.round #r3 {
+ border-left: 1px solid #363636;
+ border-right: 1px solid #363636;
+ height: 1px;
+ margin: 0 3px;
+}
+
+div.footer+.round #r4 {
+ border-bottom: 1px solid #363636;
+ height: 0px;
+ margin: 0 5px;
+}
+
+div.footer a {
+ color: {{ theme_footertextcolor }};
+ text-decoration: underline;
+}
+
+.boxheader {
+ background-color:#3E4D5E;
+}
+
+.subnav {
+ height:auto !important;
+ min-height:15px;
+ padding:9px 0px 9px 37px;
+ position:relative;
+}
+
+div.related {
+ width:auto;
+ font-size:100%;
+ font-weight:400;
+ background-color: {{ theme_relbarbgcolor }};
+ line-height: 145%;
+ color: {{ theme_relbartextcolor }};
+}
+
+div.related li {
+ font-size:0.9em;
+}
+
+div.related li.right {
+ margin: 0;
+ word-spacing: 3px;
+}
+
+div.subnav li {
+ display:inline;
+ list-style-type:none;
+ margin:0;
+ padding:0 7px 0 0;
+}
+
+div.subnav ul {
+ display:inline;
+ margin:0;
+ padding:0;
+}
+
+.subnav a {
+ font-weight: bold;
+ color: #fff;
+}
+
+.subnav li.subnav-active a {
+ color:#F39410;
+}
+
+div.related a {
+ color: {{ theme_relbarlinkcolor }};
+}
+
+div.related a:active {
+ color: {{ theme_relbaractlinkcolor }};
+}
+
+div.sphinxsidebar {
+ width: 280px;
+ font-size: 100%;
+ {%- if theme_stickysidebar|tobool %}
+/* top: 30px;*/
+ margin: 0;
+ position: absolute;
+ overflow: auto;
+ height: 100%;
+ {%- endif %}
+ {%- if theme_rightsidebar|tobool %}
+ float: right;
+ {%- if theme_stickysidebar|tobool %}
+ right: 0;
+ {%- endif %}
+ {%- endif %}
+}
+
+div.sphinxsidebarwrapper {
+ width: inherit;
+ padding: 0;
+ position: absolute;
+ margin-top: 35px;
+ font-size: 8pt;
+}
+
+div.sphinxsidebarwrapper.fixed {
+ position:fixed;
+ top:10px;
+ margin-top: 0;
+}
+
+{%- if theme_stickysidebar|tobool %}
+/* this is nice, but it it leads to hidden headings when jumping
+ to an anchor */
+/*
+div.related {
+ position: fixed;
+}
+
+div.documentwrapper {
+ margin-top: 30px;
+}
+*/
+{%- endif %}
+
+div.sphinxsidebar h3 {
+ font-family: {{ theme_headfont }};
+ color: {{ theme_sidebartextcolor }};
+ font-size: 12px;
+ font-weight: bold;
+ background: #3E4D5E url("rnd.png") no-repeat top left;
+ height: 16px;
+ margin: 0;
+ padding: 10px 5px 10px 18px;
+}
+
+div.sphinxsidebar h3 a {
+ color: {{ theme_sidebartextcolor }};
+}
+
+div.sphinxsidebar h4 {
+ font-family: {{ theme_headfont }};
+ color: {{ theme_sidebartextcolor }};
+ background: #3E4D5E url("rnd.png") no-repeat top left;
+ height: 16px;
+ font-size: 12px;
+ font-weight: bold;
+ margin: 0;
+ padding: 10px 5px 10px 18px;
+}
+
+div.sphinxsidebar form {
+ margin: 0;
+ padding: 10px;
+ background-color: #292929;
+ {%- if theme_rightsidebar|tobool %}
+ border-right: 1px solid {{ theme_bordercolor }};
+ {%- endif %}
+}
+
+div.sphinxsidebar p {
+ background-color: #292929;
+ padding: 5px 10px 10px 10px;
+ color: {{ theme_sidebartextcolor }};
+ {%- if theme_rightsidebar|tobool %}
+ border-right: 1px solid {{ theme_bordercolor }};
+ {%- endif %}
+ margin-top: 0;
+}
+
+div.sphinxsidebar p.topless {
+ margin-bottom: 25px;
+}
+
+div.sphinxsidebar ul {
+ background-color: #292929;
+ margin: 0;
+ padding: 0;
+ color: {{ theme_sidebartextcolor }};
+}
+
+div.sphinxsidebar > div > ul {
+ margin-bottom: 25px;
+ padding:10px;
+}
+
+div.sphinxsidebar a {
+ color: {{ theme_sidebarlinkcolor }};
+}
+
+div.sphinxsidebar input {
+ border: 1px solid {{ theme_sidebarlinkcolor }};
+ font-family: sans-serif;
+ font-size: 1em;
+}
+
+/* -- body styles ----------------------------------------------------------- */
+
+a {
+ color: {{ theme_linkcolor }};
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+/*div.body h1,*/
+div.body h2,
+div.body h3,
+div.body h4,
+div.body h5,
+div.body h6 {
+ font-family: {{ theme_headfont }};
+ background-color: {{ theme_headbgcolor }};
+ font-weight: bold;
+ color: {{ theme_headtextcolor }};
+/* border-bottom: 1px solid #ccc;*/
+ margin: 20px -20px 10px -20px;
+ padding: 3px 0 3px 10px;
+}
+
+div.body h1 { margin-top: 0; font-size: 200%;
+ color:#FFFAE0;
+ font-family:"Helvetica","Arial",sans-serif;
+ font-size:34px;
+ font-weight:normal;
+ left:32px;
+ line-height:26px;
+ margin-top:0;
+ position:absolute;
+ top:36px;
+}
+div.body h2 { font-size: 160%; }
+div.body h3 { font-size: 140%; }
+div.body h4 { font-size: 120%; }
+div.body h5 { font-size: 110%; }
+div.body h6 { font-size: 100%; }
+
+a.headerlink {
+ color: {{ theme_headlinkcolor }};
+ font-size: 0.8em;
+ padding: 0 4px 0 4px;
+ text-decoration: none;
+}
+
+h1:hover > a.headerlink {
+ display:none;
+}
+
+a.headerlink:hover {
+ background-color: {{ theme_headlinkcolor }};
+ color: white;
+}
+
+div.body p, div.body dd, div.body li {
+ text-align: justify;
+ line-height: 130%;
+}
+
+div.note, div.seealso, div.topic, div.warning {
+ color:white;
+}
+
+div.admonition p.admonition-title + p {
+ display: inline;
+}
+
+div.note {
+ background-color: #555;
+ border: 1px solid #ddd;
+}
+
+div.seealso {
+ background-color: #525241;
+ border: 1px solid #ff6;
+}
+
+div.topic {
+ background-color: #eee;
+}
+
+div.warning {
+ background-color: #B64444;
+ border: 1px solid #990606;
+}
+
+p.admonition-title {
+ display: inline;
+}
+
+p.admonition-title:after {
+ content: ":";
+}
+
+dl div.admonition {
+ border:medium none;
+ margin:0;
+ padding:2px 5px 2px 0;
+}
+
+dl.class > dd > div.warning p.admonition-title,
+dl.class > dd > div.note p.admonition-title {
+ display:none;
+}
+
+dl.class > dd > div.admonition.warning p,
+dl.class > dd > div.admonition.note p {
+ margin:0;
+}
+
+dl.class > dd > div.admonition.warning,
+dl.class > dd > div.admonition.note {
+ margin-bottom:12px;
+}
+
+dl div.admonition.note p.admonition-title, dl div.admonition.warning p.admonition-title {
+ color:inherit;
+}
+
+dl div.admonition.warning p {
+ font-weight:bold;
+ line-height:150%;
+}
+
+dl div.admonition.warning p * {
+ font-weight:normal;
+}
+
+dl div.admonition p.admonition-title {
+ color:#555555;
+ display:block;
+ float:left;
+ margin:0;
+ padding-right:12px;
+ text-align:right;
+ width:90px;
+}
+
+dl div.admonition p.admonition-title+p, dl div.admonition p {
+ display:block;
+ margin:0 0 0 102px;
+}
+
+dl div.note {
+ background:none;
+ color:#E8E481;
+}
+
+dl div.warning {
+ background:none;
+ color:#FC3030;
+}
+
+dl div.seealso {
+ background:none;
+}
+
+dl div.admonition.seealso p+p {
+ color:#222;
+}
+
+dl div.seealso a {
+ margin-left:-1.3ex;
+}
+
+div.admonition.warning pre {
+ background: #0F0704;
+ color: #fc3030;
+}
+
+div.admonition pre {
+ margin: 6px 0;
+ overflow: visible;
+ white-space: pre-wrap;
+}
+
+pre {
+ padding: 10px;
+ background-color: #000;
+ color: #fff;
+ line-height: normal;
+ border: 0 solid white;
+}
+
+dl.function>dt, dl.method>dt {
+ text-indent:-118px;
+ padding-left: 118px;
+}
+
+dl.function>dt em, dl.method>dt em {
+ color: #97b9cf;
+}
+
+dl.function>dd em, dl.method>dd em {
+ color: #97b9cf;
+ font-weight:bold;
+}
+
+dl.function table.field-list tr:first-child td.field-body, dl.method table.field-list tr:first-child td.field-body {
+ color: #728c96;
+}
+
+dl.function>dt em:before, dl.method>dt em:before {
+ content: " ";
+ display: block;
+}
+
+dl.function>dd>p,dl.method>dd>p,dl.attribute>dd>p,
+dl[class]>dd>ol,dl[class]>dd>ul {
+ color: #999;
+}
+
+dl.data>dt {
+ color:#08C659;
+}
+
+dl.data>dd>p {
+ color:#069643;
+}
+
+dl.class>dt {
+ color: #82a3c7;
+}
+
+dl.class>dd>p,dl.class>dd>ol,dl.class>dd>ul {
+ color: #637b96;
+}
+
+dl.function>dt,dl.method>dt,dl.attribute>dt {
+ color: #fcb100;
+}
+
+dl.function>dd>p,dl.method>dd>p,dl.attribute>dd>p,
+dl.function>dd>p+ol,dl.method>dd>p+ol,dl.attribute>dd>p+ol,
+dl.function>dd>p+ul,dl.method>dd>p+ul,dl.attribute>dd>p+ul {
+ color: #cb8f00;
+}
+
+dl.function>dd>p, dl.method>dd>p, dl.attribute>dd>p {
+ margin: 0 0 3px 102px;
+}
+
+dl.function>dd>p:first-child:before, dl.method>dd>p:first-child:before, dl.attribute>dd>p:first-child:before {
+ content:"Description:";
+ color:#555;
+ font-weight:bold;
+ font-style:normal;
+ width:90px;
+ display:inline-block;
+ margin-left:-102px;
+ text-align:right;
+ padding-right:12px;
+}
+
+dt:target, .highlight {
+ color: #444;
+ background: #333;
+}
+
+.highlight {
+ background: #E2C788;
+}
+
+h1 .highlight {
+ color:inherit;
+ background:inherit;
+}
+
+dl {
+ margin-bottom: 25px;
+}
+
+dd {
+ margin: 3px 0 10px 15px;
+}
+
+.field-body tt.literal {
+ font-weight: normal;
+}
+
+tt {
+ background-color: #444;
+ padding: 0 1px 0 1px;
+ font-size: 0.95em;
+}
+
+.warning tt {
+ background: #cc6262;
+}
+
+.note tt {
+ background: #444;
+}
+
+dl .warning tt {
+ background:#0F0704;
+ display:block;
+}
+
+dl .note tt {
+ background:#2C2A1B;
+}
+
+table.indextable tr.cap {
+ background-color: transparent;
+}
+
+col.field-name {
+ width:90px;
+}
+
+dd table {
+ margin-bottom: 0;
+}
+
+table.field-list th {
+ color:#555;
+ padding:0;
+ text-align:right;
+}
+
+table.field-list td.field-body {
+ color:#999999;
+ padding-left:12px;
+}
+
+table.field-list td.field-body ul.first {
+ padding-left:0;
+ list-style:none;
+ margin-left:0;
+}
+
+dl.function>dd>ol, dl.method>dd>ol, dl.attribute>dd>ol,
+dl.function>dd>ul, dl.method>dd>ul, dl.attribute>dd>ul,
+dl.function>dd>div[class|="highlight"], dl.method>dd>div[class|="highlight"],
+dl.attribute>dd>div[class|="highlight"] {
+ margin-left:102px;
+}
+
+dl.function>dd>ol, dl.method>dd>ol, dl.attribute>dd>ol,
+dl.function>dd>ul, dl.method>dd>ul, dl.attribute>dd>ul,
+dl.class>dd>ol, dl.class>dd>ul {
+ padding-left:20px;
+}
diff --git a/doc/python_api/blender-org/static/favicon.ico b/doc/python_api/blender-org/static/favicon.ico
new file mode 100644
index 00000000000..f125d24dcb6
--- /dev/null
+++ b/doc/python_api/blender-org/static/favicon.ico
Binary files differ
diff --git a/doc/python_api/blender-org/static/jquery.sidebar.js b/doc/python_api/blender-org/static/jquery.sidebar.js
new file mode 100644
index 00000000000..c22c61f2409
--- /dev/null
+++ b/doc/python_api/blender-org/static/jquery.sidebar.js
@@ -0,0 +1,26 @@
+$(document).ready(function () {
+ var top = $('.sphinxsidebarwrapper').offset().top - parseFloat($('.sphinxsidebarwrapper').css ('marginTop').replace(/auto/, 0));
+ var colheight = parseFloat($('.sphinxsidebarwrapper').css('height').replace(/auto/, 0));
+
+
+$(window).scroll(function (event) {
+ // what the y position of the scroll is
+ var y = $(this).scrollTop();
+
+ // whether that's below the form
+ if (y >= top) {
+ //colheight is checked and according to its vaule the scrolling
+ //is triggered or not
+ if (colheight <= window.innerHeight) {
+ // if so, ad the fixed class
+ $('.sphinxsidebarwrapper').addClass('fixed');
+ } else {
+ // otherwise remove it
+ $('.sphinxsidebarwrapper').removeClass('fixed');
+ }
+ } else {
+ // otherwise remove it
+ $('.sphinxsidebarwrapper').removeClass('fixed');
+ }
+});
+});
diff --git a/doc/python_api/blender-org/static/pygments.css b/doc/python_api/blender-org/static/pygments.css
new file mode 100644
index 00000000000..d67231e84ab
--- /dev/null
+++ b/doc/python_api/blender-org/static/pygments.css
@@ -0,0 +1,61 @@
+.hll { background-color: #ffffcc }
+.c { color: #7f7f7f; font-style: italic } /* Comment */
+.err { border: 1px solid #FF0000 } /* Error */
+.k { color: #0088ff; font-weight: bold } /* Keyword */
+.o { color: #993399 } /* Operator */
+.cm { color: #7f7f7f; font-style: italic } /* Comment.Multiline */
+.cp { color: #007020 } /* Comment.Preproc */
+.c1 { color: #408090; font-style: italic } /* Comment.Single */
+.cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
+.gd { color: #A00000 } /* Generic.Deleted */
+.ge { font-style: italic } /* Generic.Emph */
+.gr { color: #FF0000 } /* Generic.Error */
+.gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.gi { color: #00A000 } /* Generic.Inserted */
+.go { color: #303030 } /* Generic.Output */
+.gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
+.gs { font-weight: bold } /* Generic.Strong */
+.gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.gt { color: #0040D0 } /* Generic.Traceback */
+.kc { color: #007020; font-weight: bold } /* Keyword.Constant */
+.kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
+.kn { color: #FFFF32; font-weight: bold } /* Keyword.Namespace */
+.kp { color: #007020 } /* Keyword.Pseudo */
+.kr { color: #FFFF32; font-weight: bold } /* Keyword.Reserved */
+.kt { color: #902000 } /* Keyword.Type */
+.m { color: #00BAFF } /* Literal.Number */
+.s { color: #B7C274 } /* Literal.String */
+.na { color: #4070a0 } /* Name.Attribute */
+.nb { color: #007020 } /* Name.Builtin */
+.nc { color: #0e84b5; font-weight: bold } /* Name.Class */
+.no { color: #60add5 } /* Name.Constant */
+.nd { color: #555555; font-weight: bold } /* Name.Decorator */
+.ni { color: #d55537; font-weight: bold } /* Name.Entity */
+.ne { color: #007020 } /* Name.Exception */
+.nf { color: #06287e } /* Name.Function */
+.nl { color: #002070; font-weight: bold } /* Name.Label */
+.nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
+.nt { color: #062873; font-weight: bold } /* Name.Tag */
+.nv { color: #bb60d5 } /* Name.Variable */
+.ow { color: #007020; font-weight: bold } /* Operator.Word */
+.w { color: #bbbbbb } /* Text.Whitespace */
+.mf { color: #00BAFF } /* Literal.Number.Float */
+.mh { color: #00BAFF } /* Literal.Number.Hex */
+.mi { color: #00BAFF } /* Literal.Number.Integer */
+.mo { color: #00BAFF } /* Literal.Number.Oct */
+.sb { color: #B7C274 } /* Literal.String.Backtick */
+.sc { color: #B7C274 } /* Literal.String.Char */
+.sd { color: #B7C274; font-style: italic } /* Literal.String.Doc */
+.s2 { color: #B7C274 } /* Literal.String.Double */
+.se { color: #B7C274; font-weight: bold } /* Literal.String.Escape */
+.sh { color: #B7C274 } /* Literal.String.Heredoc */
+.si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
+.sx { color: #c65d09 } /* Literal.String.Other */
+.sr { color: #235388 } /* Literal.String.Regex */
+.s1 { color: #4070a0 } /* Literal.String.Single */
+.ss { color: #517918 } /* Literal.String.Symbol */
+.bp { color: #007020 } /* Name.Builtin.Pseudo */
+.vc { color: #bb60d5 } /* Name.Variable.Class */
+.vg { color: #bb60d5 } /* Name.Variable.Global */
+.vi { color: #bb60d5 } /* Name.Variable.Instance */
+.il { color: #00BAFF } /* Literal.Number.Integer.Long */
diff --git a/doc/python_api/blender-org/static/rnd.png b/doc/python_api/blender-org/static/rnd.png
new file mode 100644
index 00000000000..95bc613c731
--- /dev/null
+++ b/doc/python_api/blender-org/static/rnd.png
Binary files differ
diff --git a/doc/python_api/blender-org/static/rndbl.png b/doc/python_api/blender-org/static/rndbl.png
new file mode 100644
index 00000000000..976161642fd
--- /dev/null
+++ b/doc/python_api/blender-org/static/rndbl.png
Binary files differ
diff --git a/doc/python_api/blender-org/static/rndbr.png b/doc/python_api/blender-org/static/rndbr.png
new file mode 100644
index 00000000000..de94512ccc6
--- /dev/null
+++ b/doc/python_api/blender-org/static/rndbr.png
Binary files differ
diff --git a/doc/python_api/blender-org/theme.conf b/doc/python_api/blender-org/theme.conf
new file mode 100644
index 00000000000..a4356fd2690
--- /dev/null
+++ b/doc/python_api/blender-org/theme.conf
@@ -0,0 +1,30 @@
+[theme]
+inherit = basic
+stylesheet = default.css
+pygments_style = sphinx
+
+[options]
+rightsidebar = true
+stickysidebar = true
+
+footerbgcolor = #000000
+footertextcolor = #ffffff
+sidebarbgcolor = #1c4e63
+sidebartextcolor = #ffffff
+sidebarlinkcolor = #97b9cf
+relbarbgcolor = #2C3845
+relbartextcolor = #D3E0E9
+relbarlinkcolor = #D3E0E9
+relbaractlinkcolor = #f39410
+bgcolor = #232323
+bordercolor = #363636
+textcolor = #ffffff
+headbgcolor = #232323
+headtextcolor = #ffffff
+headlinkcolor = #97b9cf
+linkcolor = #97b9cf
+codebgcolor = #eeffcc
+codetextcolor = #333333
+
+bodyfont = "Lucida Grande","Lucida Sans Unicode","Lucida Sans","Lucida",Verdana,sans-serif
+headfont = "Lucida Grande","Lucida Sans Unicode","Lucida Sans","Lucida",Verdana,sans-serif
diff --git a/source/blender/python/doc/epy/BGL.py b/doc/python_api/epy/BGL.py
index ce148dc72ba..ce148dc72ba 100644
--- a/source/blender/python/doc/epy/BGL.py
+++ b/doc/python_api/epy/BGL.py
diff --git a/source/blender/python/doc/epy/Geometry.py b/doc/python_api/epy/Geometry.py
index d0c4dfdfd8d..d0c4dfdfd8d 100644
--- a/source/blender/python/doc/epy/Geometry.py
+++ b/doc/python_api/epy/Geometry.py
diff --git a/source/blender/python/doc/epy/IDProp.py b/doc/python_api/epy/IDProp.py
index 1fc26d7f65b..1fc26d7f65b 100644
--- a/source/blender/python/doc/epy/IDProp.py
+++ b/doc/python_api/epy/IDProp.py
diff --git a/source/blender/python/doc/epy/Mathutils.py b/doc/python_api/epy/Mathutils.py
index 17a227f729a..17a227f729a 100644
--- a/source/blender/python/doc/epy/Mathutils.py
+++ b/doc/python_api/epy/Mathutils.py
diff --git a/source/blender/python/doc/epy/testbgl.py b/doc/python_api/epy/testbgl.py
index e895d01df69..e895d01df69 100644
--- a/source/blender/python/doc/epy/testbgl.py
+++ b/doc/python_api/epy/testbgl.py
diff --git a/source/blender/python/doc/examples/bpy.data.py b/doc/python_api/examples/bpy.data.py
index fc1145a523f..fc1145a523f 100644
--- a/source/blender/python/doc/examples/bpy.data.py
+++ b/doc/python_api/examples/bpy.data.py
diff --git a/source/blender/python/doc/examples/mathutils.Euler.py b/doc/python_api/examples/mathutils.Euler.py
index bc7702c1d53..bc7702c1d53 100644
--- a/source/blender/python/doc/examples/mathutils.Euler.py
+++ b/doc/python_api/examples/mathutils.Euler.py
diff --git a/source/blender/python/doc/examples/mathutils.Matrix.py b/doc/python_api/examples/mathutils.Matrix.py
index bc7702c1d53..bc7702c1d53 100644
--- a/source/blender/python/doc/examples/mathutils.Matrix.py
+++ b/doc/python_api/examples/mathutils.Matrix.py
diff --git a/source/blender/python/doc/examples/mathutils.Quaternion.py b/doc/python_api/examples/mathutils.Quaternion.py
index bc7702c1d53..bc7702c1d53 100644
--- a/source/blender/python/doc/examples/mathutils.Quaternion.py
+++ b/doc/python_api/examples/mathutils.Quaternion.py
diff --git a/source/blender/python/doc/examples/mathutils.Vector.py b/doc/python_api/examples/mathutils.Vector.py
index fb00e8aead6..fb00e8aead6 100644
--- a/source/blender/python/doc/examples/mathutils.Vector.py
+++ b/doc/python_api/examples/mathutils.Vector.py
diff --git a/source/blender/python/doc/examples/mathutils.py b/doc/python_api/examples/mathutils.py
index 02f69515f21..02f69515f21 100644
--- a/source/blender/python/doc/examples/mathutils.py
+++ b/doc/python_api/examples/mathutils.py
diff --git a/source/gameengine/PyDoc/bge.events.rst b/doc/python_api/rst/bge.events.rst
index f642291fe97..7215902a828 100644
--- a/source/gameengine/PyDoc/bge.events.rst
+++ b/doc/python_api/rst/bge.events.rst
@@ -18,7 +18,7 @@ This module holds key constants for the SCA_KeyboardSensor.
co = bge.logic.getCurrentController()
# 'Keyboard' is a keyboard sensor
sensor = co.sensors["Keyboard"]
- sensor.key = bge.keys.F1KEY
+ sensor.key = bge.events.F1KEY
.. code-block:: python
@@ -30,17 +30,37 @@ This module holds key constants for the SCA_KeyboardSensor.
sensor = co.sensors["Keyboard"]
for key,status in sensor.events:
- # key[0] == bge.keys.keycode, key[1] = status
+ # key[0] == bge.events.keycode, key[1] = status
if status == bge.logic.KX_INPUT_JUST_ACTIVATED:
- if key == bge.keys.WKEY:
+ if key == bge.events.WKEY:
# Activate Forward!
- if key == bge.keys.SKEY:
+ if key == bge.events.SKEY:
# Activate Backward!
- if key == bge.keys.AKEY:
+ if key == bge.events.AKEY:
# Activate Left!
- if key == bge.keys.DKEY:
+ if key == bge.events.DKEY:
# Activate Right!
+.. code-block:: python
+
+ # The all keys thing without a keyboard sensor (but you will
+ # need an always sensor with pulse mode on)
+ import bge
+
+ # Just shortening names here
+ keyboard = bge.logic.keyboard
+ JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
+
+ if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED:
+ print("Activate Forward!")
+ if keyboard.events[bge.events.SKEY] == JUST_ACTIVATED:
+ print("Activate Backward!")
+ if keyboard.events[bge.events.AKEY] == JUST_ACTIVATED:
+ print("Activate Left!")
+ if keyboard.events[bge.events.DKEY] == JUST_ACTIVATED:
+ print("Activate Right!")
+
+
*********
Functions
*********
@@ -222,7 +242,8 @@ Other Keys
.. data:: PERIODKEY
.. data:: QUOTEKEY
.. data:: RIGHTBRACKETKEY
-.. data:: RETKEY
+.. data:: RETKEY (Deprecated: use bge.events.ENTERKEY)
+.. data:: ENTERKEY
.. data:: SEMICOLONKEY
.. data:: SLASHKEY
.. data:: SPACEKEY
diff --git a/source/gameengine/PyDoc/bge.logic.rst b/doc/python_api/rst/bge.logic.rst
index a7eb5635d0f..d3261f5747b 100644
--- a/source/gameengine/PyDoc/bge.logic.rst
+++ b/doc/python_api/rst/bge.logic.rst
@@ -179,7 +179,7 @@ General functions
:arg blend: The path to the blend file (or the name to use for the library if data is supplied)
:type blend: string
- :arg type: The datablock type (currently only "Scene" and "Mesh" are supported)
+ :arg type: The datablock type (currently only "Action", "Mesh" and "Scene" are supported)
:type type: string
:arg data: Binary data from a blend file (optional)
:type data: bytes
diff --git a/source/gameengine/PyDoc/bge.render.rst b/doc/python_api/rst/bge.render.rst
index 9f17455601b..9f17455601b 100644
--- a/source/gameengine/PyDoc/bge.render.rst
+++ b/doc/python_api/rst/bge.render.rst
diff --git a/source/gameengine/PyDoc/bge.types.rst b/doc/python_api/rst/bge.types.rst
index 24b87e97286..6dc5488af32 100644
--- a/source/gameengine/PyDoc/bge.types.rst
+++ b/doc/python_api/rst/bge.types.rst
@@ -929,9 +929,9 @@ Game Engine bge.types Module
.. attribute:: color
- The object color of the object.
+ The object color of the object. [r, g, b, a]
- :type: list [r, g, b, a]
+ :type: :class:`mathutils.Vector`
.. attribute:: occlusion
@@ -941,63 +941,87 @@ Game Engine bge.types Module
.. attribute:: position
- The object's position.
+ The object's position. [x, y, z] On write: local position, on read: world position
.. deprecated:: use :data:`localPosition` and :data:`worldPosition`.
- :type: list [x, y, z] On write: local position, on read: world position
+ :type: :class:`mathurils.Vector`
.. attribute:: orientation
- The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
+ The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. On write: local orientation, on read: world orientation
.. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`.
- :type: 3x3 Matrix [[float]] On write: local orientation, on read: world orientation
+ :type: :class:`mathutils.Matrix`
.. attribute:: scaling
- The object's scaling factor. list [sx, sy, sz]
+ The object's scaling factor. [sx, sy, sz] On write: local scaling, on read: world scaling
.. deprecated:: use :data:`localScale` and :data:`worldScale`.
- :type: list [sx, sy, sz] On write: local scaling, on read: world scaling
+ :type: :class:`mathutils.Vector`
.. attribute:: localOrientation
The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
- :type: 3x3 Matrix [[float]]
+ :type: :class:`mathutils.Matrix`
.. attribute:: worldOrientation
- The object's world orientation.
+ The object's world orientation. 3x3 Matrix.
- :type: 3x3 Matrix [[float]]
+ :type: :class:`mathutils.Matrix`
.. attribute:: localScale
- The object's local scaling factor.
+ The object's local scaling factor. [sx, sy, sz]
- :type: list [sx, sy, sz]
+ :type: :class:`mathutils.Vector`
.. attribute:: worldScale
- The object's world scaling factor. Read-only.
+ The object's world scaling factor. Read-only. [sx, sy, sz]
- :type: list [sx, sy, sz]
+ :type: :class:`mathutils.Vector`
.. attribute:: localPosition
- The object's local position.
+ The object's local position. [x, y, z]
- :type: list [x, y, z]
+ :type: :class:`mathutils.Vector`
.. attribute:: worldPosition
- The object's world position.
+ The object's world position. [x, y, z]
- :type: list [x, y, z]
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: localLinearVelocity
+
+ The object's local linear velocity. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: worldLinearVelocity
+
+ The object's world linear velocity. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: localAngularVelocity
+
+ The object's local angular velocity. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: worldAngularVelocity
+
+ The object's world angular velocity. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
.. attribute:: timeOffset
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index b20cd74f82a..7a78816a2db 100644
--- a/source/blender/python/doc/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -19,20 +19,29 @@
# #**** END GPL LICENSE BLOCK #****
script_help_msg = '''
-Usage,
-run this script from blenders root path once you have compiled blender
- ./blender.bin -b -P /b/source/blender/python/doc/sphinx_doc_gen.py
+Usage:
-This will generate python files in "./source/blender/python/doc/sphinx-in"
-Generate html docs by running...
-
- sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
+For HTML generation
+-------------------
+- Run this script from blenders root path once you have compiled blender
+
+ ./blender.bin -b -P doc/python_api/sphinx_doc_gen.py
+ This will generate python files in doc/python_api/sphinx-in/,
+ assuming that ./blender.bin is or links to the blender executable
+- Generate html docs by running...
+
+ sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
+
+ assuming that you have sphinx 0.6.7 installed
+
For PDF generation
+------------------
+- After you have built doc/python_api/sphinx-in (see above), run:
- sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
- cd source/blender/python/doc/sphinx-out
+ sphinx-build -b latex doc/python_api/sphinx-in doc/python_api/sphinx-out
+ cd doc/python_api/sphinx-out
make
'''
@@ -475,13 +484,13 @@ def rna2sphinx(BASEPATH):
pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)")
del module
- # game engine
+ ## game engine
import shutil
# copy2 keeps time/date stamps
- shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.types.rst"), BASEPATH)
- shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.logic.rst"), BASEPATH)
- shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.render.rst"), BASEPATH)
- shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.events.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.types.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.logic.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.render.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.events.rst"), BASEPATH)
if 0:
@@ -794,9 +803,10 @@ def main():
else:
import shutil
- path_in = 'source/blender/python/doc/sphinx-in'
- path_out = 'source/blender/python/doc/sphinx-out'
- path_examples = 'source/blender/python/doc/examples'
+ script_dir = os.path.dirname(__file__)
+ path_in = os.path.join(script_dir,'sphinx-in')
+ path_out = os.path.join(script_dir,'sphinx-out')
+ path_examples = os.path.join(script_dir,'examples')
# only for partial updates
path_in_tmp = path_in + "-tmp"
diff --git a/source/blender/python/doc/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh
index 607803d16d5..49a2e4869d8 100755
--- a/source/blender/python/doc/sphinx_doc_gen.sh
+++ b/doc/python_api/sphinx_doc_gen.sh
@@ -10,7 +10,7 @@ SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation" # blender_python_api
# sed string from hell, 'Blender 2.53 (sub 1) Build' --> '2_53_1'
# "_".join(str(v) for v in bpy.app.version)
# custom blender vars
-blender_srcdir=$(dirname $0)/../../../../
+blender_srcdir=$(dirname $0)/../../
blender_version=$(grep BLENDER_VERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)
blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion
@@ -18,18 +18,20 @@ BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$b
BLENDER_VERSION=`$BLENDER --version | cut -f2-4 -d" " | sed 's/(//g' | sed 's/)//g' | sed 's/ sub /./g' | sed 's/\./_/g'`
SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION
+SPHINXBASE=doc/python_api/
+
# dont delete existing docs, now partial updates are used for quick builds.
-$BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
+$BLENDER --background --python $SPHINXBASE/sphinx_doc_gen.py
# html
-sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
-cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html
+sphinx-build $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
+cp $SPHINXBASE/sphinx-out/contents.html $SPHINXBASE/sphinx-out/index.html
ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*'
-rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
+rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
# pdf
-sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
-cd source/blender/python/doc/sphinx-out
+sphinx-build -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
+cd $SPHINXBASE/sphinx-out
make
-cd ../../../../../
-rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
+cd -
+rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 7d4b03f3294..8609712520b 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -24,6 +24,9 @@
#
# ***** END GPL LICENSE BLOCK *****
+# Otherwise we get warnings here that we cant fix in external projects
+STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+
IF(WITH_BULLET)
ADD_SUBDIRECTORY(bullet2)
ENDIF(WITH_BULLET)
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
index 623e99d5edc..09fdb31e938 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
@@ -246,13 +246,23 @@ void AUD_FFMPEGReader::seek(int position)
{
if(position >= 0)
{
+ uint64_t st_time = m_formatCtx->streams[m_stream]->start_time;
+ double time_base =
+ av_q2d(m_formatCtx->streams[m_stream]->time_base);
+ uint64_t seek_pos = position / time_base / m_specs.rate;
+
+ if (seek_pos < 0) {
+ seek_pos = 0;
+ }
+
+ if (st_time != AV_NOPTS_VALUE) {
+ seek_pos += st_time;
+ }
+
+
// a value < 0 tells us that seeking failed
- if(av_seek_frame(m_formatCtx,
- -1,
- (uint64_t)(((uint64_t)position *
- (uint64_t)AV_TIME_BASE) /
- (uint64_t)m_specs.rate),
- AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0)
+ if(av_seek_frame(m_formatCtx, m_stream, seek_pos,
+ AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0)
{
avcodec_flush_buffers(m_codecCtx);
m_position = position;
@@ -273,9 +283,8 @@ void AUD_FFMPEGReader::seek(int position)
if(packet.pts != AV_NOPTS_VALUE)
{
// calculate real position, and read to frame!
- m_position = packet.pts *
- av_q2d(m_formatCtx->streams[m_stream]->time_base) *
- m_specs.rate;
+ m_position = (packet.pts -
+ ((st_time != AV_NOPTS_VALUE) ? st_time : 0)) * time_base * m_specs.rate;
if(m_position < position)
{
diff --git a/intern/boolop/intern/BOP_Interface.cpp b/intern/boolop/intern/BOP_Interface.cpp
index 99116b7d87d..ff15751b797 100644
--- a/intern/boolop/intern/BOP_Interface.cpp
+++ b/intern/boolop/intern/BOP_Interface.cpp
@@ -80,7 +80,7 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType,
CSG_FaceIteratorDescriptor obBFaces,
CSG_VertexIteratorDescriptor obBVertices)
{
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
cout << "BEGIN BOP_performBooleanOperation" << endl;
#endif
@@ -118,7 +118,7 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType,
// Invert the output mesh if is required
*outputMesh = BOP_exportMesh(&meshC, invertMeshC);
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
cout << "END BOP_performBooleanOperation" << endl;
#endif
@@ -141,7 +141,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
bool invertMeshA,
bool invertMeshB)
{
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
BOP_Chrono chrono;
float t = 0.0f;
float c = 0.0f;
@@ -156,7 +156,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
BOP_BSPTree bspB;
bspB.addMesh(meshC, *facesB);
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
c = chrono.stamp(); t += c;
cout << "Create BSP " << c << endl;
#endif
@@ -172,7 +172,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
if ((0.25*facesB->size()) > bspA.getDeep())
BOP_meshFilter(meshC, facesB, &bspA);
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
c = chrono.stamp(); t += c;
cout << "mesh Filter " << c << endl;
#endif
@@ -180,7 +180,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
// Face 2 Face
BOP_Face2Face(meshC,facesA,facesB);
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
c = chrono.stamp(); t += c;
cout << "Face2Face " << c << endl;
#endif
@@ -189,7 +189,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
BOP_meshClassify(meshC,facesA,&bspB);
BOP_meshClassify(meshC,facesB,&bspA);
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
c = chrono.stamp(); t += c;
cout << "Classification " << c << endl;
#endif
@@ -197,7 +197,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
// Process overlapped faces
BOP_removeOverlappedFaces(meshC,facesA,facesB);
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
c = chrono.stamp(); t += c;
cout << "Remove overlap " << c << endl;
#endif
@@ -205,7 +205,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
// Sew two meshes
BOP_sew(meshC,facesA,facesB);
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
c = chrono.stamp(); t += c;
cout << "Sew " << c << endl;
#endif
@@ -238,7 +238,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
#endif
#endif
- #ifdef DEBUG
+ #ifdef BOP_DEBUG
c = chrono.stamp(); t += c;
cout << "Merge faces " << c << endl;
cout << "Total " << t << endl;
diff --git a/intern/boolop/intern/BOP_Merge2.cpp b/intern/boolop/intern/BOP_Merge2.cpp
index ad9f832ef01..2ef8b5b30b7 100644
--- a/intern/boolop/intern/BOP_Merge2.cpp
+++ b/intern/boolop/intern/BOP_Merge2.cpp
@@ -70,7 +70,7 @@ void dumpmesh ( BOP_Mesh *m, bool force )
}
if( nonmanifold )
cout << nonmanifold << " edges detected" << endl;
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "---------------------------" << endl;
BOP_Edges edges = m->getEdges();
@@ -130,7 +130,7 @@ void BOP_Merge2::mergeFaces(BOP_Mesh *m, BOP_Index v)
{
m_mesh = m;
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "##############################" << endl;
#endif
cleanup( );
@@ -147,7 +147,7 @@ void BOP_Merge2::mergeFaces(BOP_Mesh *m, BOP_Index v)
// ... and merge new faces
if( cont ) cont = mergeFaces();
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "called mergeFaces " << cont << endl;
#endif
// ... until the merge is not succesful
@@ -186,7 +186,7 @@ void clean_nonmanifold( BOP_Mesh *m )
unsigned short facecount = 0;
bool found = false;
BOP_Indexs vertList;
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " first edge is " << (*it) << endl;
#endif
vertList.push_back(first);
@@ -214,7 +214,7 @@ void clean_nonmanifold( BOP_Mesh *m )
edge = NULL;
}
if( !edge ) break;
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " next edge is " << edge << endl;
#endif
tmpface = m->getFace(edge->getFaces().front());
@@ -231,7 +231,7 @@ void clean_nonmanifold( BOP_Mesh *m )
}
if(found) {
edge = *it;
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " --> found a loop" << endl;
#endif
if( vertList.size() == 3 ) {
@@ -241,7 +241,7 @@ void clean_nonmanifold( BOP_Mesh *m )
BOP_Face4 *face = (BOP_Face4 *)m->getFace(edge->getFaces().front());
face->getNeighbours(first,last,next,last);
} else {
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "loop has " << vertList.size() << "verts";
#endif
continue;
@@ -253,7 +253,7 @@ void clean_nonmanifold( BOP_Mesh *m )
BOP_Face3 *f = new BOP_Face3(next,first,last,
oface1->getPlane(),oface1->getOriginalFace());
m->addFace( f );
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " face is backward: " << f << endl;
#endif
@@ -261,7 +261,7 @@ void clean_nonmanifold( BOP_Mesh *m )
BOP_Face3 *f = new BOP_Face3(last,first,next,
oface1->getPlane(),oface1->getOriginalFace());
m->addFace( f );
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " face is forward: " << f << endl;
#endif
}
@@ -366,7 +366,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices)
BOP_LFaces facesByOriginalFace;
BOP_Index v = mergeVertices[i];
BOP_Vertex *vert = m_mesh->getVertex(v);
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "i = " << i << ", v = " << v << ", vert = " << vert << endl;
if (v==48)
cout << "found vert 48" << endl;
@@ -381,7 +381,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices)
vert->setTAG(BROKEN);
break;
case 2: {
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "size of fBOF = " << facesByOriginalFace.size() << endl;
#endif
BOP_Faces ff = facesByOriginalFace.front();
@@ -391,7 +391,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices)
// look for two edges adjacent to v which contain both ofaces
BOP_Indexs edges = vert->getEdges();
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " ff has " << ff.size() << " faces" << endl;
cout << " fb has " << fb.size() << " faces" << endl;
cout << " v has " << edges.size() << " edges" << endl;
@@ -400,14 +400,14 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices)
++it ) {
BOP_Edge *edge = m_mesh->getEdge(*it);
BOP_Indexs faces = edge->getFaces();
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " " << edge << " has " << edge->getFaces().size() << " faces" << endl;
#endif
if( faces.size() == 2 ) {
BOP_Face *f0 = m_mesh->getFace(faces[0]);
BOP_Face *f1 = m_mesh->getFace(faces[1]);
if( f0->getOriginalFace() != f1->getOriginalFace() ) {
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " " << f0 << endl;
cout << " " << f1 << endl;
#endif
@@ -416,14 +416,14 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices)
}
}
if(ecount == 2) {
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " edge indexes are " << eindexs[0];
cout << " and " << eindexs[1] << endl;
#endif
BOP_Edge *edge = m_mesh->getEdge(eindexs[0]);
BOP_Index N = edge->getVertex1();
if(N == v) N = edge->getVertex2();
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " ## OK, replace "<<v<<" with "<<N << endl;
#endif
mergeVertex(ff , v, N );
@@ -437,7 +437,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices)
}
didMerge = true;
}
-#ifdef DEBUG
+#ifdef BOP_DEBUG
else {
cout << " HUH: ecount was " << ecount << endl;
}
@@ -461,7 +461,7 @@ void BOP_Merge2::mergeVertex(BOP_Faces &faces, BOP_Index v1, BOP_Index v2)
else
mergeVertex((BOP_Face4 *) *face, v1, v2);
(*face)->setTAG(BROKEN);
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << " breaking " << (*face) << endl;
#endif
}
@@ -506,7 +506,7 @@ void BOP_Merge2::mergeVertex(BOP_Face3 *face, BOP_Index v1, BOP_Index v2)
if( prev != v2 && next != v2 ) {
m_mesh->addFace( new BOP_Face3(prev,v2,next,
face->getPlane(),face->getOriginalFace()) );
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "mv3: add " << prev << "," << v2 << "," << next << endl;
} else {
cout << "mv3: vertex already in tri: doing nothing" << endl;
@@ -524,7 +524,7 @@ void BOP_Merge2::mergeVertex(BOP_Face4 *face, BOP_Index v1, BOP_Index v2)
if( prev == v2 || next == v2 ) {
m_mesh->addFace( new BOP_Face3(prev,next,opp,
face->getPlane(),face->getOriginalFace()) );
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "mv4a: add " << prev << "," << next << "," << opp << endl;
#endif
}
@@ -532,7 +532,7 @@ void BOP_Merge2::mergeVertex(BOP_Face4 *face, BOP_Index v1, BOP_Index v2)
else {
m_mesh->addFace( new BOP_Face4(prev,v2,next,opp,
face->getPlane(),face->getOriginalFace()) );
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "mv4b: add "<<prev<<","<<v2<<","<<next<<","<<opp<<endl;
#endif
}
@@ -570,7 +570,7 @@ bool BOP_Merge2::createQuads()
// Set triangles to BROKEN
deleteFace(m_mesh, *faceI);
deleteFace(m_mesh, *faceJ);
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "createQuad: del " << *faceI << endl;
cout << "createQuad: del " << *faceJ << endl;
cout << "createQuad: add " << faceK << endl;
@@ -602,7 +602,7 @@ bool BOP_Merge2::createQuads()
// Set triangles to BROKEN
deleteFace(m_mesh, *faceI);
deleteFace(m_mesh, *faceJ);
-#ifdef DEBUG
+#ifdef BOP_DEBUG
cout << "createQuad: del " << *faceI << endl;
cout << "createQuad: del " << *faceJ << endl;
cout << "createQuad: add " << faceK << endl;
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index f926e72119f..20b69611bfb 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -96,7 +96,7 @@ typedef enum {
GHOST_kModifierKeyRightAlt,
GHOST_kModifierKeyLeftControl,
GHOST_kModifierKeyRightControl,
- GHOST_kModifierKeyCommand, // APPLE only
+ GHOST_kModifierKeyOS,
GHOST_kModifierKeyNumMasks
} GHOST_TModifierKeyMask;
@@ -283,7 +283,7 @@ typedef enum {
GHOST_kKeyRightControl,
GHOST_kKeyLeftAlt,
GHOST_kKeyRightAlt,
- GHOST_kKeyCommand, // Command key on Apple, Windows key(s) on Windows
+ GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows
GHOST_kKeyGrLess , // German PC only!
GHOST_kKeyCapsLock,
diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h
index d402aed63db..927ecfc88a5 100644
--- a/intern/ghost/intern/GHOST_Debug.h
+++ b/intern/ghost/intern/GHOST_Debug.h
@@ -35,10 +35,10 @@
#define _GHOST_DEBUG_H_
#if defined(WIN32) && !defined(FREE_WINDOWS)
- #ifdef _DEBUG
+ #ifdef DEBUG
#pragma warning (disable:4786) // suppress stl-MSVC debug info warning
// #define GHOST_DEBUG
- #endif // _DEBUG
+ #endif // DEBUG
#endif // WIN32
#ifdef BF_GHOST_DEBUG
diff --git a/intern/ghost/intern/GHOST_EventPrinter.cpp b/intern/ghost/intern/GHOST_EventPrinter.cpp
index 645a33ab8c5..697ced64a70 100644
--- a/intern/ghost/intern/GHOST_EventPrinter.cpp
+++ b/intern/ghost/intern/GHOST_EventPrinter.cpp
@@ -255,9 +255,8 @@ void GHOST_EventPrinter::getKeyString(GHOST_TKey key, STR_String& str) const
case GHOST_kKeyRightAlt:
str = "RightAlt";
break;
- case GHOST_kKeyCommand:
- // APPLE only!
- str = "Command";
+ case GHOST_kKeyOS:
+ str = "OS";
break;
case GHOST_kKeyGrLess:
// PC german!
diff --git a/intern/ghost/intern/GHOST_ModifierKeys.cpp b/intern/ghost/intern/GHOST_ModifierKeys.cpp
index ed884966cb3..361329532f9 100644
--- a/intern/ghost/intern/GHOST_ModifierKeys.cpp
+++ b/intern/ghost/intern/GHOST_ModifierKeys.cpp
@@ -55,7 +55,7 @@ GHOST_TKey GHOST_ModifierKeys::getModifierKeyCode(GHOST_TModifierKeyMask mask)
case GHOST_kModifierKeyRightAlt: key = GHOST_kKeyRightAlt; break;
case GHOST_kModifierKeyLeftControl: key = GHOST_kKeyLeftControl; break;
case GHOST_kModifierKeyRightControl: key = GHOST_kKeyRightControl; break;
- case GHOST_kModifierKeyCommand: key = GHOST_kKeyCommand; break;
+ case GHOST_kModifierKeyOS: key = GHOST_kKeyOS; break;
default:
// Should not happen
key = GHOST_kKeyUnknown;
@@ -80,8 +80,8 @@ bool GHOST_ModifierKeys::get(GHOST_TModifierKeyMask mask) const
return m_LeftControl;
case GHOST_kModifierKeyRightControl:
return m_RightControl;
- case GHOST_kModifierKeyCommand:
- return m_Command;
+ case GHOST_kModifierKeyOS:
+ return m_OS;
default:
return false;
}
@@ -103,8 +103,8 @@ void GHOST_ModifierKeys::set(GHOST_TModifierKeyMask mask, bool down)
m_LeftControl = down; break;
case GHOST_kModifierKeyRightControl:
m_RightControl = down; break;
- case GHOST_kModifierKeyCommand:
- m_Command = down; break;
+ case GHOST_kModifierKeyOS:
+ m_OS = down; break;
default:
break;
}
@@ -119,7 +119,7 @@ void GHOST_ModifierKeys::clear()
m_RightAlt = false;
m_LeftControl = false;
m_RightControl = false;
- m_Command = false;
+ m_OS = false;
}
@@ -131,5 +131,5 @@ bool GHOST_ModifierKeys::equals(const GHOST_ModifierKeys& keys) const
(m_RightAlt == keys.m_RightAlt) &&
(m_LeftControl == keys.m_LeftControl) &&
(m_RightControl == keys.m_RightControl) &&
- (m_Command == keys.m_Command);
+ (m_OS == keys.m_OS);
}
diff --git a/intern/ghost/intern/GHOST_ModifierKeys.h b/intern/ghost/intern/GHOST_ModifierKeys.h
index e18899bc939..77d6d5757d9 100644
--- a/intern/ghost/intern/GHOST_ModifierKeys.h
+++ b/intern/ghost/intern/GHOST_ModifierKeys.h
@@ -96,8 +96,8 @@ struct GHOST_ModifierKeys
GHOST_TUns8 m_LeftControl : 1;
/** Bitfield that stores the appropriate key state. */
GHOST_TUns8 m_RightControl : 1;
- /** Bitfield that stores the appropriate key state. APPLE only! */
- GHOST_TUns8 m_Command : 1;
+ /** Bitfield that stores the appropriate key state. */
+ GHOST_TUns8 m_OS : 1;
};
#endif // _GHOST_MODIFIER_KEYS_H_
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index ecdc03b4347..75cbe5db574 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -553,7 +553,7 @@ GHOST_TSuccess GHOST_SystemCarbon::getModifierKeys(GHOST_ModifierKeys& keys) con
{
UInt32 modifiers = ::GetCurrentKeyModifiers();
- keys.set(GHOST_kModifierKeyCommand, (modifiers & cmdKey) ? true : false);
+ keys.set(GHOST_kModifierKeyOS, (modifiers & cmdKey) ? true : false);
keys.set(GHOST_kModifierKeyLeftAlt, (modifiers & optionKey) ? true : false);
keys.set(GHOST_kModifierKeyLeftShift, (modifiers & shiftKey) ? true : false);
keys.set(GHOST_kModifierKeyLeftControl, (modifiers & controlKey) ? true : false);
@@ -941,7 +941,7 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & optionKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
}
if ((modifiers & cmdKey) != (m_modifierMask & cmdKey)) {
- pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & cmdKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyCommand) );
+ pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & cmdKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
}
m_modifierMask = modifiers;
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 286c4eda675..80356c19c9b 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -853,7 +853,7 @@ GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(GHOST_TInt32 x, GHOST_T
GHOST_TSuccess GHOST_SystemCocoa::getModifierKeys(GHOST_ModifierKeys& keys) const
{
- keys.set(GHOST_kModifierKeyCommand, (m_modifierMask & NSCommandKeyMask) ? true : false);
+ keys.set(GHOST_kModifierKeyOS, (m_modifierMask & NSCommandKeyMask) ? true : false);
keys.set(GHOST_kModifierKeyLeftAlt, (m_modifierMask & NSAlternateKeyMask) ? true : false);
keys.set(GHOST_kModifierKeyLeftShift, (m_modifierMask & NSShiftKeyMask) ? true : false);
keys.set(GHOST_kModifierKeyLeftControl, (m_modifierMask & NSControlKeyMask) ? true : false);
@@ -1018,7 +1018,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent()
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSAlternateKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
}
if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) {
- pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyCommand) );
+ pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
}
m_modifierMask = modifiers;
@@ -1163,7 +1163,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
NSEnumerator *enumerator;
NSImageRep *representation;
- ibuf = IMB_allocImBuf (imgSize.width , imgSize.height, 32, IB_rect, 0);
+ ibuf = IMB_allocImBuf (imgSize.width , imgSize.height, 32, IB_rect);
if (!ibuf) {
[droppedImg release];
return GHOST_kFailure;
@@ -1698,7 +1698,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSAlternateKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
}
if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) {
- pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyCommand) );
+ pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
}
m_modifierMask = modifiers;
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index dceecb53dd2..da333ce4f08 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -34,6 +34,8 @@
* @date May 7, 2001
*/
+#include <iostream>
+
#include "GHOST_SystemWin32.h"
#include "GHOST_EventDragnDrop.h"
@@ -136,14 +138,15 @@
GHOST_SystemWin32::GHOST_SystemWin32()
-: m_hasPerformanceCounter(false), m_freq(0), m_start(0),
- m_separateLeftRight(false),
- m_separateLeftRightInitialized(false)
+: m_hasPerformanceCounter(false), m_freq(0), m_start(0)
{
m_displayManager = new GHOST_DisplayManagerWin32 ();
GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n");
m_displayManager->initialize();
+ // Check if current keyboard layout uses AltGr
+ this->keyboardAltGr();
+
// Require COM for GHOST_DropTargetWin32 created in GHOST_WindowWin32.
OleInitialize(0);
}
@@ -287,43 +290,24 @@ GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) const
{
- if (m_separateLeftRight && m_separateLeftRightInitialized) {
- bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0;
- keys.set(GHOST_kModifierKeyLeftShift, down);
- down = HIBYTE(::GetKeyState(VK_RSHIFT)) != 0;
- keys.set(GHOST_kModifierKeyRightShift, down);
- down = HIBYTE(::GetKeyState(VK_LMENU)) != 0;
- keys.set(GHOST_kModifierKeyLeftAlt, down);
- down = HIBYTE(::GetKeyState(VK_RMENU)) != 0;
- keys.set(GHOST_kModifierKeyRightAlt, down);
- down = HIBYTE(::GetKeyState(VK_LCONTROL)) != 0;
- keys.set(GHOST_kModifierKeyLeftControl, down);
- down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0;
- keys.set(GHOST_kModifierKeyRightControl, down);
- bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0;
- bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0;
- if(lwindown || rwindown)
- keys.set(GHOST_kModifierKeyCommand, true);
- else
- keys.set(GHOST_kModifierKeyCommand, false);
- }
- else {
- bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0;
- keys.set(GHOST_kModifierKeyLeftShift, down);
- keys.set(GHOST_kModifierKeyRightShift, down);
- down = HIBYTE(::GetKeyState(VK_MENU)) != 0;
- keys.set(GHOST_kModifierKeyLeftAlt, down);
- keys.set(GHOST_kModifierKeyRightAlt, down);
- down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0;
- keys.set(GHOST_kModifierKeyLeftControl, down);
- keys.set(GHOST_kModifierKeyRightControl, down);
- bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0;
- bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0;
- if(lwindown || rwindown)
- keys.set(GHOST_kModifierKeyCommand, true);
- else
- keys.set(GHOST_kModifierKeyCommand, false);
- }
+ bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0;
+ keys.set(GHOST_kModifierKeyLeftShift, down);
+ keys.set(GHOST_kModifierKeyRightShift, down);
+
+ down = HIBYTE(::GetKeyState(VK_MENU)) != 0;
+ keys.set(GHOST_kModifierKeyLeftAlt, down);
+ keys.set(GHOST_kModifierKeyRightAlt, down);
+
+ down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0;
+ keys.set(GHOST_kModifierKeyLeftControl, down);
+ keys.set(GHOST_kModifierKeyRightControl, down);
+
+ bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0;
+ bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0;
+ if(lwindown || rwindown)
+ keys.set(GHOST_kModifierKeyOS, true);
+ else
+ keys.set(GHOST_kModifierKeyOS, false);
return GHOST_kSuccess;
}
@@ -386,7 +370,7 @@ GHOST_TSuccess GHOST_SystemWin32::init()
wc.hbrBackground= (HBRUSH)::GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName= GHOST_WindowWin32::getWindowClassName();
-
+
// Use RegisterClassEx for setting small icon
if (::RegisterClass(&wc) == 0) {
success = GHOST_kFailure;
@@ -402,10 +386,14 @@ GHOST_TSuccess GHOST_SystemWin32::exit()
}
-GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const
+GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam) const
{
- GHOST_TKey key;
bool isExtended = (lParam&(1<<24))?true:false;
+
+ GHOST_TKey key;
+ GHOST_ModifierKeys oldModifiers, newModifiers;
+ ((GHOST_SystemWin32*)getSystem())->retrieveModifierKeys(oldModifiers);
+ ((GHOST_SystemWin32*)getSystem())->getModifierKeys(newModifiers);
if ((wParam >= '0') && (wParam <= '9')) {
// VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39)
@@ -469,55 +457,62 @@ GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const
case VK_QUOTE: key = GHOST_kKeyQuote; break;
case VK_GR_LESS: key = GHOST_kKeyGrLess; break;
- // Process these keys separately because we need to distinguish right from left modifier keys
case VK_SHIFT:
+ {
+ bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftShift) != newModifiers.get(GHOST_kModifierKeyLeftShift);
+ if(lchanged) {
+ key = GHOST_kKeyLeftShift;
+ } else {
+ key = GHOST_kKeyRightShift;
+ }
+ }
+ break;
case VK_CONTROL:
+ {
+ bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftControl) != newModifiers.get(GHOST_kModifierKeyLeftControl);
+ if(lchanged) {
+ key = GHOST_kKeyLeftControl;
+ } else {
+ key = GHOST_kKeyRightControl;
+ }
+ }
+ break;
case VK_MENU:
-
- // Ignore these keys
- case VK_NUMLOCK:
- case VK_SCROLL:
- case VK_CAPITAL:
+ {
+ if(m_hasAltGr && isExtended) {
+ // We have here an extended RAlt, which is AltGr. The keyboard driver on Windows sends before this a LControl, so
+ // to be able to input characters created with AltGr (normal on German, French, Finnish and other keyboards) we
+ // push an extra LControl up event. This ensures we don't have a 'hanging' ctrl event in Blender windowmanager
+ // when typing in Text editor or Console.
+ GHOST_Event *extra = new GHOST_EventKey(getSystem()->getMilliSeconds(), GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl, '\0');
+ ((GHOST_SystemWin32*)getSystem())->pushEvent(extra);
+ newModifiers.set(GHOST_kModifierKeyRightControl, false);
+ newModifiers.set(GHOST_kModifierKeyLeftControl, false);
+ }
+ bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftAlt) != newModifiers.get(GHOST_kModifierKeyLeftAlt);
+ if(lchanged) {
+ key = GHOST_kKeyLeftAlt;
+ } else {
+ key = GHOST_kKeyRightAlt;
+ }
+ }
+ break;
+ case VK_LWIN:
+ case VK_RWIN:
+ key = GHOST_kKeyOS;
+ break;
+ case VK_NUMLOCK: key = GHOST_kKeyNumLock; break;
+ case VK_SCROLL: key = GHOST_kKeyScrollLock; break;
+ case VK_CAPITAL: key = GHOST_kKeyCapsLock; break;
default:
key = GHOST_kKeyUnknown;
break;
}
}
- return key;
-}
-
-
-void GHOST_SystemWin32::processModifierKeys(GHOST_IWindow *window)
-{
- GHOST_ModifierKeys oldModifiers, newModifiers;
- // Retrieve old state of the modifier keys
- ((GHOST_SystemWin32*)getSystem())->retrieveModifierKeys(oldModifiers);
- // Retrieve current state of the modifier keys
- ((GHOST_SystemWin32*)getSystem())->getModifierKeys(newModifiers);
-
- // Compare the old and the new
- if (!newModifiers.equals(oldModifiers)) {
- // Create events for the masks that changed
- for (int i = 0; i < GHOST_kModifierKeyNumMasks; i++) {
- if (newModifiers.get((GHOST_TModifierKeyMask)i) != oldModifiers.get((GHOST_TModifierKeyMask)i)) {
- // Convert the mask to a key code
- GHOST_TKey key = GHOST_ModifierKeys::getModifierKeyCode((GHOST_TModifierKeyMask)i);
- bool keyDown = newModifiers.get((GHOST_TModifierKeyMask)i);
- GHOST_EventKey* event;
- if (key != GHOST_kKeyUnknown) {
- // Create an event
- event = new GHOST_EventKey(getSystem()->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key);
- pushEvent(event);
- }
- }
- }
- }
-
- // Store new modifier keys state
((GHOST_SystemWin32*)getSystem())->storeModifierKeys(newModifiers);
+ return key;
}
-
GHOST_EventButton* GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask mask)
{
return new GHOST_EventButton (getSystem()->getMilliSeconds(), type, window, mask);
@@ -594,7 +589,7 @@ GHOST_EventWheel* GHOST_SystemWin32::processWheelEvent(GHOST_IWindow *window, WP
GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, bool keyDown, WPARAM wParam, LPARAM lParam)
{
- GHOST_TKey key = ((GHOST_SystemWin32*)getSystem())->convertKey(wParam, lParam);
+ GHOST_TKey key = ((GHOST_SystemWin32*)getSystem())->convertKey(window, wParam, lParam);
GHOST_EventKey* event;
if (key != GHOST_kKeyUnknown) {
MSG keyMsg;
@@ -603,6 +598,7 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, bool k
/* Eat any character related messages */
if (::PeekMessage(&keyMsg, NULL, WM_CHAR, WM_SYSDEADCHAR, PM_REMOVE)) {
ascii = (char) keyMsg.wParam;
+
}
event = new GHOST_EventKey(getSystem()->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii);
@@ -651,89 +647,30 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
GHOST_WindowWin32* window = (GHOST_WindowWin32*)::GetWindowLong(hwnd, GWL_USERDATA);
if (window) {
switch (msg) {
+ // we need to check if new key layout has AltGr
+ case WM_INPUTLANGCHANGE:
+ system->keyboardAltGr();
+ break;
////////////////////////////////////////////////////////////////////////
// Keyboard events, processed
////////////////////////////////////////////////////////////////////////
case WM_KEYDOWN:
- /* The WM_KEYDOWN message is posted to the window with the keyboard focus when a
- * nonsystem key is pressed. A nonsystem key is a key that is pressed when the alt
- * key is not pressed.
- */
case WM_SYSKEYDOWN:
- /* The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when
- * the user presses the F10 key (which activates the menu bar) or holds down the
- * alt key and then presses another key. It also occurs when no window currently
- * has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the
- * active window. The window that receives the message can distinguish between these
- * two contexts by checking the context code in the lKeyData parameter.
- */
- switch (wParam) {
- case VK_SHIFT:
- case VK_CONTROL:
- case VK_MENU:
- case VK_LWIN:
- case VK_RWIN:
- if (!system->m_separateLeftRightInitialized) {
- // Check whether this system supports separate left and right keys
- switch (wParam) {
- case VK_SHIFT:
- system->m_separateLeftRight =
- (HIBYTE(::GetKeyState(VK_LSHIFT)) != 0) ||
- (HIBYTE(::GetKeyState(VK_RSHIFT)) != 0) ?
- true : false;
- break;
- case VK_CONTROL:
- system->m_separateLeftRight =
- (HIBYTE(::GetKeyState(VK_LCONTROL)) != 0) ||
- (HIBYTE(::GetKeyState(VK_RCONTROL)) != 0) ?
- true : false;
- break;
- case VK_MENU:
- system->m_separateLeftRight =
- (HIBYTE(::GetKeyState(VK_LMENU)) != 0) ||
- (HIBYTE(::GetKeyState(VK_RMENU)) != 0) ?
- true : false;
- break;
- case VK_LWIN:
- case VK_RWIN:
- system->m_separateLeftRight = true;
- break;
- }
- system->m_separateLeftRightInitialized = true;
- }
- system->processModifierKeys(window);
- // Bypass call to DefWindowProc
- return 0;
- default:
- event = processKeyEvent(window, true, wParam, lParam);
- if (!event) {
- GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ")
- GHOST_PRINT(msg)
- GHOST_PRINT(" key ignored\n")
- }
- break;
- }
+ event = processKeyEvent(window, true, wParam, lParam);
+ if (!event) {
+ GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ")
+ GHOST_PRINT(msg)
+ GHOST_PRINT(" key ignored\n")
+ }
break;
case WM_KEYUP:
case WM_SYSKEYUP:
- switch (wParam) {
- case VK_SHIFT:
- case VK_CONTROL:
- case VK_MENU:
- case VK_LWIN:
- case VK_RWIN:
- system->processModifierKeys(window);
- // Bypass call to DefWindowProc
- return 0;
- default:
- event = processKeyEvent(window, false, wParam, lParam);
- if (!event) {
- GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ")
- GHOST_PRINT(msg)
- GHOST_PRINT(" key ignored\n")
- }
- break;
+ event = processKeyEvent(window, false, wParam, lParam);
+ if (!event) {
+ GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ")
+ GHOST_PRINT(msg)
+ GHOST_PRINT(" key ignored\n")
}
break;
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 35b8debf6b4..3cd1deefda0 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -239,7 +239,7 @@ protected:
* @param lParam The lParam from the wndproc
* @return The GHOST key (GHOST_kKeyUnknown if no match).
*/
- virtual GHOST_TKey convertKey(WPARAM wParam, LPARAM lParam) const;
+ virtual GHOST_TKey convertKey(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam) const;
/**
* Creates modifier key event(s) and updates the key data stored locally (m_modifierKeys).
@@ -248,7 +248,7 @@ protected:
* events generated for both keys.
* @param window The window receiving the event (the active window).
*/
- void processModifierKeys(GHOST_IWindow *window);
+ GHOST_EventKey* processModifierKeys(GHOST_IWindow *window);
/**
* Creates mouse button event.
@@ -310,6 +310,11 @@ protected:
* @param keys The new state of the modifier keys.
*/
inline virtual void storeModifierKeys(const GHOST_ModifierKeys& keys);
+
+ /**
+ * Check current key layout for AltGr
+ */
+ inline virtual void keyboardAltGr();
/**
* Windows call back routine for our window class.
@@ -324,11 +329,8 @@ protected:
__int64 m_freq;
/** High frequency timer variable. */
__int64 m_start;
- /** Stores the capability of this system to distinguish left and right modifier keys. */
- bool m_separateLeftRight;
- /** Stores the initialization state of the member m_leftRightDistinguishable. */
- bool m_separateLeftRightInitialized;
-
+ /** AltGr on current keyboard layout. */
+ bool m_hasAltGr;
};
inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys& keys) const
@@ -341,5 +343,22 @@ inline void GHOST_SystemWin32::storeModifierKeys(const GHOST_ModifierKeys& keys)
m_modifierKeys = keys;
}
+inline void GHOST_SystemWin32::keyboardAltGr()
+{
+ HKL keylayout = GetKeyboardLayout(0); // get keylayout for current thread
+ int i;
+ SHORT s;
+ for(m_hasAltGr = false, i = 32; i < 256; ++i) {
+ s = VkKeyScanEx((char)i, keylayout);
+ // s == -1 means no key that translates passed char code
+ // high byte contains shift state. bit 2 ctrl pressed, bit 4 alt pressed
+ // if both are pressed, we have AltGr keycombo on keylayout
+ if(s!=-1 && (s & 0x600) == 0x600) {
+ m_hasAltGr = true;
+ break;
+ }
+ }
+}
+
#endif // _GHOST_SYSTEM_WIN32_H_
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index b07dba7319f..393761566ba 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -891,13 +891,13 @@ getModifierKeys(
keys.set(GHOST_kModifierKeyRightAlt,false);
}
- // Super (Windows) - only one GHOST-kModifierKeyCommand, so mapping
+ // Super (Windows) - only one GHOST-kModifierKeyOS, so mapping
// to either
if ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) ||
((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) {
- keys.set(GHOST_kModifierKeyCommand,true);
+ keys.set(GHOST_kModifierKeyOS,true);
} else {
- keys.set(GHOST_kModifierKeyCommand,false);
+ keys.set(GHOST_kModifierKeyOS,false);
}
return GHOST_kSuccess;
}
@@ -1106,8 +1106,8 @@ convertXKey(
GXMAP(type,XK_Control_R, GHOST_kKeyRightControl);
GXMAP(type,XK_Alt_L, GHOST_kKeyLeftAlt);
GXMAP(type,XK_Alt_R, GHOST_kKeyRightAlt);
- GXMAP(type,XK_Super_L, GHOST_kKeyCommand);
- GXMAP(type,XK_Super_R, GHOST_kKeyCommand);
+ GXMAP(type,XK_Super_L, GHOST_kKeyOS);
+ GXMAP(type,XK_Super_R, GHOST_kKeyOS);
GXMAP(type,XK_Insert, GHOST_kKeyInsert);
GXMAP(type,XK_Delete, GHOST_kKeyDelete);
diff --git a/intern/ghost/test/multitest/EventToBuf.c b/intern/ghost/test/multitest/EventToBuf.c
index 1dbaad35994..859600bb783 100644
--- a/intern/ghost/test/multitest/EventToBuf.c
+++ b/intern/ghost/test/multitest/EventToBuf.c
@@ -125,7 +125,7 @@ static char *keytype_to_string(GHOST_TKey key) {
K(KeyRightControl);
K(KeyLeftAlt);
K(KeyRightAlt);
- K(KeyCommand);
+ K(KeyOS);
K(KeyCapsLock);
K(KeyNumLock);
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 6b78b0b6bdc..dfb8b2db1b1 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -150,6 +150,10 @@ extern "C" {
/*get the peak memory usage in bytes, including mmap allocations*/
uintptr_t MEM_get_peak_memory(void);
+#ifndef NDEBUG
+const char *MEM_name_ptr(void *vmemh);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/intern/guardedalloc/SConscript b/intern/guardedalloc/SConscript
index 0c9c7d13608..74d6e07269f 100644
--- a/intern/guardedalloc/SConscript
+++ b/intern/guardedalloc/SConscript
@@ -2,7 +2,14 @@
Import('env')
-sources = env.Glob('intern/*.c')
+defs = []
+
+sources = ['intern/mallocn.c', 'intern/mmap_win.c']
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ sources.append('cpp/mallocn.cpp')
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
incs = '.'
-env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defines=[], libtype=['intern','player'], priority = [5,150] )
+env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defs, libtype=['intern','player'], priority = [5,150] )
diff --git a/intern/guardedalloc/cpp/mallocn.cpp b/intern/guardedalloc/cpp/mallocn.cpp
index bf51409e84f..b4d19a62bdc 100644
--- a/intern/guardedalloc/cpp/mallocn.cpp
+++ b/intern/guardedalloc/cpp/mallocn.cpp
@@ -26,7 +26,7 @@
void* operator new (size_t size)
{
- return MEM_mallocN(size, "c++/anonymous");
+ return MEM_mallocN(size, "C++/anonymous");
}
/* not default but can be used when needing to set a string */
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 09f2d33a674..b213a1c3744 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -856,4 +856,18 @@ int MEM_get_memory_blocks_in_use(void)
return _totblock;
}
+#ifndef NDEBUG
+const char *MEM_name_ptr(void *vmemh)
+{
+ if (vmemh) {
+ MemHead *memh= vmemh;
+ memh--;
+ return memh->name;
+ }
+ else {
+ return "MEM_name_ptr(NULL)";
+ }
+}
+#endif
+
/* eof */
diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp
index 1add6f638cf..beb82f08ed4 100644
--- a/intern/iksolver/intern/IK_Solver.cpp
+++ b/intern/iksolver/intern/IK_Solver.cpp
@@ -45,6 +45,7 @@ public:
std::list<IK_QTask*> tasks;
};
+// FIXME: locks still result in small "residual" changes to the locked axes...
IK_QSegment *CreateSegment(int flag, bool translate)
{
int ndof = 0;
diff --git a/intern/moto/include/MT_assert.h b/intern/moto/include/MT_assert.h
index cc6f980efb4..a0e97e6ad34 100644
--- a/intern/moto/include/MT_assert.h
+++ b/intern/moto/include/MT_assert.h
@@ -48,7 +48,7 @@
MT_CDECL int MT_QueryAssert(const char *file, int line, const char *predicate, int *do_assert);
-#ifdef NDEBUG
+#if !defined(DEBUG)
#define MT_assert(predicate) ((void)0)
#define BREAKPOINT() ((void)0)
#else
@@ -93,7 +93,7 @@ abort();
}
#endif /* windows */
-#endif /* NDEBUG */
+#endif /* !defined(DEBUG) */
#endif
diff --git a/intern/opennl/superlu/ssp_defs.h b/intern/opennl/superlu/ssp_defs.h
index 61b324e74d8..7828a47d260 100644
--- a/intern/opennl/superlu/ssp_defs.h
+++ b/intern/opennl/superlu/ssp_defs.h
@@ -228,7 +228,7 @@ extern void check_tempv(int, float *);
extern int print_int_vec(char *what, int n, int *vec);
extern int sp_symetree(int *acolst, int *acolend, int *arow, int n, int *parent);
-
+extern void sprint_lu_col(char *msg, int jcol, int pivrow, int *xprune, GlobalLU_t *Glu); // added to build with debug for blender - campbell
#ifdef __cplusplus
}
#endif
diff --git a/intern/string/SConscript b/intern/string/SConscript
index f8342bf12c2..dac0ead8e61 100644
--- a/intern/string/SConscript
+++ b/intern/string/SConscript
@@ -4,4 +4,10 @@ Import ('env')
sources = env.Glob('intern/*.cpp')
incs = '.'
-env.BlenderLib ('bf_intern_string', sources, Split(incs), [], libtype=['intern','player'], priority = [50,10] )
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #intern/guardedalloc'
+
+env.BlenderLib ('bf_intern_string', sources, Split(incs), defs, libtype=['intern','player'], priority = [50,10] )
diff --git a/release/scripts/io/netrender/client.py b/release/scripts/io/netrender/client.py
index c17944725b0..128ae99ab1d 100644
--- a/release/scripts/io/netrender/client.py
+++ b/release/scripts/io/netrender/client.py
@@ -211,7 +211,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
address = "" if netsettings.server_address == "[default]" else netsettings.server_address
- master.runMaster((address, netsettings.server_port), netsettings.use_master_broadcast, netsettings.use_master_clear, netsettings.path, self.update_stats, self.test_break)
+ master.runMaster((address, netsettings.server_port), netsettings.use_master_broadcast, netsettings.use_master_clear, bpy.path.abspath(netsettings.path), self.update_stats, self.test_break)
def render_slave(self, scene):
@@ -236,10 +236,11 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
# reading back result
self.update_stats("", "Network render waiting for results")
-
+
+
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
- response.read()
+ buf = response.read()
if response.status == http.client.NO_CONTENT:
new_job = True
@@ -248,13 +249,13 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
- response.read()
-
+ buf = response.read()
+
while response.status == http.client.ACCEPTED and not self.test_break():
time.sleep(1)
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
- response.read()
+ buf = response.read()
# cancel new jobs (animate on network) on break
if self.test_break() and new_job:
@@ -271,18 +272,22 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
r = scene.render
x= int(r.resolution_x*r.resolution_percentage*0.01)
y= int(r.resolution_y*r.resolution_percentage*0.01)
+
+ result_path = os.path.join(bpy.path.abspath(netsettings.path), "output.exr")
+
+ folder = os.path.split(result_path)[0]
+
+ if not os.path.exists(folder):
+ os.mkdir(folder)
- f = open(os.path.join(netsettings.path, "output.exr"), "wb")
- buf = response.read(1024)
+ f = open(result_path, "wb")
- while buf:
- f.write(buf)
- buf = response.read(1024)
+ f.write(buf)
f.close()
result = self.begin_result(0, 0, x, y)
- result.load_from_file(os.path.join(netsettings.path, "output.exr"))
+ result.load_from_file(result_path)
self.end_result(result)
conn.close()
diff --git a/release/scripts/io/netrender/operators.py b/release/scripts/io/netrender/operators.py
index 2b40cd77125..96601dcf653 100644
--- a/release/scripts/io/netrender/operators.py
+++ b/release/scripts/io/netrender/operators.py
@@ -417,7 +417,7 @@ class netclientdownload(bpy.types.Operator):
for frame in job.frames:
client.requestResult(conn, job.id, frame.number)
response = conn.getresponse()
- response.read()
+ buf = response.read()
if response.status != http.client.OK:
print("missing", frame.number)
@@ -425,12 +425,9 @@ class netclientdownload(bpy.types.Operator):
print("got back", frame.number)
- f = open(os.path.join(netsettings.path, "%06d.exr" % frame.number), "wb")
- buf = response.read(1024)
+ f = open(os.path.join(bpy.path.abspath(netsettings.path), "%06d.exr" % frame.number), "wb")
- while buf:
- f.write(buf)
- buf = response.read(1024)
+ f.write(buf)
f.close()
diff --git a/release/scripts/io/netrender/slave.py b/release/scripts/io/netrender/slave.py
index f017fefa4e3..8629a38c04a 100644
--- a/release/scripts/io/netrender/slave.py
+++ b/release/scripts/io/netrender/slave.py
@@ -21,6 +21,8 @@ import http, http.client, http.server, urllib
import subprocess, time
import json
+import bpy
+
from netrender.utils import *
import netrender.model
import netrender.repath
@@ -30,8 +32,13 @@ BLENDER_PATH = sys.argv[0]
CANCEL_POLL_SPEED = 2
MAX_TIMEOUT = 10
INCREMENT_TIMEOUT = 1
+try:
+ system = platform.system()
+except UnicodeDecodeError:
+ import sys
+ system = sys.platform
-if platform.system() == 'Windows' and platform.version() >= '5': # Error mode is only available on Win2k or higher, that's version 5
+if system in ('Windows', 'win32') and platform.version() >= '5': # Error mode is only available on Win2k or higher, that's version 5
import ctypes
def SetErrorMode():
val = ctypes.windll.kernel32.SetErrorMode(0x0002)
@@ -118,7 +125,7 @@ def render_slave(engine, netsettings, threads):
slave_id = response.getheader("slave-id")
- NODE_PREFIX = os.path.join(netsettings.path, "slave_" + slave_id)
+ NODE_PREFIX = os.path.join(bpy.path.abspath(netsettings.path), "slave_" + slave_id)
if not os.path.exists(NODE_PREFIX):
os.mkdir(NODE_PREFIX)
diff --git a/release/scripts/modules/animsys_refactor.py b/release/scripts/modules/animsys_refactor.py
index 8cc91873b0e..bd16a02268a 100644
--- a/release/scripts/modules/animsys_refactor.py
+++ b/release/scripts/modules/animsys_refactor.py
@@ -111,6 +111,7 @@ def classes_recursive(base_type, clss=None):
def find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map):
+ # note!, id_data can be ID type or a node tree
# ignore ID props for now
if data_path.startswith("["):
return data_path
@@ -156,36 +157,43 @@ def update_data_paths(rna_update):
rna_update_from_map.setdefault(ren_from, []).append(ren_to)
for id_data in id_iter():
- anim_data = getattr(id_data, "animation_data", None)
- if anim_data is None:
- continue
-
- for fcurve in anim_data.drivers:
- for var in fcurve.driver.variables:
- if var.type == 'SINGLE_PROP':
- for tar in var.targets:
- id_data_other = tar.id
- data_path = tar.data_path
-
- if id_data_other and data_path:
- data_path_new = find_path_new(id_data_other, data_path, rna_update_dict, rna_update_from_map)
- # print(data_path_new)
- if data_path_new != data_path:
- if not IS_TESTING:
- tar.data_path = data_path_new
- print("driver (%s): %s -> %s" % (id_data_other.name, data_path, data_path_new))
+
+ # check node-trees too
+ anim_data_ls = [(id_data, getattr(id_data, "animation_data", None))]
+ node_tree = getattr(id_data, "node_tree", None)
+ if node_tree:
+ anim_data_ls.append((node_tree, node_tree.animation_data))
+
+ for anim_data_base, anim_data in anim_data_ls:
+ if anim_data is None:
+ continue
+
+ for fcurve in anim_data.drivers:
+ for var in fcurve.driver.variables:
+ if var.type == 'SINGLE_PROP':
+ for tar in var.targets:
+ id_data_other = tar.id
+ data_path = tar.data_path
+
+ if id_data_other and data_path:
+ data_path_new = find_path_new(id_data_other, data_path, rna_update_dict, rna_update_from_map)
+ # print(data_path_new)
+ if data_path_new != data_path:
+ if not IS_TESTING:
+ tar.data_path = data_path_new
+ print("driver (%s): %s -> %s" % (id_data_other.name, data_path, data_path_new))
+
-
- for action in anim_data_actions(anim_data):
- for fcu in action.fcurves:
- data_path = fcu.data_path
- data_path_new = find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map)
- # print(data_path_new)
- if data_path_new != data_path:
- if not IS_TESTING:
- fcu.data_path = data_path_new
- print("fcurve (%s): %s -> %s" % (id_data.name, data_path, data_path_new))
+ for action in anim_data_actions(anim_data):
+ for fcu in action.fcurves:
+ data_path = fcu.data_path
+ data_path_new = find_path_new(anim_data_base, data_path, rna_update_dict, rna_update_from_map)
+ # print(data_path_new)
+ if data_path_new != data_path:
+ if not IS_TESTING:
+ fcu.data_path = data_path_new
+ print("fcurve (%s): %s -> %s" % (id_data.name, data_path, data_path_new))
if __name__ == "__main__":
diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py
index 7a824ce2e68..ba56fa12fe1 100644
--- a/release/scripts/modules/bpy/ops.py
+++ b/release/scripts/modules/bpy/ops.py
@@ -182,8 +182,15 @@ class bpy_ops_submodule_op(object):
import bpy
idname = self.idname()
as_string = op_as_string(idname)
- descr = getattr(bpy.types, idname).bl_rna.description
- return as_string + "\n" + descr
+ op_class = getattr(bpy.types, idname)
+ descr = op_class.bl_rna.description
+ # XXX, workaround for not registering every __doc__ to save time on load.
+ if not descr:
+ descr = op_class.__doc__
+ if not descr:
+ descr = ""
+
+ return "# %s\n%s" % (descr, as_string)
def __str__(self): # used for print(...)
return "<function bpy.ops.%s.%s at 0x%x'>" % \
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 261165d8830..6ecb8a2e207 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -258,15 +258,15 @@ class _GenericBone:
return bones
-class PoseBone(StructRNA, _GenericBone):
+class PoseBone(StructRNA, _GenericBone, metaclass=StructMetaIDProp):
__slots__ = ()
-class Bone(StructRNA, _GenericBone):
+class Bone(StructRNA, _GenericBone, metaclass=StructMetaIDProp):
__slots__ = ()
-class EditBone(StructRNA, _GenericBone):
+class EditBone(StructRNA, _GenericBone, metaclass=StructMetaIDProp):
__slots__ = ()
def align_orientation(self, other):
diff --git a/release/scripts/modules/console/intellisense.py b/release/scripts/modules/console/intellisense.py
index 0f9acf9b6a9..d76c5d0ad60 100644
--- a/release/scripts/modules/console/intellisense.py
+++ b/release/scripts/modules/console/intellisense.py
@@ -75,10 +75,10 @@ def complete(line, cursor, namespace, private=True):
# unquoted word -> module or attribute completion
word = re_unquoted_word.group(1)
if RE_MODULE.match(line):
- import complete_import
+ from . import complete_import
matches = complete_import.complete(line)
else:
- import complete_namespace
+ from . import complete_namespace
matches = complete_namespace.complete(word, namespace, private)
else:
# for now we don't have completers for strings
@@ -112,7 +112,7 @@ def expand(line, cursor, namespace, private=True):
'abs(number) -> number\\nReturn the absolute value of the argument.'
"""
if line[:cursor].strip().endswith('('):
- import complete_calltip
+ from . import complete_calltip
matches, word, scrollback = complete_calltip.complete(line,
cursor, namespace)
no_calltip = False
diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py
index 98d9bb235a2..c4f18d51519 100644
--- a/release/scripts/modules/rigify/__init__.py
+++ b/release/scripts/modules/rigify/__init__.py
@@ -534,7 +534,11 @@ def generate_test_all(context, GRAPH=False):
new_objects = rigify.generate_test(context)
if GRAPH:
- base_name = os.path.splitext(bpy.data.filepath)[0]
+ if(bpy.data.filepath):
+ base_name = os.path.splitext(bpy.data.filepath)[0]
+ else:
+ import tempfile
+ base_name = tempfile.mktemp(prefix=bpy.app.tempdir)
for obj, obj_new in new_objects:
for obj in (obj, obj_new):
fn = base_name + "-" + bpy.path.clean_name(obj.name)
diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py
index 4282889c51a..e0298d30aa2 100644
--- a/release/scripts/modules/rna_info.py
+++ b/release/scripts/modules/rna_info.py
@@ -152,7 +152,7 @@ class InfoStructRNA:
functions.append((identifier, attr))
return functions
- def __repr__(self):
+ def __str__(self):
txt = ""
txt += self.identifier
@@ -285,7 +285,7 @@ class InfoPropertyRNA:
return type_str
- def __repr__(self):
+ def __str__(self):
txt = ''
txt += ' * ' + self.identifier + ': ' + self.description
@@ -319,7 +319,7 @@ class InfoFunctionRNA:
self.return_values = tuple(self.return_values)
- def __repr__(self):
+ def __str__(self):
txt = ''
txt += ' * ' + self.identifier + '('
diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py
new file mode 100644
index 00000000000..b6f429141bf
--- /dev/null
+++ b/release/scripts/modules/sys_info.py
@@ -0,0 +1,103 @@
+# ##### 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>
+
+# classes for extracting info from blenders internal classes
+
+import bpy
+import bgl
+
+import sys
+
+def cutPoint(text, length):
+ "Returns position of the last space found before 'length' chars"
+ l = length
+ c = text[l]
+ while c != ' ':
+ l -= 1
+ if l == 0: return length # no space found
+ c = text[l]
+ return l
+
+def textWrap(text, length = 70):
+ lines = []
+ while len(text) > 70:
+ cpt = cutPoint(text, length)
+ line, text = text[:cpt], text[cpt + 1:]
+ lines.append(line)
+ lines.append(text)
+ return lines
+
+def write_sysinfo(op):
+ output_filename = "system-info.txt"
+ warnings = 0
+ notices = 0
+
+ if output_filename in bpy.data.texts.keys():
+ output = bpy.data.texts[output_filename]
+ output.clear()
+ else:
+ output = bpy.data.texts.new(name=output_filename)
+
+ header = '= Blender {} System Information =\n'.format(bpy.app.version_string)
+ lilies = '{}\n\n'.format(len(header)*'=')
+ firstlilies = '{}\n'.format(len(header)*'=')
+ output.write(firstlilies)
+ output.write(header)
+ output.write(lilies)
+
+ # build info
+ output.write('\nBlender:\n')
+ output.write(lilies)
+ output.write('version {}, revision {}. {}\n'.format(bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type))
+ output.write('build date: {}, {}\n'.format(bpy.app.build_date, bpy.app.build_time))
+ output.write('platform: {}\n'.format(bpy.app.build_platform))
+ output.write('binary path: {}\n\n'.format(bpy.app.binary_path))
+
+ # python info
+ output.write('\nPython:\n')
+ output.write(lilies)
+ output.write('version: {}\n'.format(sys.version))
+ output.write('paths:\n')
+ for p in sys.path:
+ output.write('\t{}\n'.format(p))
+
+ output.write('\nDirectories:\n')
+ output.write(lilies)
+ output.write('scripts: {}\n'.format(bpy.utils.script_paths()))
+ output.write('user scripts: {}\n'.format(bpy.utils.user_script_path()))
+ output.write('datafiles: {}\n'.format(bpy.utils.user_resource('DATAFILES')))
+ output.write('config: {}\n'.format(bpy.utils.user_resource('CONFIG')))
+ output.write('scripts : {}\n'.format(bpy.utils.user_resource('SCRIPTS')))
+ output.write('autosave: {}\n'.format(bpy.utils.user_resource('AUTOSAVE')))
+ output.write('tempdir: {}\n'.format(bpy.app.tempdir))
+
+ output.write('\nOpenGL\n')
+ output.write(lilies)
+ output.write('renderer:\t{}\n'.format(bgl.glGetString(bgl.GL_RENDERER)))
+ output.write('vendor:\t\t{}\n'.format(bgl.glGetString(bgl.GL_VENDOR)))
+ output.write('version:\t{}\n'.format(bgl.glGetString(bgl.GL_VERSION)))
+ output.write('extensions:\n')
+
+ glext = bgl.glGetString(bgl.GL_EXTENSIONS)
+ glext = textWrap(glext, 70)
+ for l in glext:
+ output.write('\t\t{}\n'.format(l))
+
+ op.report({'INFO'}, "System information generated in 'system-info.txt'")
diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py
index b897e7955a0..ddd04c4e7c3 100644
--- a/release/scripts/op/image.py
+++ b/release/scripts/op/image.py
@@ -32,13 +32,17 @@ class EditExternally(bpy.types.Operator):
def _editor_guess(self, context):
import platform
- system = platform.system()
+ try:
+ system = platform.system()
+ except UnicodeDecodeError:
+ import sys
+ system = sys.platform
image_editor = context.user_preferences.filepaths.image_editor
# use image editor in the preferences when available.
if not image_editor:
- if system == 'Windows':
+ if system in ('Windows', 'win32'):
image_editor = ["start"] # not tested!
elif system == 'Darwin':
image_editor = ["open"]
@@ -84,7 +88,7 @@ class EditExternally(bpy.types.Operator):
class SaveDirty(bpy.types.Operator):
- '''Select object matching a naming pattern'''
+ """Save all modified textures"""
bl_idname = "image.save_dirty"
bl_label = "Save Dirty"
bl_options = {'REGISTER', 'UNDO'}
@@ -105,7 +109,7 @@ class SaveDirty(bpy.types.Operator):
class ProjectEdit(bpy.types.Operator):
- '''Select object matching a naming pattern'''
+ """Edit a snapshot if the viewport in an external image editor"""
bl_idname = "image.project_edit"
bl_label = "Project Edit"
bl_options = {'REGISTER'}
@@ -170,7 +174,7 @@ class ProjectEdit(bpy.types.Operator):
class ProjectApply(bpy.types.Operator):
- '''Select object matching a naming pattern'''
+ """Project edited image back onto the object"""
bl_idname = "image.project_apply"
bl_label = "Project Apply"
bl_options = {'REGISTER'}
diff --git a/release/scripts/op/io_scene_3ds/export_3ds.py b/release/scripts/op/io_scene_3ds/export_3ds.py
index 0cbb4347dda..943c94af55f 100644
--- a/release/scripts/op/io_scene_3ds/export_3ds.py
+++ b/release/scripts/op/io_scene_3ds/export_3ds.py
@@ -431,6 +431,7 @@ def make_material_texture_chunk(id, images):
mat_sub = _3ds_chunk(id)
def add_image(img):
+ import os
filename = os.path.basename(image.filepath)
mat_sub_file = _3ds_chunk(MATMAPFILE)
mat_sub_file.add_variable("mapfile", _3ds_string(sane_name(filename)))
diff --git a/release/scripts/op/io_scene_obj/export_obj.py b/release/scripts/op/io_scene_obj/export_obj.py
index abdb07c1a8e..3fd91615bb6 100644
--- a/release/scripts/op/io_scene_obj/export_obj.py
+++ b/release/scripts/op/io_scene_obj/export_obj.py
@@ -750,7 +750,7 @@ def _write(context, filepath,
# Export an animation?
if EXPORT_ANIMATION:
- scene_frames = range(scene.frame_start, context.frame_end + 1) # Up to and including the end frame.
+ scene_frames = range(scene.frame_start, scene.frame_end + 1) # Up to and including the end frame.
else:
scene_frames = [orig_frame] # Dont export an animation.
@@ -803,7 +803,7 @@ Currently the exporter lacks these features:
def save(operator, context, filepath="",
use_triangles=False,
- use_edges=False,
+ use_edges=True,
use_normals=False,
use_hq_normals=False,
use_uvs=True,
diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py
index 07852550ab7..2f6a5b69c20 100644
--- a/release/scripts/op/presets.py
+++ b/release/scripts/op/presets.py
@@ -66,7 +66,13 @@ class AddPresetBase():
for rna_path in self.preset_values:
value = eval(rna_path)
- file_preset.write("%s = %s\n" % (rna_path, repr(value)))
+ # convert thin wrapped sequences to simple lists to repr()
+ try:
+ value = value[:]
+ except:
+ pass
+
+ file_preset.write("%s = %r\n" % (rna_path, value))
file_preset.close()
@@ -250,7 +256,7 @@ class AddPresetKeyconfig(AddPresetBase, bpy.types.Operator):
'''Add a Keyconfig Preset'''
bl_idname = "wm.keyconfig_preset_add"
bl_label = "Add Keyconfig Preset"
- preset_menu = "PREFS_MT_keyconfigs"
+ preset_menu = "USERPREF_MT_keyconfigs"
preset_subdir = "keyconfig"
def add(self, context, filepath):
diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py
index 53421642129..244c3d4b332 100644
--- a/release/scripts/op/screen_play_rendered_anim.py
+++ b/release/scripts/op/screen_play_rendered_anim.py
@@ -30,14 +30,18 @@ import os
def guess_player_path(preset):
import platform
- system = platform.system()
+ try:
+ system = platform.system()
+ except UnicodeDecodeError:
+ import sys
+ system = sys.platform
if preset == 'BLENDER24':
player_path = "blender"
if system == 'Darwin':
test_path = "/Applications/blender 2.49.app/Contents/MacOS/blender"
- elif system == 'Windows':
+ elif system in ('Windows', 'win32'):
test_path = "/Program Files/Blender Foundation/Blender/blender.exe"
if os.path.exists(test_path):
diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py
index d01ef070d87..8fea37ef420 100644
--- a/release/scripts/op/uv.py
+++ b/release/scripts/op/uv.py
@@ -235,7 +235,7 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
class ExportUVLayout(bpy.types.Operator):
- '''Export the Mesh as SVG'''
+ """Export UV layout to file"""
bl_idname = "uv.export_layout"
bl_label = "Export UV Layout"
@@ -251,7 +251,7 @@ class ExportUVLayout(bpy.types.Operator):
name="Format",
description="File format to export the UV layout to",
default='PNG')
- size = IntVectorProperty(size=2, default=(1024, 1024), min=8, max=32768)
+ size = IntVectorProperty(size=2, default=(1024, 1024), min=8, max=32768, description="Dimensions of the exported file")
@classmethod
def poll(cls, context):
diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py
index 60a963804a6..4ce10233a9b 100644
--- a/release/scripts/op/wm.py
+++ b/release/scripts/op/wm.py
@@ -779,6 +779,15 @@ class WM_OT_keyconfig_activate(bpy.types.Operator):
bpy.utils.keyconfig_set(self.filepath)
return {'FINISHED'}
+class WM_OT_sysinfo(bpy.types.Operator):
+ '''Generate System Info'''
+ bl_idname = "wm.sysinfo"
+ bl_label = "System Info"
+
+ def execute(self, context):
+ import sys_info
+ sys_info.write_sysinfo(self)
+ return {'FINISHED'}
def register():
pass
diff --git a/release/scripts/presets/interaction/maya.py b/release/scripts/presets/interaction/maya.py
deleted file mode 100644
index 4a40326325e..00000000000
--- a/release/scripts/presets/interaction/maya.py
+++ /dev/null
@@ -1,386 +0,0 @@
-# Configuration Maya
-import bpy
-
-wm = bpy.context.window_manager
-kc = wm.keyconfigs.new('Maya')
-
-# Map 3D View
-km = kc.keymaps.new('3D View', space_type='VIEW_3D', region_type='WINDOW', modal=False)
-
-kmi = km.items.new('view3d.manipulator', 'LEFTMOUSE', 'PRESS', any=True)
-kmi.properties.release_confirm = True
-kmi = km.items.new('view3d.cursor3d', 'ACTIONMOUSE', 'PRESS')
-kmi = km.items.new('view3d.rotate', 'LEFTMOUSE', 'PRESS', alt=True)
-kmi = km.items.new('view3d.move', 'MIDDLEMOUSE', 'PRESS', alt=True)
-kmi = km.items.new('view3d.zoom', 'RIGHTMOUSE', 'PRESS', alt=True)
-kmi = km.items.new('view3d.view_selected', 'NUMPAD_PERIOD', 'PRESS')
-kmi = km.items.new('view3d.view_center_cursor', 'NUMPAD_PERIOD', 'PRESS', ctrl=True)
-kmi = km.items.new('view3d.fly', 'F', 'PRESS', shift=True)
-kmi = km.items.new('view3d.smoothview', 'TIMER1', 'ANY', any=True)
-kmi = km.items.new('view3d.rotate', 'TRACKPADPAN', 'ANY', alt=True)
-kmi = km.items.new('view3d.rotate', 'MOUSEROTATE', 'ANY')
-kmi = km.items.new('view3d.move', 'TRACKPADPAN', 'ANY')
-kmi = km.items.new('view3d.zoom', 'TRACKPADZOOM', 'ANY')
-kmi = km.items.new('view3d.zoom', 'NUMPAD_PLUS', 'PRESS')
-kmi.properties.delta = 1
-kmi = km.items.new('view3d.zoom', 'NUMPAD_MINUS', 'PRESS')
-kmi.properties.delta = -1
-kmi = km.items.new('view3d.zoom', 'EQUAL', 'PRESS', ctrl=True)
-kmi.properties.delta = 1
-kmi = km.items.new('view3d.zoom', 'MINUS', 'PRESS', ctrl=True)
-kmi.properties.delta = -1
-kmi = km.items.new('view3d.zoom', 'WHEELINMOUSE', 'PRESS')
-kmi.properties.delta = 1
-kmi = km.items.new('view3d.zoom', 'WHEELOUTMOUSE', 'PRESS')
-kmi.properties.delta = -1
-kmi = km.items.new('view3d.view_all', 'HOME', 'PRESS')
-kmi.properties.center = False
-kmi = km.items.new('view3d.view_all', 'C', 'PRESS', shift=True)
-kmi.properties.center = True
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_0', 'PRESS')
-kmi.properties.type = 'CAMERA'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS')
-kmi.properties.type = 'FRONT'
-kmi = km.items.new('view3d.view_orbit', 'NUMPAD_2', 'PRESS')
-kmi.properties.type = 'ORBITDOWN'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS')
-kmi.properties.type = 'RIGHT'
-kmi = km.items.new('view3d.view_orbit', 'NUMPAD_4', 'PRESS')
-kmi.properties.type = 'ORBITLEFT'
-kmi = km.items.new('view3d.view_persportho', 'NUMPAD_5', 'PRESS')
-kmi = km.items.new('view3d.view_orbit', 'NUMPAD_6', 'PRESS')
-kmi.properties.type = 'ORBITRIGHT'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS')
-kmi.properties.type = 'TOP'
-kmi = km.items.new('view3d.view_orbit', 'NUMPAD_8', 'PRESS')
-kmi.properties.type = 'ORBITUP'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', ctrl=True)
-kmi.properties.type = 'BACK'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', ctrl=True)
-kmi.properties.type = 'LEFT'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', ctrl=True)
-kmi.properties.type = 'BOTTOM'
-kmi = km.items.new('view3d.view_pan', 'NUMPAD_2', 'PRESS', ctrl=True)
-kmi.properties.type = 'PANDOWN'
-kmi = km.items.new('view3d.view_pan', 'NUMPAD_4', 'PRESS', ctrl=True)
-kmi.properties.type = 'PANLEFT'
-kmi = km.items.new('view3d.view_pan', 'NUMPAD_6', 'PRESS', ctrl=True)
-kmi.properties.type = 'PANRIGHT'
-kmi = km.items.new('view3d.view_pan', 'NUMPAD_8', 'PRESS', ctrl=True)
-kmi.properties.type = 'PANUP'
-kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', ctrl=True)
-kmi.properties.type = 'PANRIGHT'
-kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True)
-kmi.properties.type = 'PANLEFT'
-kmi = km.items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', shift=True)
-kmi.properties.type = 'PANUP'
-kmi = km.items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', shift=True)
-kmi.properties.type = 'PANDOWN'
-kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', ctrl=True, alt=True)
-kmi.properties.type = 'ORBITLEFT'
-kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True, alt=True)
-kmi.properties.type = 'ORBITRIGHT'
-kmi = km.items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', shift=True, alt=True)
-kmi.properties.type = 'ORBITUP'
-kmi = km.items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', shift=True, alt=True)
-kmi.properties.type = 'ORBITDOWN'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True)
-kmi.properties.align_active = True
-kmi.properties.type = 'FRONT'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True)
-kmi.properties.align_active = True
-kmi.properties.type = 'RIGHT'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True)
-kmi.properties.align_active = True
-kmi.properties.type = 'TOP'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True, ctrl=True)
-kmi.properties.align_active = True
-kmi.properties.type = 'BACK'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True, ctrl=True)
-kmi.properties.align_active = True
-kmi.properties.type = 'LEFT'
-kmi = km.items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True, ctrl=True)
-kmi.properties.align_active = True
-kmi.properties.type = 'BOTTOM'
-kmi = km.items.new('view3d.localview', 'NUMPAD_SLASH', 'PRESS')
-kmi = km.items.new('view3d.layers', 'ACCENT_GRAVE', 'PRESS')
-kmi.properties.nr = 0
-kmi = km.items.new('view3d.layers', 'ONE', 'PRESS', any=True)
-kmi.properties.nr = 1
-kmi = km.items.new('view3d.layers', 'TWO', 'PRESS', any=True)
-kmi.properties.nr = 2
-kmi = km.items.new('view3d.layers', 'THREE', 'PRESS', any=True)
-kmi.properties.nr = 3
-kmi = km.items.new('view3d.layers', 'FOUR', 'PRESS', any=True)
-kmi.properties.nr = 4
-kmi = km.items.new('view3d.layers', 'FIVE', 'PRESS', any=True)
-kmi.properties.nr = 5
-kmi = km.items.new('view3d.layers', 'SIX', 'PRESS', any=True)
-kmi.properties.nr = 6
-kmi = km.items.new('view3d.layers', 'SEVEN', 'PRESS', any=True)
-kmi.properties.nr = 7
-kmi = km.items.new('view3d.layers', 'EIGHT', 'PRESS', any=True)
-kmi.properties.nr = 8
-kmi = km.items.new('view3d.layers', 'NINE', 'PRESS', any=True)
-kmi.properties.nr = 9
-kmi = km.items.new('view3d.layers', 'ZERO', 'PRESS', any=True)
-kmi.properties.nr = 10
-kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS')
-kmi.properties.data_path = 'space_data.viewport_shade'
-kmi.properties.value_1 = 'SOLID'
-kmi.properties.value_2 = 'WIREFRAME'
-kmi = km.items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
-kmi.properties.data_path = 'space_data.viewport_shade'
-kmi.properties.value_1 = 'TEXTURED'
-kmi.properties.value_2 = 'SOLID'
-kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS')
-kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True)
-kmi.properties.extend = True
-kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
-kmi.properties.center = True
-kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True)
-kmi.properties.enumerate = True
-kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
-kmi.properties.center = True
-kmi.properties.extend = True
-kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
-kmi.properties.center = True
-kmi.properties.enumerate = True
-kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
-kmi.properties.enumerate = True
-kmi.properties.extend = True
-kmi = km.items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
-kmi.properties.center = True
-kmi.properties.enumerate = True
-kmi.properties.extend = True
-kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY')
-kmi.properties.extend = False
-kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
-kmi = km.items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
-kmi.properties.deselect = True
-kmi = km.items.new('view3d.select_circle', 'C', 'PRESS')
-kmi = km.items.new('view3d.clip_border', 'B', 'PRESS', alt=True)
-kmi = km.items.new('view3d.zoom_border', 'B', 'PRESS', shift=True)
-kmi = km.items.new('view3d.render_border', 'B', 'PRESS', shift=True)
-kmi = km.items.new('view3d.camera_to_view', 'NUMPAD_0', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.new('view3d.object_as_camera', 'NUMPAD_0', 'PRESS', ctrl=True)
-kmi = km.items.new('wm.call_menu', 'S', 'PRESS', shift=True)
-kmi.properties.name = 'VIEW3D_MT_snap'
-kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS')
-kmi.properties.data_path = 'space_data.pivot_point'
-kmi.properties.value = 'BOUNDING_BOX_CENTER'
-kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
-kmi.properties.data_path = 'space_data.pivot_point'
-kmi.properties.value = 'MEDIAN_POINT'
-kmi = km.items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
-kmi.properties.data_path = 'space_data.use_pivot_point_align'
-kmi = km.items.new('wm.context_toggle', 'Q', 'PRESS')
-kmi.properties.data_path = 'space_data.show_manipulator'
-kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
-kmi.properties.data_path = 'space_data.pivot_point'
-kmi.properties.value = 'CURSOR'
-kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True)
-kmi.properties.data_path = 'space_data.pivot_point'
-kmi.properties.value = 'INDIVIDUAL_ORIGINS'
-kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS', alt=True)
-kmi.properties.data_path = 'space_data.pivot_point'
-kmi.properties.value = 'ACTIVE_ELEMENT'
-kmi = km.items.new('transform.translate', 'G', 'PRESS', shift=True)
-kmi = km.items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
-kmi = km.items.new('transform.rotate', 'R', 'PRESS', shift=True)
-kmi = km.items.new('transform.resize', 'S', 'PRESS', shift=True)
-kmi = km.items.new('transform.warp', 'W', 'PRESS', shift=True)
-kmi = km.items.new('transform.tosphere', 'S', 'PRESS', shift=True, alt=True)
-kmi = km.items.new('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True)
-kmi = km.items.new('transform.select_orientation', 'SPACE', 'PRESS', alt=True)
-kmi = km.items.new('transform.create_orientation', 'SPACE', 'PRESS', ctrl=True, alt=True)
-kmi.properties.use = True
-kmi = km.items.new('transform.mirror', 'M', 'PRESS', ctrl=True)
-kmi = km.items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True)
-kmi.properties.data_path = 'tool_settings.use_snap'
-kmi = km.items.new('transform.snap_type', 'TAB', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.new('view3d.enable_manipulator', 'W', 'PRESS')
-kmi.properties.translate = True
-kmi = km.items.new('view3d.enable_manipulator', 'E', 'PRESS')
-kmi.properties.rotate = True
-kmi = km.items.new('view3d.enable_manipulator', 'R', 'PRESS')
-kmi.properties.scale = True
-kmi = km.items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY', shift=True)
-kmi.properties.extend = True
-
-# Map Object Mode
-km = kc.keymaps.new('Object Mode', space_type='EMPTY', region_type='WINDOW', modal=False)
-
-kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
-kmi.properties.data_path = 'tool_settings.proportional_edit_falloff'
-kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS')
-kmi.properties.data_path = 'tool_settings.proportional_edit'
-kmi.properties.value_1 = 'DISABLED'
-kmi.properties.value_2 = 'ENABLED'
-kmi = km.items.new('view3d.game_start', 'P', 'PRESS')
-kmi = km.items.new('object.select_all', 'A', 'PRESS')
-kmi = km.items.new('object.select_inverse', 'I', 'PRESS', ctrl=True)
-kmi = km.items.new('object.select_linked', 'L', 'PRESS', shift=True)
-kmi = km.items.new('object.select_grouped', 'G', 'PRESS', shift=True)
-kmi = km.items.new('object.select_mirror', 'M', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS')
-kmi.properties.direction = 'PARENT'
-kmi = km.items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS', shift=True)
-kmi.properties.direction = 'PARENT'
-kmi.properties.extend = True
-kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS')
-kmi.properties.direction = 'CHILD'
-kmi = km.items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS', shift=True)
-kmi.properties.direction = 'CHILD'
-kmi.properties.extend = True
-kmi = km.items.new('object.parent_set', 'P', 'PRESS', ctrl=True)
-kmi = km.items.new('object.parent_no_inverse_set', 'P', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.new('object.parent_clear', 'P', 'PRESS', alt=True)
-kmi = km.items.new('object.track_set', 'T', 'PRESS', ctrl=True)
-kmi = km.items.new('object.track_clear', 'T', 'PRESS', alt=True)
-kmi = km.items.new('object.constraint_add_with_targets', 'C', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.new('object.constraints_clear', 'C', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.new('object.location_clear', 'G', 'PRESS', alt=True)
-kmi = km.items.new('object.rotation_clear', 'R', 'PRESS', alt=True)
-kmi = km.items.new('object.scale_clear', 'S', 'PRESS', alt=True)
-kmi = km.items.new('object.origin_clear', 'O', 'PRESS', alt=True)
-kmi = km.items.new('object.hide_view_clear', 'H', 'PRESS', alt=True)
-kmi = km.items.new('object.hide_view_set', 'H', 'PRESS')
-kmi = km.items.new('object.hide_view_set', 'H', 'PRESS', shift=True)
-kmi.properties.unselected = True
-kmi = km.items.new('object.move_to_layer', 'M', 'PRESS')
-kmi = km.items.new('object.delete', 'X', 'PRESS')
-kmi = km.items.new('object.delete', 'DEL', 'PRESS')
-kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True)
-kmi.properties.name = 'INFO_MT_add'
-kmi = km.items.new('object.duplicates_make_real', 'A', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.new('wm.call_menu', 'A', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_object_apply'
-kmi = km.items.new('wm.call_menu', 'U', 'PRESS')
-kmi.properties.name = 'VIEW3D_MT_make_single_user'
-kmi = km.items.new('wm.call_menu', 'L', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_make_links'
-kmi = km.items.new('object.duplicate_move', 'D', 'PRESS', shift=True)
-kmi = km.items.new('object.duplicate_move_linked', 'D', 'PRESS', alt=True)
-kmi = km.items.new('object.join', 'J', 'PRESS', ctrl=True)
-kmi = km.items.new('object.convert', 'C', 'PRESS', alt=True)
-kmi = km.items.new('object.proxy_make', 'P', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.new('object.make_local', 'L', 'PRESS')
-kmi = km.items.new('anim.keyframe_insert_menu', 'I', 'PRESS')
-kmi = km.items.new('anim.keyframe_delete_v3d', 'I', 'PRESS', alt=True)
-kmi = km.items.new('anim.keying_set_active_set', 'I', 'PRESS', shift=True, ctrl=True, alt=True)
-kmi = km.items.new('group.create', 'G', 'PRESS', ctrl=True)
-kmi = km.items.new('group.objects_remove', 'G', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.new('group.objects_add_active', 'G', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.new('group.objects_remove_active', 'G', 'PRESS', shift=True, alt=True)
-kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_object_specials'
-kmi = km.items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
-kmi.properties.level = 0
-kmi = km.items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
-kmi.properties.level = 1
-kmi = km.items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True)
-kmi.properties.level = 2
-kmi = km.items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True)
-kmi.properties.level = 3
-kmi = km.items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
-kmi.properties.level = 4
-kmi = km.items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
-kmi.properties.level = 5
-kmi = km.items.new('object.select_all', 'SELECTMOUSE', 'CLICK')
-kmi.properties.action = 'DESELECT'
-
-# Map Mesh
-km = kc.keymaps.new('Mesh', space_type='EMPTY', region_type='WINDOW', modal=False)
-
-kmi = km.items.new('mesh.loopcut_slide', 'R', 'PRESS', ctrl=True)
-kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
-kmi.properties.extend = True
-kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
-kmi.properties.extend = True
-kmi = km.items.new('mesh.select_shortest_path', 'SELECTMOUSE', 'PRESS', ctrl=True)
-kmi = km.items.new('mesh.select_all', 'A', 'PRESS')
-kmi = km.items.new('mesh.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
-kmi = km.items.new('mesh.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
-kmi = km.items.new('mesh.select_inverse', 'I', 'PRESS', ctrl=True)
-kmi = km.items.new('mesh.select_non_manifold', 'M', 'PRESS', shift=True, ctrl=True, alt=True)
-kmi = km.items.new('mesh.select_linked', 'L', 'PRESS', ctrl=True)
-kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS')
-kmi = km.items.new('mesh.select_linked_pick', 'L', 'PRESS', shift=True)
-kmi.properties.deselect = True
-kmi = km.items.new('mesh.faces_select_linked_flat', 'F', 'PRESS', shift=True, ctrl=True, alt=True)
-kmi.properties.sharpness = 135.0
-kmi = km.items.new('mesh.select_similar', 'G', 'PRESS', shift=True)
-kmi = km.items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_edit_mesh_selection_mode'
-kmi = km.items.new('mesh.hide', 'H', 'PRESS')
-kmi = km.items.new('mesh.hide', 'H', 'PRESS', shift=True)
-kmi.properties.unselected = True
-kmi = km.items.new('mesh.reveal', 'H', 'PRESS', alt=True)
-kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', ctrl=True)
-kmi = km.items.new('mesh.normals_make_consistent', 'N', 'PRESS', shift=True, ctrl=True)
-kmi.properties.inside = True
-kmi = km.items.new('view3d.edit_mesh_extrude_move_normal', 'E', 'PRESS', ctrl=True)
-kmi = km.items.new('view3d.edit_mesh_extrude_individual_move', 'E', 'PRESS', shift=True)
-kmi = km.items.new('wm.call_menu', 'E', 'PRESS', alt=True)
-kmi.properties.name = 'VIEW3D_MT_edit_mesh_extrude'
-kmi = km.items.new('mesh.spin', 'R', 'PRESS', alt=True)
-kmi = km.items.new('mesh.fill', 'F', 'PRESS', alt=True)
-kmi = km.items.new('mesh.beautify_fill', 'F', 'PRESS', shift=True, alt=True)
-kmi = km.items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', ctrl=True)
-kmi = km.items.new('mesh.tris_convert_to_quads', 'J', 'PRESS', alt=True)
-kmi = km.items.new('mesh.edge_flip', 'F', 'PRESS', shift=True, ctrl=True)
-kmi = km.items.new('mesh.rip_move', 'V', 'PRESS')
-kmi = km.items.new('mesh.merge', 'M', 'PRESS', alt=True)
-kmi = km.items.new('transform.shrink_fatten', 'S', 'PRESS', ctrl=True, alt=True)
-kmi = km.items.new('mesh.edge_face_add', 'F', 'PRESS')
-kmi = km.items.new('mesh.duplicate_move', 'D', 'PRESS', shift=True)
-kmi = km.items.new('wm.call_menu', 'A', 'PRESS', shift=True)
-kmi.properties.name = 'INFO_MT_mesh_add'
-kmi = km.items.new('mesh.separate', 'P', 'PRESS')
-kmi = km.items.new('mesh.split', 'Y', 'PRESS')
-kmi = km.items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True)
-kmi = km.items.new('mesh.delete', 'X', 'PRESS')
-kmi = km.items.new('mesh.delete', 'DEL', 'PRESS')
-kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', key_modifier='K')
-kmi = km.items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='K')
-kmi.properties.type = 'MIDPOINTS'
-kmi = km.items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True)
-kmi = km.items.new('wm.call_menu', 'W', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_edit_mesh_specials'
-kmi = km.items.new('wm.call_menu', 'F', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_edit_mesh_faces'
-kmi = km.items.new('wm.call_menu', 'E', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_edit_mesh_edges'
-kmi = km.items.new('wm.call_menu', 'V', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_edit_mesh_vertices'
-kmi = km.items.new('wm.call_menu', 'H', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_hook'
-kmi = km.items.new('wm.call_menu', 'U', 'PRESS')
-kmi.properties.name = 'VIEW3D_MT_uv_map'
-kmi = km.items.new('wm.call_menu', 'G', 'PRESS', ctrl=True)
-kmi.properties.name = 'VIEW3D_MT_vertex_group'
-kmi = km.items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
-kmi.properties.data_path = 'tool_settings.proportional_edit_falloff'
-kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS')
-kmi.properties.data_path = 'tool_settings.proportional_edit'
-kmi.properties.value_1 = 'DISABLED'
-kmi.properties.value_2 = 'ENABLED'
-kmi = km.items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
-kmi.properties.data_path = 'tool_settings.proportional_edit'
-kmi.properties.value_1 = 'DISABLED'
-kmi.properties.value_2 = 'CONNECTED'
-kmi = km.items.new('mesh.select_all', 'SELECTMOUSE', 'CLICK')
-kmi.properties.action = 'DESELECT'
-
-wm.keyconfigs.active = kc
-
-bpy.context.user_preferences.edit.use_drag_immediately = True
-bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
-bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
-bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
-bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL'
-bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE'
-bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = True
diff --git a/release/scripts/presets/render/HDV_1080p.py b/release/scripts/presets/render/HDV_1080p.py
index 7637648e53a..3ba32135c1d 100644
--- a/release/scripts/presets/render/HDV_1080p.py
+++ b/release/scripts/presets/render/HDV_1080p.py
@@ -5,4 +5,4 @@ bpy.context.scene.render.resolution_percentage = 100
bpy.context.scene.render.pixel_aspect_x = 4
bpy.context.scene.render.pixel_aspect_y = 3
bpy.context.scene.render.fps = 24
-bpy.context.scene.render.fps_base = 1
+bpy.context.scene.render.fps_base = 1.001
diff --git a/release/scripts/presets/render/HDV_NTSC_1080p.py b/release/scripts/presets/render/HDV_NTSC_1080p.py
new file mode 100644
index 00000000000..2dfa1e0fd1e
--- /dev/null
+++ b/release/scripts/presets/render/HDV_NTSC_1080p.py
@@ -0,0 +1,8 @@
+import bpy
+bpy.context.scene.render.resolution_x = 1440
+bpy.context.scene.render.resolution_y = 1080
+bpy.context.scene.render.resolution_percentage = 100
+bpy.context.scene.render.pixel_aspect_x = 4
+bpy.context.scene.render.pixel_aspect_y = 3
+bpy.context.scene.render.fps = 30
+bpy.context.scene.render.fps_base = 1.001
diff --git a/release/scripts/presets/render/HDV_PAL_1080p.py b/release/scripts/presets/render/HDV_PAL_1080p.py
new file mode 100644
index 00000000000..d8b1c707607
--- /dev/null
+++ b/release/scripts/presets/render/HDV_PAL_1080p.py
@@ -0,0 +1,8 @@
+import bpy
+bpy.context.scene.render.resolution_x = 1440
+bpy.context.scene.render.resolution_y = 1080
+bpy.context.scene.render.resolution_percentage = 100
+bpy.context.scene.render.pixel_aspect_x = 4
+bpy.context.scene.render.pixel_aspect_y = 3
+bpy.context.scene.render.fps = 25
+bpy.context.scene.render.fps_base = 1
diff --git a/release/scripts/templates/gamelogic.py b/release/scripts/templates/gamelogic.py
index 21a901c091b..0a419955b81 100644
--- a/release/scripts/templates/gamelogic.py
+++ b/release/scripts/templates/gamelogic.py
@@ -1,10 +1,7 @@
# This script must be assigned to a python controller
# where it can access the object that owns it and the sensors/actuators that it connects to.
-# GameLogic has been added to the global namespace no need to import
-
-# for keyboard event comparison
-# import GameKeys
+import bge
# support for Vector(), Matrix() types and advanced functions like Matrix.Scale(...) and Matrix.Rotation(...)
# import mathutils
@@ -13,7 +10,7 @@
# import Rasterizer
def main():
- cont = GameLogic.getCurrentController()
+ cont = bge.logic.getCurrentController()
# The KX_GameObject that owns this controller.
own = cont.owner
@@ -57,7 +54,7 @@ def main():
# Loop through all other objects in the scene
- sce = GameLogic.getCurrentScene()
+ sce = bge.logic.getCurrentScene()
print('Scene Objects:', sce.name)
for ob in sce.objects:
print(' ', ob.name, ob.worldPosition)
diff --git a/release/scripts/templates/gamelogic_basic.py b/release/scripts/templates/gamelogic_basic.py
index 5e7d19672fe..c5578a0add9 100644
--- a/release/scripts/templates/gamelogic_basic.py
+++ b/release/scripts/templates/gamelogic_basic.py
@@ -1,7 +1,8 @@
+import bge
def main():
- cont = GameLogic.getCurrentController()
+ cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['mySensor']
diff --git a/release/scripts/templates/gamelogic_module.py b/release/scripts/templates/gamelogic_module.py
index 5a61a3592dc..70bd4d9b45b 100644
--- a/release/scripts/templates/gamelogic_module.py
+++ b/release/scripts/templates/gamelogic_module.py
@@ -5,7 +5,7 @@
# * External text modules are supported as long as they are at
# the same location as the blendfile or one of its libraries.
-import GameLogic
+import bge
# variables defined here will only be set once when the
# module is first imported. Set object spesific vars
@@ -23,4 +23,4 @@ def main(cont):
else:
cont.deactivate(actu)
-# dont call main(GameLogic.getCurrentController()), the py controller will
+# dont call main(bge.logic.getCurrentController()), the py controller will
diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py
index f7961821277..6453ea9e038 100644
--- a/release/scripts/ui/properties_data_armature_rigify.py
+++ b/release/scripts/ui/properties_data_armature_rigify.py
@@ -211,14 +211,23 @@ class Graph(bpy.types.Operator):
import bpy
reload(graphviz_export)
obj = bpy.context.object
- path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name)
+ if(bpy.data.filepath):
+ path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name)
+ else:
+ import tempfile
+ path = tempfile.mktemp(prefix=bpy.app.tempdir) + "-" + bpy.path.clean_name(obj.name)
path_dot = path + ".dot"
path_png = path + ".png"
saved = graphviz_export.graph_armature(bpy.context.object, path_dot, CONSTRAINTS=False, DRIVERS=False)
if saved:
# if we seriously want this working everywhere we'll need some new approach
- os.system("dot -Tpng %s > %s; gnome-open %s &" % (path_dot, path_png, path_png))
+ os.system("dot -Tpng %r > %r" % (path_dot, path_png))
+ if not os.path.exists(path_png) or os.stat(path_png)[6] == 0:
+ self.report('ERROR', "Graphvis could not create %r check graphviz is installed" % path_png)
+ return {'CANCELLED'}
+
+ bpy.ops.image.external_edit(filepath=path_png)
#os.system("python /b/xdot.py '%s' &" % path_dot)
return {'FINISHED'}
diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py
index 3af0d6a33ac..c098101622e 100644
--- a/release/scripts/ui/properties_data_mesh.py
+++ b/release/scripts/ui/properties_data_mesh.py
@@ -182,7 +182,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
enable_edit = ob.mode != 'EDIT'
enable_edit_value = False
- if ob.show_shape_key is False:
+ if ob.show_only_shape_key is False:
if enable_edit or (ob.type == 'MESH' and ob.use_shape_key_edit_mode):
enable_edit_value = True
@@ -218,7 +218,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
sub = row.row(align=True)
subsub = sub.row(align=True)
subsub.active = enable_edit_value
- subsub.prop(ob, "show_shape_key", text="")
+ subsub.prop(ob, "show_only_shape_key", text="")
subsub.prop(kb, "mute", text="")
sub.prop(ob, "use_shape_key_edit_mode", text="")
diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py
index dd242723cac..2532a99b402 100644
--- a/release/scripts/ui/properties_object.py
+++ b/release/scripts/ui/properties_object.py
@@ -68,6 +68,31 @@ class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
row.column().prop(ob, "scale")
layout.prop(ob, "rotation_mode")
+
+class OBJECT_PT_delta_transform(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = "Delta Transform"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ row = layout.row()
+
+ row.column().prop(ob, "delta_location")
+ if ob.rotation_mode == 'QUATERNION':
+ row.column().prop(ob, "delta_rotation_quaternion", text="Rotation")
+ elif ob.rotation_mode == 'AXIS_ANGLE':
+ #row.column().label(text="Rotation")
+ #row.column().prop(pchan, "delta_rotation_angle", text="Angle")
+ #row.column().prop(pchan, "delta_rotation_axis", text="Axis")
+ #row.column().prop(ob, "delta_rotation_axis_angle", text="Rotation")
+ row.column().label(ob, text="Not for Axis-Angle")
+ else:
+ row.column().prop(ob, "delta_rotation_euler", text="Rotation")
+
+ row.column().prop(ob, "delta_scale")
class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
@@ -251,9 +276,6 @@ class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
col.label(text="Time Offset:")
col.prop(ob, "use_time_offset_edit", text="Edit")
row = col.row()
- row.prop(ob, "use_time_offset_particle", text="Particle")
- row.active = bool(ob.particle_systems)
- row = col.row()
row.prop(ob, "use_time_offset_parent", text="Parent")
row.active = (ob.parent is not None)
row = col.row()
diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py
index 7f630d6e5ff..ff49b0e4e9f 100644
--- a/release/scripts/ui/properties_particle.py
+++ b/release/scripts/ui/properties_particle.py
@@ -28,12 +28,10 @@ from properties_physics_common import basic_force_field_falloff_ui
def particle_panel_enabled(context, psys):
phystype = psys.settings.physics_type
- if phystype == 'NO' or phystype == 'KEYED':
+ if psys.settings.type in ('EMITTER', 'REACTOR') and phystype in ('NO', 'KEYED'):
return True
- if psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.use_hair_dynamics):
- return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
else:
- return True
+ return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
def particle_panel_poll(cls, context):
diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py
index dba9ff44d51..44f1223aa93 100644
--- a/release/scripts/ui/properties_render.py
+++ b/release/scripts/ui/properties_render.py
@@ -84,10 +84,11 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
+ row = layout.row()
rl = rd.layers.active
-
if rl:
- layout.prop(rl, "name")
+ row.prop(rl, "name")
+ row.prop(rd, "use_single_layer", text="", icon_only=True)
split = layout.split()
diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py
index 295078dc1a5..bc59a3259c5 100644
--- a/release/scripts/ui/properties_texture.py
+++ b/release/scripts/ui/properties_texture.py
@@ -865,10 +865,11 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel):
layout.template_image(tex, "image", tex.image_user, compact=True)
#layout.prop(vd, "frame_duration")
- layout.prop(vd, "use_still_frame")
- row = layout.row()
- row.active = vd.use_still_frame
- row.prop(vd, "still_frame")
+ if vd.file_format in ('BLENDER_VOXEL', 'RAW_8BIT'):
+ layout.prop(vd, "use_still_frame")
+ row = layout.row()
+ row.active = vd.use_still_frame
+ row.prop(vd, "still_frame")
layout.prop(vd, "interpolation")
layout.prop(vd, "extension")
diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py
index d2e5046c816..d46220ad7b9 100644
--- a/release/scripts/ui/space_image.py
+++ b/release/scripts/ui/space_image.py
@@ -250,6 +250,47 @@ class IMAGE_MT_uvs(bpy.types.Menu):
layout.separator()
layout.menu("IMAGE_MT_uvs_showhide")
+
+class IMAGE_MT_uvs_select_mode(bpy.types.Menu):
+ bl_label = "UV Select Mode"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ toolsettings = context.tool_settings
+
+ # do smart things depending on whether uv_select_sync is on
+
+ if toolsettings.use_uv_select_sync:
+ prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
+ prop.value = "(True, False, False)"
+ prop.data_path = "tool_settings.mesh_select_mode"
+
+ prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
+ prop.value = "(False, True, False)"
+ prop.data_path = "tool_settings.mesh_select_mode"
+
+ prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
+ prop.value = "(False, False, True)"
+ prop.data_path = "tool_settings.mesh_select_mode"
+
+ else:
+ prop = layout.operator("wm.context_set_string", text="Vertex", icon='UV_VERTEXSEL')
+ prop.value = "VERTEX"
+ prop.data_path = "tool_settings.uv_select_mode"
+
+ prop = layout.operator("wm.context_set_string", text="Edge", icon='UV_EDGESEL')
+ prop.value = "EDGE"
+ prop.data_path = "tool_settings.uv_select_mode"
+
+ prop = layout.operator("wm.context_set_string", text="Face", icon='UV_FACESEL')
+ prop.value = "FACE"
+ prop.data_path = "tool_settings.uv_select_mode"
+
+ prop = layout.operator("wm.context_set_string", text="Island", icon='UV_ISLANDSEL')
+ prop.value = "ISLAND"
+ prop.data_path = "tool_settings.uv_select_mode"
class IMAGE_HT_header(bpy.types.Header):
diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py
index fb700104b14..d9ddc4a470b 100644
--- a/release/scripts/ui/space_info.py
+++ b/release/scripts/ui/space_info.py
@@ -119,7 +119,7 @@ class INFO_MT_file(bpy.types.Menu):
layout.separator()
layout.operator_context = 'EXEC_AREA'
- layout.operator("wm.exit_blender", text="Quit", icon='QUIT')
+ layout.operator("wm.quit_blender", text="Quit", icon='QUIT')
class INFO_MT_file_import(bpy.types.Menu):
@@ -219,6 +219,18 @@ class INFO_MT_surface_add(bpy.types.Menu):
layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
+class INFO_MT_curve_handle_type_set(bpy.types.Menu):
+ bl_idname = "INFO_MT_curve_handle_type_set"
+ bl_label = "Handle Type"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("curve.handle_type_set", text="Automatic").type = "AUTOMATIC"
+ layout.operator("curve.handle_type_set", text="Vector").type = "VECTOR"
+ layout.operator("curve.handle_type_set", text="Align").type = "ALIGN"
+ layout.operator("curve.handle_type_set", text="Free Align").type = "FREE_ALIGN"
+
class INFO_MT_armature_add(bpy.types.Menu):
bl_idname = "INFO_MT_armature_add"
@@ -333,7 +345,11 @@ class INFO_MT_help(bpy.types.Menu):
layout.separator()
layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = "http://www.blender.org/documentation/blender_python_api_%s/contents.html" % "_".join(str(v) for v in bpy.app.version)
layout.operator("help.operator_cheat_sheet", icon='TEXT')
+ layout.operator("wm.sysinfo", icon='TEXT')
layout.separator()
+ if bpy.app.build_platform[0:7] == 'Windows':
+ layout.operator("wm.toggle_console", icon='CONSOLE')
+ layout.separator()
layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP')
layout.separator()
layout.operator("wm.splash")
@@ -354,7 +370,7 @@ class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
for op_submodule_name in dir(op_module):
op = getattr(op_module, op_submodule_name)
text = repr(op)
- if text.startswith('bpy.ops.'):
+ if text.split("\n")[-1].startswith('bpy.ops.'):
op_strings.append(text)
tot += 1
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index f601b255510..40bb5bc4b55 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -127,7 +127,11 @@ class USERPREF_MT_splash(bpy.types.Menu):
row.label("")
row = split.row()
row.label("Interaction:")
- row.menu("USERPREF_MT_interaction_presets", text=bpy.types.USERPREF_MT_interaction_presets.bl_label)
+ # XXX, no redraws
+ # text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
+ # if not text:
+ # text = "Blender (default)"
+ row.menu("USERPREF_MT_keyconfigs", text="Preset")
class USERPREF_PT_interface(bpy.types.Panel):
diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py
index 0cdebd4734c..70fb2c57e9b 100644
--- a/release/scripts/ui/space_userpref_keymap.py
+++ b/release/scripts/ui/space_userpref_keymap.py
@@ -124,7 +124,7 @@ def _merge_keymaps(kc1, kc2):
return merged_keymaps
-class PREFS_MT_keyconfigs(bpy.types.Menu):
+class USERPREF_MT_keyconfigs(bpy.types.Menu):
bl_label = "KeyPresets"
preset_subdir = "keyconfig"
preset_operator = "wm.keyconfig_activate"
@@ -384,7 +384,7 @@ class InputKeyMapPanel(bpy.types.Panel):
text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
if not text:
text = "Blender (default)"
- row.menu("PREFS_MT_keyconfigs", text=text)
+ row.menu("USERPREF_MT_keyconfigs", text=text)
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMIN")
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMOUT").remove_active = True
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py
index 7df932f6800..79de93c26e9 100644
--- a/release/scripts/ui/space_view3d.py
+++ b/release/scripts/ui/space_view3d.py
@@ -1393,7 +1393,7 @@ class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
layout.operator("mesh.select_vertex_path")
-class VIEW3D_MT_edit_mesh_selection_mode(bpy.types.Menu):
+class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu):
bl_label = "Mesh Select Mode"
def draw(self, context):
@@ -1417,82 +1417,35 @@ class VIEW3D_MT_edit_mesh_selection_mode(bpy.types.Menu):
class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
bl_label = "Extrude"
+ _extrude_funcs = { \
+ "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
+ "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
+ "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
+ "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
+ }
+
@staticmethod
def extrude_options(context):
mesh = context.object.data
- selection_mode = context.tool_settings.mesh_select_mode
-
- totface = mesh.total_face_sel
- totedge = mesh.total_edge_sel
- totvert = mesh.total_vert_sel
+ select_mode = context.tool_settings.mesh_select_mode
- # the following is dependent on selection modes
- # we don't really want that
-# if selection_mode[0]: # vert
-# if totvert == 0:
-# return ()
-# elif totvert == 1:
-# return (3,)
-# elif totedge == 0:
-# return (3,)
-# elif totface == 0:
-# return (2, 3)
-# elif totface == 1:
-# return (0, 2, 3)
-# else:
-# return (0, 1, 2, 3)
-# elif selection_mode[1]: # edge
-# if totedge == 0:
-# return ()
-# elif totedge == 1:
-# return (2,)
-# elif totface == 0:
-# return (2,)
-# elif totface == 1:
-# return (0, 2)
-# else:
-# return (0, 1, 2)
-# elif selection_mode[2]: # face
-# if totface == 0:
-# return ()
-# elif totface == 1:
-# return (0,)
-# else:
-# return (0, 1)
-
- if totvert == 0:
- return ()
- elif totedge == 0:
- return (0, 3)
- elif totface == 0:
- return (0, 2, 3)
- else:
- return (0, 1, 2, 3)
+ menu = []
+ if mesh.total_face_sel:
+ menu += ["REGION", "FACE"]
+ if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
+ menu += ["EDGE"]
+ if mesh.total_vert_sel and select_mode[0]:
+ menu += ["VERT"]
# should never get here
- return ()
+ return menu
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
- def region_menu():
- layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region")
-
- def face_menu():
- layout.operator("mesh.extrude_faces_move", text="Individual Faces")
-
- def edge_menu():
- layout.operator("mesh.extrude_edges_move", text="Edges Only")
-
- def vert_menu():
- layout.operator("mesh.extrude_vertices_move", text="Vertices Only")
-
- menu_funcs = region_menu, face_menu, edge_menu, vert_menu
-
- for i in self.extrude_options(context):
- func = menu_funcs[i]
- func()
+ for menu_id in self.extrude_options(context):
+ self._extrude_funcs[menu_id](layout)
class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
@@ -1502,17 +1455,17 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
def execute(self, context):
mesh = context.object.data
- selection_mode = context.tool_settings.mesh_select_mode
+ select_mode = context.tool_settings.mesh_select_mode
totface = mesh.total_face_sel
totedge = mesh.total_edge_sel
totvert = mesh.total_vert_sel
- if selection_mode[2] and totface == 1:
+ if select_mode[2] and totface == 1:
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [False, False, True]})
- elif selection_mode[2] and totface > 1:
+ elif select_mode[2] and totface > 1:
return bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
- elif selection_mode[1] and totedge >= 1:
+ elif select_mode[1] and totedge >= 1:
return bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
else:
return bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
@@ -1926,7 +1879,7 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu):
layout.separator()
- layout.operator("armature.subdivide_multi", text="Subdivide")
+ layout.operator("armature.subdivide", text="Subdivide")
layout.operator("armature.switch_direction", text="Switch Direction")
layout.separator()
@@ -1960,7 +1913,7 @@ class VIEW3D_MT_armature_specials(bpy.types.Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator("armature.subdivide_multi", text="Subdivide")
+ layout.operator("armature.subdivide", text="Subdivide")
layout.operator("armature.switch_direction", text="Switch Direction")
layout.separator()
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py
index ec6f8ed1f3f..6b140591418 100644
--- a/release/scripts/ui/space_view3d_toolbar.py
+++ b/release/scripts/ui/space_view3d_toolbar.py
@@ -311,7 +311,7 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel):
col = layout.column(align=True)
col.label(text="Modeling:")
col.operator("armature.extrude_move")
- col.operator("armature.subdivide_multi", text="Subdivide")
+ col.operator("armature.subdivide", text="Subdivide")
col = layout.column(align=True)
col.label(text="Repeat:")
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 96d1ce3e8b2..7f4ed753956 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -24,23 +24,23 @@
#
# ***** END GPL LICENSE BLOCK *****
-ADD_SUBDIRECTORY(windowmanager)
ADD_SUBDIRECTORY(editors)
-ADD_SUBDIRECTORY(avi)
-ADD_SUBDIRECTORY(nodes)
+ADD_SUBDIRECTORY(windowmanager)
ADD_SUBDIRECTORY(blenkernel)
-ADD_SUBDIRECTORY(modifiers)
ADD_SUBDIRECTORY(blenlib)
+ADD_SUBDIRECTORY(render)
+ADD_SUBDIRECTORY(blenfont)
ADD_SUBDIRECTORY(blenloader)
+ADD_SUBDIRECTORY(readblenfile)
ADD_SUBDIRECTORY(blenpluginapi)
-ADD_SUBDIRECTORY(imbuf)
+ADD_SUBDIRECTORY(ikplugin)
ADD_SUBDIRECTORY(gpu)
+ADD_SUBDIRECTORY(imbuf)
+ADD_SUBDIRECTORY(avi)
+ADD_SUBDIRECTORY(nodes)
+ADD_SUBDIRECTORY(modifiers)
ADD_SUBDIRECTORY(makesdna)
ADD_SUBDIRECTORY(makesrna)
-ADD_SUBDIRECTORY(readblenfile)
-ADD_SUBDIRECTORY(render)
-ADD_SUBDIRECTORY(blenfont)
-ADD_SUBDIRECTORY(ikplugin)
IF(WITH_IMAGE_OPENEXR)
ADD_SUBDIRECTORY(imbuf/intern/openexr)
diff --git a/source/blender/avi/intern/avirgb.c b/source/blender/avi/intern/avirgb.c
index f7acbf238b5..c7d411b2fc6 100644
--- a/source/blender/avi/intern/avirgb.c
+++ b/source/blender/avi/intern/avirgb.c
@@ -51,6 +51,8 @@ void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *bu
unsigned char *buf;
AviBitmapInfoHeader *bi;
short bits= 32;
+
+ (void)size; /* unused */
bi= (AviBitmapInfoHeader *) movie->streams[stream].sf;
if (bi) bits= bi->BitCount;
@@ -120,6 +122,8 @@ void *avi_converter_to_avi_rgb (AviMovie *movie, int stream, unsigned char *buff
int y, x, i, rowstride;
unsigned char *buf;
+ (void)stream; /* unused */
+
*size= movie->header->Height * movie->header->Width * 3;
if (movie->header->Width%2) *size+= movie->header->Height;
diff --git a/source/blender/avi/intern/endian.c b/source/blender/avi/intern/endian.c
index 282e26b3ee8..137c664568c 100644
--- a/source/blender/avi/intern/endian.c
+++ b/source/blender/avi/intern/endian.c
@@ -206,6 +206,8 @@ void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int t
MEM_freeN (data);
#else /* WORDS_BIGENDIAN */
+ (void)movie; /* unused */
+ (void)type; /* unused */
fwrite (datain, block, size, fp);
#endif /* WORDS_BIGENDIAN */
}
diff --git a/source/blender/avi/intern/mjpeg.c b/source/blender/avi/intern/mjpeg.c
index fd7e8aaef83..e8c96476fd1 100644
--- a/source/blender/avi/intern/mjpeg.c
+++ b/source/blender/avi/intern/mjpeg.c
@@ -144,6 +144,8 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
unsigned int y;
struct jpeg_decompress_struct dinfo;
struct jpeg_error_mgr jerr;
+
+ (void)width; /* unused */
numbytes= 0;
@@ -324,7 +326,9 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned
void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) {
int deint;
unsigned char *buf;
-
+
+ (void)stream; /* unused */
+
buf= MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_from_mjpeg 1");
deint= check_and_decode_jpeg(buffer, buf, movie->header->Width, movie->header->Height, *size);
@@ -374,10 +378,11 @@ void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer
/* Compression from memory */
static void jpegmemdestmgr_init_destination(j_compress_ptr cinfo) {
- ;
+ (void)cinfo; /* unused */
}
static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo) {
+ (void)cinfo; /* unused */
return TRUE;
}
@@ -403,7 +408,7 @@ static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, in
/* Decompression from memory */
static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) {
- ;
+ (void)dinfo;
}
static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) {
diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c
index 15ec40ade8c..bec7060e118 100644
--- a/source/blender/avi/intern/options.c
+++ b/source/blender/avi/intern/options.c
@@ -41,6 +41,8 @@
AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) {
int i;
+ (void)stream; /* unused */
+
if (movie->header->TotalFrames != 0) /* Can't change params after we have already started writing frames */
return AVI_ERROR_OPTION;
diff --git a/source/blender/avi/intern/rgb32.c b/source/blender/avi/intern/rgb32.c
index 68e3ce4d1d2..f66f57924df 100644
--- a/source/blender/avi/intern/rgb32.c
+++ b/source/blender/avi/intern/rgb32.c
@@ -41,6 +41,8 @@ void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buff
int y, x, rowstridea, rowstrideb;
unsigned char *buf;
+ (void)stream; /* unused */
+
buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromrgb32buf");
*size = movie->header->Height * movie->header->Width * 3;
@@ -65,6 +67,8 @@ void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer
unsigned char *buf;
unsigned char *to, *from;
+ (void)stream; /* unused */
+
buf= MEM_mallocN (movie->header->Height * movie->header->Width * 4, "torgb32buf");
*size= movie->header->Height * movie->header->Width * 4;
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 7054d955faf..21bf73b56d9 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -118,11 +118,13 @@ void BLF_lang_init(void)
void BLF_lang_encoding(char *str)
{
+ (void)str;
return;
}
void BLF_lang_set(char *str)
{
+ (void)str;
return;
}
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 5b3d2d7a2ed..441951da3ee 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -298,7 +298,9 @@ struct DerivedMesh {
float (*partial_redraw_planes)[4],
int (*setDrawOptions)(void *userData, int index,
int *drawSmooth_r),
- void *userData, DMDrawFlags flags);
+ void *userData,
+ int (*setMaterial)(int, void *attribs),
+ DMDrawFlags flags);
/* Draw mapped faces using MTFace
* o Drawing options too complicated to enumerate, look at code.
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index cd9f3971540..70badbc96e8 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -50,8 +50,8 @@ struct Main;
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
-int BKE_read_file(struct bContext *C, char *dir, void *type_r, struct ReportList *reports);
-int BKE_read_file_from_memory(struct bContext *C, char* filebuf, int filelength, void *type_r, struct ReportList *reports);
+int BKE_read_file(struct bContext *C, char *dir, struct ReportList *reports);
+int BKE_read_file_from_memory(struct bContext *C, char* filebuf, int filelength, struct ReportList *reports);
int BKE_read_file_from_memfile(struct bContext *C, struct MemFile *memfile, struct ReportList *reports);
void free_blender(void);
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index 034bedbb07d..e9f0304e645 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -220,7 +220,7 @@ void clmdSetInterruptCallBack ( int ( *f ) ( void ) );
// needed for modifier.c
void cloth_free_modifier_extern ( struct ClothModifierData *clmd );
-void cloth_free_modifier ( struct Object *ob, struct ClothModifierData *clmd );
+void cloth_free_modifier ( 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 );
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 9f38c5833a2..7cbaf6bdad2 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -28,13 +28,13 @@
#ifndef BKE_CONTEXT_H
#define BKE_CONTEXT_H
+#include "DNA_listBase.h"
+#include "RNA_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-#include "DNA_listBase.h"
-#include "RNA_types.h"
-
struct ARegion;
struct bScreen;
struct EditMesh;
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 0c9d4a42fdc..50e14fcbd9a 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -32,6 +32,10 @@
#ifndef BKE_CUSTOMDATA_H
#define BKE_CUSTOMDATA_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct ID;
struct CustomData;
struct CustomDataLayer;
@@ -366,4 +370,8 @@ void CustomData_external_read(struct CustomData *data,
void CustomData_external_reload(struct CustomData *data,
struct ID *id, CustomDataMask mask, int totelem);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index 0b78a1206fe..5b2dca5299c 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -28,6 +28,10 @@
#ifndef DEPSGRAPH_API
#define DEPSGRAPH_API
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
#define DEPS_DEBUG
*/
@@ -120,5 +124,9 @@ void DAG_pose_sort(struct Object *ob);
/* callback for editors module to do updates */
void DAG_editors_update_cb(void (*func)(struct Main *bmain, struct ID *id));
+
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 95e0cfc3a91..8dbfb4f2c73 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -28,6 +28,10 @@
#ifndef BKE_FCURVE_H
#define BKE_FCURVE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct FCurve;
struct FModifier;
struct ChannelDriver;
@@ -248,4 +252,8 @@ float fcurve_samplingcb_evalcurve(struct FCurve *fcu, void *data, float evaltime
*/
void fcurve_store_samples(struct FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BKE_FCURVE_H*/
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 6a602339e11..76fb5605d77 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -52,9 +52,9 @@ typedef struct Global {
struct Main *main;
/* strings: lastsaved */
- char ima[256], sce[256], lib[256];
+ char ima[256], lib[256];
- /* flag: if != 0 G.sce contains valid relative base path */
+ /* flag: if != 0 G.main->name contains valid relative base path */
int relbase_valid;
/* strings of recent opend files */
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 0a07e6d482c..b0cb3f32d37 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -112,7 +112,7 @@ struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser,
void BKE_image_release_ibuf(struct Image *ima, void *lock);
/* returns existing Image when filename/type is same (frame optional) */
-struct Image *BKE_add_image_file(const char *name, int frame);
+struct Image *BKE_add_image_file(const char *name);
/* adds image, adds ibuf, generates color or pattern */
struct Image *BKE_add_image_size(unsigned int width, unsigned int height, char *name, int depth, int floatbuf, short uvtestgrid, float color[4]);
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index e25c379ded1..b74de66f7b6 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -33,6 +33,10 @@
#ifndef BKE_LIBRARY_TYPES_H
#define BKE_LIBRARY_TYPES_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct ListBase;
struct ID;
struct Main;
@@ -85,4 +89,8 @@ void set_free_windowmanager_cb(void (*func)(struct bContext *, struct wmWindowMa
/* use when "" is given to new_id() */
#define ID_FALLBACK_NAME "Untitled"
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 60c2d51571f..1a53f488841 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -40,6 +40,10 @@
#include "DNA_listBase.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct Library;
typedef struct Main {
@@ -80,5 +84,9 @@ typedef struct Main {
} Main;
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index e80c266ff70..7e1ab138acc 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -132,8 +132,8 @@ void create_vert_edge_map(ListBase **map, IndexNode **mem, const struct MEdge *m
/* Partial Mesh Visibility */
struct PartialVisibility *mesh_pmv_copy(struct PartialVisibility *);
void mesh_pmv_free(struct PartialVisibility *);
-void mesh_pmv_revert(struct Object *ob, struct Mesh *me);
-void mesh_pmv_off(struct Object *ob, struct Mesh *me);
+void mesh_pmv_revert(struct Mesh *me);
+void mesh_pmv_off(struct Mesh *me);
/* functions for making menu's from customdata layers */
int mesh_layers_menu_charlen(struct CustomData *data, int type); /* use this to work out how many chars to allocate */
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 51120a61e69..0225a402fb8 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -315,7 +315,7 @@ int modifiers_isParticleEnabled(struct Object *ob);
struct Object *modifiers_isDeformedByArmature(struct Object *ob);
struct Object *modifiers_isDeformedByLattice(struct Object *ob);
int modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
-int modifiers_isCorrectableDeformed(struct Scene *scene, struct Object *ob);
+int modifiers_isCorrectableDeformed(struct Object *ob);
void modifier_freeTemporaryData(struct ModifierData *md);
int modifiers_indexInObject(struct Object *ob, struct ModifierData *md);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 2a7ba4f98c9..7451d43a578 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -71,7 +71,7 @@ void object_free_modifiers(struct Object *ob);
void object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob);
void object_copy_proxy_drivers(struct Object *ob, struct Object *target);
-void unlink_object(struct Scene *scene, struct Object *ob);
+void unlink_object(struct Object *ob);
int exist_object(struct Object *obtest);
void *add_camera(char *name);
struct Camera *copy_camera(struct Camera *cam);
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 96ef8d44cf4..8a49e432ebd 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -31,6 +31,10 @@
#ifndef BKE_SCENE_H
#define BKE_SCENE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct AviCodecData;
struct Base;
struct bglMats;
@@ -60,7 +64,7 @@ struct Base *object_in_scene(struct Object *ob, struct Scene *sce);
void set_scene_bg(struct Main *bmain, struct Scene *sce);
struct Scene *set_scene_name(struct Main *bmain, char *name);
-struct Scene *copy_scene(struct Main *bmain, struct Scene *sce, int type);
+struct Scene *copy_scene(struct Scene *sce, int type);
void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce);
int next_object(struct Scene **scene, int val, struct Base **base, struct Object **ob);
@@ -93,5 +97,9 @@ int get_render_child_particle_number(struct RenderData *r, int num);
int get_render_shadow_samples(struct RenderData *r, int samples);
float get_render_aosss_error(struct RenderData *r, float error);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 0766012b4a5..8cf541ae03a 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -156,7 +156,7 @@ void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, i
void calc_sequence(struct Scene *scene, struct Sequence *seq);
void calc_sequence_disp(struct Scene *scene, struct Sequence *seq);
void new_tstripdata(struct Sequence *seq);
-void reload_sequence_new_file(struct Main *bmain, struct Scene *scene, struct Sequence * seq, int lock_range);
+void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq, int lock_range);
void sort_seq(struct Scene *scene);
void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq,
int (*test_func)(struct Sequence * seq));
@@ -220,14 +220,14 @@ int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene
int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene);
int seqbase_isolated_sel_check(struct ListBase *seqbase);
void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage, int keep_file_handles);
-struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Sequence * seq, int dupe_flag);
+struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence * seq, int dupe_flag);
int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b);
void seq_update_sound(struct Scene* scene, struct Sequence *seq);
void seq_update_muting(struct Scene* scene, struct Editing *ed);
void seqbase_sound_reload(struct Scene *scene, ListBase *seqbase);
void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq);
-void seqbase_dupli_recursive(struct Scene *scene, ListBase *nseqbase, ListBase *seqbase, int dupe_flag);
+void seqbase_dupli_recursive(struct Scene *scene, struct Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag);
void clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce);
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index 269e65f508b..b6670541df0 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -31,6 +31,10 @@
#ifndef BKE_TEXTURE_H
#define BKE_TEXTURE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct bNode;
struct Brush;
struct ColorBand;
@@ -115,5 +119,9 @@ int BKE_texture_dependsOnTime(const struct Tex *texture);
void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index 5a6a151afee..8359bfdb01b 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -44,6 +44,14 @@
#define STRINGIFY_ARG(x) #x
#define STRINGIFY(x) STRINGIFY_ARG(x)
+
+
+#ifdef __GNUC__
+# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
+#else
+# define UNUSED(x) UNUSED_ ## x
+#endif
+
/* these values need to be hardcoded in structs, dna does not recognize defines */
/* also defined in DNA_space_types.h */
#ifndef FILE_MAXDIR
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index f9bc36dff1a..ead08ca9b92 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -26,7 +26,7 @@ else:
incs += ' ../python'
incs += ' ' + env['BF_PYTHON_INC']
if env['BF_DEBUG']:
- defs.append('_DEBUG')
+ defs.append('DEBUG')
if env['WITH_BF_QUICKTIME']:
incs += ' ../quicktime'
diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c
index 7d9c9a431f8..444bc10d562 100644
--- a/source/blender/blenkernel/intern/BME_tools.c
+++ b/source/blender/blenkernel/intern/BME_tools.c
@@ -107,7 +107,7 @@ float *BME_new_transdata_float(BME_TransData_Head *td) {
return BLI_memarena_alloc(td->ma, sizeof(float));
}
-static int BME_is_nonmanifold_vert(BME_Mesh *bm, BME_Vert *v) {
+static int BME_is_nonmanifold_vert(BME_Mesh *UNUSED(bm), BME_Vert *v) {
BME_Edge *e, *oe;
BME_Loop *l;
int len, count, flag;
@@ -217,7 +217,7 @@ static void BME_data_interp_from_verts(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2,
#endif
-static void BME_data_facevert_edgesplit(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Vert *v, BME_Edge *e1, float fac){
+static void BME_data_facevert_edgesplit(BME_Mesh *bm, BME_Vert *v1, BME_Vert *UNUSED(v2), BME_Vert *v, BME_Edge *e1, float fac){
void *src[2];
float w[2];
BME_Loop *l=NULL, *v1loop = NULL, *vloop = NULL, *v2loop = NULL;
@@ -356,7 +356,7 @@ static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransDa
* vec2 is the direction of projection (pointing away from vec1)
* up_vec is used for orientation (expected to be normalized)
* returns the length of the projected vector that lies along vec1 */
-static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *td) {
+static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td)) {
float factor, vec3[3], tmp[3],c1,c2;
cross_v3_v3v3(tmp,vec1,vec2);
@@ -582,7 +582,7 @@ static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_Tran
return max;
}
-static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res, int options, BME_TransData_Head *td) {
+static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res, int UNUSED(options), BME_TransData_Head *td) {
BME_Vert *ov1, *ov2, *v1, *v2;
ov1 = BME_edge_getothervert(v->edge, v);
@@ -607,7 +607,7 @@ static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res,
return v1;
}
-static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int options, float *up_vec, BME_TransData_Head *td) {
+static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) {
BME_Vert *v1, *v2, *kv;
BME_Loop *kl=NULL, *nl;
BME_Edge *e;
@@ -708,7 +708,7 @@ static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int opti
return l;
}
-static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int options, float *up_vec, BME_TransData_Head *td) {
+static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) {
BME_Vert *v1, *v2;
BME_Poly *f;
@@ -859,7 +859,7 @@ static void BME_bevel_add_vweight(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert
}
}
-static float BME_bevel_get_angle(BME_Mesh *bm, BME_Edge *e, BME_Vert *v) {
+static float BME_bevel_get_angle(BME_Mesh *UNUSED(bm), BME_Edge *e, BME_Vert *v) {
BME_Vert *v1, *v2;
BME_Loop *l1, *l2;
float vec1[3], vec2[3], vec3[3], vec4[3];
@@ -918,7 +918,7 @@ static int BME_face_sharededges(BME_Poly *f1, BME_Poly *f2){
* Returns -
* A BME_Mesh pointer to the BMesh passed as a parameter.
*/
-static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int defgrp_index, float angle, BME_TransData_Head *td) {
+static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defgrp_index), float angle, BME_TransData_Head *td) {
BME_Vert *v;
BME_Edge *e;
BME_Poly *f;
@@ -1162,7 +1162,7 @@ static void bmesh_dissolve_disk(BME_Mesh *bm, BME_Vert *v){
//BME_JEKV(bm,v->edge,v);
}
}
-static BME_Mesh *BME_bevel_mesh(BME_Mesh *bm, float value, int res, int options, int defgrp_index, BME_TransData_Head *td) {
+static BME_Mesh *BME_bevel_mesh(BME_Mesh *bm, float value, int res, int options, int UNUSED(defgrp_index), BME_TransData_Head *td) {
BME_Vert *v, *nv;
BME_Edge *e, *oe;
BME_Loop *l, *l2;
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 131db2b843a..241dfc72484 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -15,6 +15,13 @@
#define CCG_INLINE inline
#endif
+/* copied from BKE_utildefines.h ugh */
+#ifdef __GNUC__
+# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
+#else
+# define UNUSED(x) x
+#endif
+
/* used for normalize_v3 in BLI_math_vector
* float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */
#define EPSILON (1.0e-35f)
@@ -185,13 +192,13 @@ static int _ehashIterator_isStopped(EHashIterator *ehi) {
/***/
-static void *_stdAllocator_alloc(CCGAllocatorHDL a, int numBytes) {
+static void *_stdAllocator_alloc(CCGAllocatorHDL UNUSED(a), int numBytes) {
return malloc(numBytes);
}
-static void *_stdAllocator_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize) {
+static void *_stdAllocator_realloc(CCGAllocatorHDL UNUSED(a), void *ptr, int newSize, int UNUSED(oldSize)) {
return realloc(ptr, newSize);
}
-static void _stdAllocator_free(CCGAllocatorHDL a, void *ptr) {
+static void _stdAllocator_free(CCGAllocatorHDL UNUSED(a), void *ptr) {
free(ptr);
}
@@ -2666,7 +2673,7 @@ float ccgSubSurf_getEdgeCrease(CCGEdge *e) {
/* Face accessors */
-CCGFaceHDL ccgSubSurf_getFaceFaceHandle(CCGSubSurf *ss, CCGFace *f) {
+CCGFaceHDL ccgSubSurf_getFaceFaceHandle(CCGSubSurf *UNUSED(ss), CCGFace *f) {
return f->fHDL;
}
int ccgSubSurf_getFaceAge(CCGSubSurf *ss, CCGFace *f) {
@@ -2684,14 +2691,14 @@ void *ccgSubSurf_getFaceUserData(CCGSubSurf *ss, CCGFace *f) {
int ccgSubSurf_getFaceNumVerts(CCGFace *f) {
return f->numVerts;
}
-CCGVert *ccgSubSurf_getFaceVert(CCGSubSurf *ss, CCGFace *f, int index) {
+CCGVert *ccgSubSurf_getFaceVert(CCGSubSurf *UNUSED(ss), CCGFace *f, int index) {
if (index<0 || index>=f->numVerts) {
return NULL;
} else {
return FACE_getVerts(f)[index];
}
}
-CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *ss, CCGFace *f, int index) {
+CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *UNUSED(ss), CCGFace *f, int index) {
if (index<0 || index>=f->numVerts) {
return NULL;
} else {
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8dd71a60bbc..0f2aeeb0bf5 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -520,7 +520,7 @@ static void emDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *us
glEnd();
}
}
-static void emDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges)
+static void emDM_drawEdges(DerivedMesh *dm, int UNUSED(drawLooseEdges), int UNUSED(drawAllEdges))
{
emDM_drawMappedEdges(dm, NULL, NULL);
}
@@ -629,13 +629,19 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use
func(userData, i, cent, emdm->vertexCos?emdm->faceNos[i]:efa->n);
}
}
+
+/* note, material function is ignored for now. */
static void emDM_drawMappedFaces(DerivedMesh *dm, float (*partial_redraw_planes)[4],
int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r),
- void *userData, DMDrawFlags flags)
+ void *userData,
+ int (*setMaterial)(int, void *attribs),
+ DMDrawFlags flags)
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditFace *efa;
int i, draw;
+
+ (void)setMaterial; /* unused */
if (emdm->vertexCos) {
EditVert *eve;
@@ -1329,8 +1335,7 @@ static void emDM_release(DerivedMesh *dm)
}
}
-static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob,
- float (*vertexCos)[3])
+static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, float (*vertexCos)[3])
{
EditMeshDerivedMesh *emdm = MEM_callocN(sizeof(*emdm), "emdm");
@@ -2033,7 +2038,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
modifiers_clearErrors(ob);
if(cage_r && cageIndex == -1) {
- *cage_r = getEditMeshDerivedMesh(em, ob, NULL);
+ *cage_r = getEditMeshDerivedMesh(em, NULL);
}
dm = NULL;
@@ -2166,7 +2171,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
*cage_r = dm;
} else {
*cage_r =
- getEditMeshDerivedMesh(em, ob,
+ getEditMeshDerivedMesh(em,
deformedVerts ? MEM_dupallocN(deformedVerts) : NULL);
}
}
@@ -2190,7 +2195,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
} else if (!deformedVerts && cage_r && *cage_r) {
*final_r = *cage_r;
} else {
- *final_r = getEditMeshDerivedMesh(em, ob, deformedVerts);
+ *final_r = getEditMeshDerivedMesh(em, deformedVerts);
deformedVerts = NULL;
}
@@ -2410,9 +2415,9 @@ DerivedMesh *editmesh_get_derived_cage(Scene *scene, Object *obedit, EditMesh *e
return em->derivedCage;
}
-DerivedMesh *editmesh_get_derived_base(Object *obedit, EditMesh *em)
+DerivedMesh *editmesh_get_derived_base(Object *UNUSED(obedit), EditMesh *em)
{
- return getEditMeshDerivedMesh(em, obedit, NULL);
+ return getEditMeshDerivedMesh(em, NULL);
}
@@ -2498,7 +2503,7 @@ int editmesh_get_first_deform_matrices(Scene *scene, Object *ob, EditMesh *em, f
if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
if(!defmats) {
- dm= getEditMeshDerivedMesh(em, ob, NULL);
+ dm= getEditMeshDerivedMesh(em, NULL);
deformedVerts= editmesh_getVertexCos(em, &numVerts);
defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 90a3a6ce664..5a96575452b 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1091,7 +1091,7 @@ void copy_pose_result(bPose *to, bPose *from)
/* For the calculation of the effects of an Action at the given frame on an object
* This is currently only used for the Action Constraint
*/
-void what_does_obaction (Scene *scene, Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe)
+void what_does_obaction (Scene *UNUSED(scene), Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe)
{
bActionGroup *agrp= action_groups_find_named(act, groupname);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 6da9f2bbabc..7b52d9c586a 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -648,7 +648,7 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat,
totfac= data[1]+data[2];
if(totfac>FLT_EPSILON) interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
- else QUATCOPY(q1, p3->quat);
+ else QUATCOPY(q2, p3->quat);
totfac = data[0]+data[1]+data[2]+data[3];
if(totfac>FLT_EPSILON) interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
@@ -1138,7 +1138,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
dm->release(dm);
}
-static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level, int animated)
+static void new_particle_duplilist(ListBase *lb, ID *UNUSED(id), Scene *scene, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level, int animated)
{
GroupObject *go;
Object *ob=0, **oblist=0, obcopy, *obcopylist=0;
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 10c2c1801cb..22f5ac181f1 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -565,7 +565,7 @@ void BKE_all_animdata_fix_paths_rename (char *prefix, char *oldName, char *newNa
/* Find the first path that matches the given criteria */
// TODO: do we want some method to perform partial matches too?
-KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode)
+KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int UNUSED(group_mode))
{
KS_Path *ksp;
@@ -767,7 +767,7 @@ void BKE_keyingsets_free (ListBase *list)
* - path: original path string (as stored in F-Curve data)
* - dst: destination string to write data to
*/
-static short animsys_remap_path (AnimMapper *remap, char *path, char **dst)
+static short animsys_remap_path (AnimMapper *UNUSED(remap), char *path, char **dst)
{
/* is there a valid remapping table to use? */
//if (remap) {
@@ -1607,7 +1607,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
/* 1. get the stack of strips to evaluate at current time (influence calculated here) */
for (nlt=adt->nla_tracks.first; nlt; nlt=nlt->next, track_index++) {
- /* if tweaking is on and this strip is the tweaking track, stop on this one */
+ /* stop here if tweaking is on and this strip is the tweaking track (it will be the first one that's 'disabled')... */
if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED))
break;
@@ -1634,22 +1634,30 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
*/
if ((adt->action) && !(adt->flag & ADT_NLA_SOLO_TRACK)) {
/* if there are strips, evaluate action as per NLA rules */
- if (has_strips) {
+ if ((has_strips) || (adt->actstrip)) {
/* make dummy NLA strip, and add that to the stack */
memset(&dummy_strip, 0, sizeof(NlaStrip));
dummy_trackslist.first= dummy_trackslist.last= &dummy_strip;
- dummy_strip.act= adt->action;
- dummy_strip.remap= adt->remap;
-
- /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */
- calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1);
- dummy_strip.start = dummy_strip.actstart;
- dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend);
-
- dummy_strip.blendmode= adt->act_blendmode;
- dummy_strip.extendmode= adt->act_extendmode;
- dummy_strip.influence= adt->act_influence;
+ if ((nlt) && !(adt->flag & ADT_NLA_EDIT_NOMAP)) {
+ /* edit active action in-place according to its active strip, so copy the data */
+ memcpy(&dummy_strip, adt->actstrip, sizeof(NlaStrip));
+ dummy_strip.next = dummy_strip.prev = NULL;
+ }
+ else {
+ /* set settings of dummy NLA strip from AnimData settings */
+ dummy_strip.act= adt->action;
+ dummy_strip.remap= adt->remap;
+
+ /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */
+ calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1);
+ dummy_strip.start = dummy_strip.actstart;
+ dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend);
+
+ dummy_strip.blendmode= adt->act_blendmode;
+ dummy_strip.extendmode= adt->act_extendmode;
+ dummy_strip.influence= adt->act_influence;
+ }
/* add this to our list of evaluation strips */
nlastrips_ctime_get_strip(&estrips, &dummy_trackslist, -1, ctime);
@@ -1685,7 +1693,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
/* Clear all overides */
/* Add or get existing Override for given setting */
-AnimOverride *BKE_animsys_validate_override (PointerRNA *ptr, char *path, int array_index)
+AnimOverride *BKE_animsys_validate_override (PointerRNA *UNUSED(ptr), char *UNUSED(path), int UNUSED(array_index))
{
// FIXME: need to define how to get overrides
return NULL;
@@ -1694,7 +1702,7 @@ AnimOverride *BKE_animsys_validate_override (PointerRNA *ptr, char *path, int ar
/* -------------------- */
/* Evaluate Overrides */
-static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt, float ctime)
+static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt)
{
AnimOverride *aor;
@@ -1793,7 +1801,7 @@ void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, float ctime, short re
* - Overrides are cleared upon frame change and/or keyframing
* - It is best that we execute this everytime, so that no errors are likely to occur.
*/
- animsys_evaluate_overrides(&id_ptr, adt, ctime);
+ animsys_evaluate_overrides(&id_ptr, adt);
/* clear recalc flag now */
adt->recalc= 0;
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 2e760f53155..f0c39e6373e 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -252,7 +252,7 @@ Bone *get_named_bone (bArmature *arm, const char *name)
* axis: the axis to name on
* head/tail: the head/tail co-ordinate of the bone on the specified axis
*/
-int bone_autoside_name (char *name, int strip_number, short axis, float head, float tail)
+int bone_autoside_name (char *name, int UNUSED(strip_number), short axis, float head, float tail)
{
unsigned int len;
char basename[32]={""};
@@ -1057,7 +1057,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
/* ************ END Armature Deform ******************* */
-void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int root, int posed)
+void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int UNUSED(root), int UNUSED(posed))
{
copy_m4_m4(M_accumulatedMatrix, bone->arm_mat);
}
@@ -1616,7 +1616,7 @@ typedef struct tSplineIK_Tree {
/* ----------- */
/* Tag the bones in the chain formed by the given bone for IK */
-static void splineik_init_tree_from_pchan(Scene *scene, Object *ob, bPoseChannel *pchan_tip)
+static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPoseChannel *pchan_tip)
{
bPoseChannel *pchan, *pchanRoot=NULL;
bPoseChannel *pchanChain[255];
@@ -1785,7 +1785,7 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *ob, bPoseChannel
}
/* Tag which bones are members of Spline IK chains */
-static void splineik_init_tree(Scene *scene, Object *ob, float ctime)
+static void splineik_init_tree(Scene *scene, Object *ob, float UNUSED(ctime))
{
bPoseChannel *pchan;
@@ -2239,13 +2239,28 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
offs_bone[3][1]+= parbone->length;
/* Compose the matrix for this bone */
- if(bone->flag & BONE_HINGE) { // uses restposition rotation, but actual position
+ if((bone->flag & BONE_HINGE) && (bone->flag & BONE_NO_SCALE)) { // uses restposition rotation, but actual position
float tmat[4][4];
-
/* the rotation of the parent restposition */
copy_m4_m4(tmat, parbone->arm_mat);
mul_serie_m4(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
}
+ else if(bone->flag & BONE_HINGE) { // same as above but apply parent scale
+ float tmat[4][4];
+
+ /* apply the parent matrix scale */
+ float tsmat[4][4], tscale[3];
+
+ /* the rotation of the parent restposition */
+ copy_m4_m4(tmat, parbone->arm_mat);
+
+ /* extract the scale of the parent matrix */
+ mat4_to_size(tscale, parchan->pose_mat);
+ size_to_mat4(tsmat, tscale);
+ mul_m4_m4m4(tmat, tmat, tsmat);
+
+ mul_serie_m4(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
+ }
else if(bone->flag & BONE_NO_SCALE) {
float orthmat[4][4];
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index d120b42a286..72d194e4d79 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -309,8 +309,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
#endif
/* these are the same at times, should never copy to the same location */
- if(G.sce != filename)
- BLI_strncpy(G.sce, filename, FILE_MAX);
+ if(G.main->name != filename)
+ BLI_strncpy(G.main->name, filename, FILE_MAX);
BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */
@@ -365,7 +365,7 @@ void BKE_userdef_free(void)
2: OK, and with new user settings
*/
-int BKE_read_file(bContext *C, char *dir, void *unused, ReportList *reports)
+int BKE_read_file(bContext *C, char *dir, ReportList *reports)
{
BlendFileData *bfd;
int retval= 1;
@@ -392,7 +392,7 @@ int BKE_read_file(bContext *C, char *dir, void *unused, ReportList *reports)
return (bfd?retval:0);
}
-int BKE_read_file_from_memory(bContext *C, char* filebuf, int filelength, void *unused, ReportList *reports)
+int BKE_read_file_from_memory(bContext *C, char* filebuf, int filelength, ReportList *reports)
{
BlendFileData *bfd;
@@ -410,7 +410,7 @@ int BKE_read_file_from_memfile(bContext *C, MemFile *memfile, ReportList *report
{
BlendFileData *bfd;
- bfd= BLO_read_from_memfile(CTX_data_main(C), G.sce, memfile, reports);
+ bfd= BLO_read_from_memfile(CTX_data_main(C), G.main->name, memfile, reports);
if (bfd)
setup_app_data(C, bfd, "<memory1>");
else
@@ -460,26 +460,23 @@ static UndoElem *curundo= NULL;
static int read_undosave(bContext *C, UndoElem *uel)
{
- char scestr[FILE_MAXDIR+FILE_MAXFILE]; /* we should eventually just use G.main->name */
char mainstr[FILE_MAXDIR+FILE_MAXFILE];
int success=0, fileflags;
/* This is needed so undoing/redoing doesnt crash with threaded previews going */
WM_jobs_stop_all(CTX_wm_manager(C));
-
- strcpy(scestr, G.sce); /* temporal store */
+
strcpy(mainstr, G.main->name); /* temporal store */
fileflags= G.fileflags;
G.fileflags |= G_FILE_NO_UI;
if(UNDO_DISK)
- success= BKE_read_file(C, uel->str, NULL, NULL);
+ success= BKE_read_file(C, uel->str, NULL);
else
success= BKE_read_file_from_memfile(C, &uel->memfile, NULL);
/* restore */
- strcpy(G.sce, scestr); /* restore */
strcpy(G.main->name, mainstr); /* restore */
G.fileflags= fileflags;
@@ -554,7 +551,7 @@ void BKE_write_undo(bContext *C, char *name)
if(curundo->prev) prevfile= &(curundo->prev->memfile);
memused= MEM_get_memory_in_use();
- success= BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags, NULL);
+ success= BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags);
curundo->undosize= MEM_get_memory_in_use() - memused;
}
@@ -720,7 +717,7 @@ void BKE_undo_save_quit(void)
Main *BKE_undo_get_main(Scene **scene)
{
Main *mainp= NULL;
- BlendFileData *bfd= BLO_read_from_memfile(G.main, G.sce, &curundo->memfile, NULL);
+ BlendFileData *bfd= BLO_read_from_memfile(G.main, G.main->name, &curundo->memfile, NULL);
if(bfd) {
mainp= bfd->main;
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 69a42e52247..943cf20720e 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -58,7 +58,7 @@ typedef struct BoidValues {
static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val, ParticleData *pa, float fuzziness);
-static int rule_none(BoidRule *rule, BoidBrainData *data, BoidValues *val, ParticleData *pa)
+static int rule_none(BoidRule *UNUSED(rule), BoidBrainData *UNUSED(data), BoidValues *UNUSED(val), ParticleData *UNUSED(pa))
{
return 0;
}
@@ -344,7 +344,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
return ret;
}
-static int rule_separate(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, ParticleData *pa)
+static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *val, ParticleData *pa)
{
KDTreeNearest *ptn = NULL;
ParticleTarget *pt;
@@ -384,7 +384,7 @@ static int rule_separate(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Pa
}
return ret;
}
-static int rule_flock(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, ParticleData *pa)
+static int rule_flock(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *UNUSED(val), ParticleData *pa)
{
KDTreeNearest ptn[11];
float vec[3] = {0.0f, 0.0f, 0.0f}, loc[3] = {0.0f, 0.0f, 0.0f};
@@ -823,7 +823,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro
return NULL;
}
}
-static int boid_rule_applies(ParticleData *pa, BoidSettings *boids, BoidRule *rule)
+static int boid_rule_applies(ParticleData *pa, BoidSettings *UNUSED(boids), BoidRule *rule)
{
BoidParticle *bpa = pa->boid;
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index c67db9382f3..d894aef4ac5 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -530,7 +530,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf
if (*outbuf)
ibuf= *outbuf;
else
- ibuf= IMB_allocImBuf(bufsize, bufsize, 32, imbflag, 0);
+ ibuf= IMB_allocImBuf(bufsize, bufsize, 32, imbflag);
if (flt) {
for (y=0; y < ibuf->y; y++) {
@@ -796,11 +796,11 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float
imbflag= (cache->flt)? IB_rectfloat: IB_rect;
if (!cache->ibuf)
- cache->ibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag, 0);
+ cache->ibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag);
ibuf= cache->ibuf;
oldtexibuf= cache->texibuf;
- cache->texibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag, 0);
+ cache->texibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag);
if (oldtexibuf) {
srcx= srcy= 0;
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 1b7257519b1..671bcb36680 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -42,7 +42,7 @@
/* Math stuff for ray casting on mesh faces and for nearest surface */
-static float ray_tri_intersection(const BVHTreeRay *ray, const float m_dist, const float *v0, const float *v1, const float *v2)
+static float ray_tri_intersection(const BVHTreeRay *ray, const float UNUSED(m_dist), const float *v0, const float *v1, const float *v2)
{
float dist;
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 6441ce84d70..efbbd8f859c 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -826,7 +826,7 @@ static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tfa
static void cdDM_drawMappedFaces(DerivedMesh *dm, float (*partial_redraw_planes)[4],
int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r),
- void *userData, DMDrawFlags flags)
+ void *userData, int (*setMaterial)(int, void *attribs), DMDrawFlags flags)
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
MVert *mv = cddm->mvert;
@@ -850,16 +850,16 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, float (*partial_redraw_planes)
DEBUG_VBO( "Using legacy code. cdDM_drawMappedFaces\n" );
for(i = 0; i < dm->numFaceData; i++, mf++) {
int drawSmooth = (mf->flag & ME_SMOOTH);
+ int draw= 1;
- if(index) {
- orig = *index++;
- if(setDrawOptions && orig == ORIGINDEX_NONE)
- { if(nors) nors += 3; continue; }
- }
- else
- orig = i;
+ orig= (index==NULL) ? i : *index++;
+
+ if(orig == ORIGINDEX_NONE)
+ draw= setMaterial(mf->mat_nr + 1, NULL);
+ else if (setDrawOptions != NULL)
+ draw= setDrawOptions(userData, orig, &drawSmooth);
- if(!setDrawOptions || setDrawOptions(userData, orig, &drawSmooth)) {
+ if(draw) {
unsigned char *cp = NULL;
if((flags & DM_DRAW_VERTEX_COLORS) && mc)
@@ -924,34 +924,48 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, float (*partial_redraw_planes)
if( !GPU_buffer_legacy(dm) ) {
int tottri = dm->drawObject->nelements/3;
glShadeModel(GL_SMOOTH);
-
- for( i = 0; i < tottri; i++ ) {
- int actualFace = dm->drawObject->faceRemap[i];
- int drawSmooth = (mf[actualFace].flag & ME_SMOOTH);
- int draw = 1;
-
- if(index) {
- orig = index[actualFace];
- if(setDrawOptions && orig == ORIGINDEX_NONE)
- draw = 0;
- }
- else
- orig = actualFace;
-
- if(draw && setDrawOptions && !setDrawOptions(userData, orig, &drawSmooth))
- draw = 0;
-
- /* Goal is to draw as long of a contiguous triangle
- array as possible, so draw when we hit either an
- invisible triangle or at the end of the array */
- if(!draw || i == tottri - 1) {
- if(prevstart != i)
- /* Add one to the length (via `draw')
- if we're drawing at the end of the array */
- glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3);
- prevstart = i + 1;
+
+ if(tottri == 0) {
+ /* avoid buffer problems in following code */
+ }
+ if(setDrawOptions == NULL) {
+ /* just draw the entire face array */
+ glDrawArrays(GL_TRIANGLES, 0, (tottri-1) * 3);
+ }
+ else {
+ /* we need to check if the next material changes */
+ int next_actualFace= dm->drawObject->faceRemap[0];
+
+ for( i = 0; i < tottri; i++ ) {
+ //int actualFace = dm->drawObject->faceRemap[i];
+ int actualFace = next_actualFace;
+ MFace *mface= mf + actualFace;
+ int drawSmooth= (mface->flag & ME_SMOOTH);
+ int draw = 1;
+
+ if(i != tottri-1)
+ next_actualFace= dm->drawObject->faceRemap[i+1];
+
+ orig= (index==NULL) ? actualFace : index[actualFace];
+
+ if(orig == ORIGINDEX_NONE)
+ draw= setMaterial(mface->mat_nr + 1, NULL);
+ else if (setDrawOptions != NULL)
+ draw= setDrawOptions(userData, orig, &drawSmooth);
+
+ /* Goal is to draw as long of a contiguous triangle
+ array as possible, so draw when we hit either an
+ invisible triangle or at the end of the array */
+ if(!draw || i == tottri - 1 || mf[actualFace].mat_nr != mf[next_actualFace].mat_nr) {
+ if(prevstart != i)
+ /* Add one to the length (via `draw')
+ if we're drawing at the end of the array */
+ glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3);
+ prevstart = i + 1;
+ }
}
}
+
glShadeModel(GL_FLAT);
}
GPU_buffer_unbind();
@@ -1009,8 +1023,12 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
else if(setDrawOptions) {
orig = (index)? index[a]: a;
- if(orig == ORIGINDEX_NONE)
- continue;
+ if(orig == ORIGINDEX_NONE) {
+ /* since the material is set by setMaterial(), faces with no
+ * origin can be assumed to be generated by a modifier */
+
+ /* continue */
+ }
else if(!setDrawOptions(userData, orig))
continue;
}
@@ -1523,7 +1541,7 @@ DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces)
return dm;
}
-DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *ob)
+DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *UNUSED(ob))
{
CDDerivedMesh *cddm = cdDM_create("CDDM_from_mesh dm");
DerivedMesh *dm = &cddm->dm;
@@ -1552,7 +1570,7 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *ob)
return dm;
}
-DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *me)
+DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *UNUSED(me))
{
DerivedMesh *dm = CDDM_new(BLI_countlist(&em->verts),
BLI_countlist(&em->edges),
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index be1552a882d..e7e94c407f1 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -87,7 +87,7 @@ static CM_SOLVER_DEF solvers [] =
/* Prototypes for internal functions.
*/
static void cloth_to_object (Object *ob, ClothModifierData *clmd, DerivedMesh *dm);
-static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *dm );
+static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm );
static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first);
static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm );
static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm );
@@ -423,7 +423,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
/************************************************
* clothModifier_do - main simulation function
************************************************/
-DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc)
+DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
{
DerivedMesh *result;
PointCache *cache;
@@ -446,7 +446,9 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
return dm;
}
- if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0))
+ if(clmd->sim_parms->reset
+ || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0)
+ || (clmd->clothObject && result->getNumVerts(result) != clmd->clothObject->numverts))
{
clmd->sim_parms->reset = 0;
cache->flag |= PTCACHE_OUTDATED;
@@ -457,17 +459,6 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
return result;
}
- /* verify we still have the same number of vertices, if not do nothing.
- * note that this should only happen if the number of vertices changes
- * during an animation due to a preceding modifier, this should not
- * happen because of object changes! */
- if(clmd->clothObject) {
- if(result->getNumVerts(result) != clmd->clothObject->numverts) {
- BKE_ptcache_invalidate(cache);
- return result;
- }
- }
-
// unused in the moment, calculated separately in implicit.c
clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;
@@ -555,7 +546,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
}
/* frees all */
-void cloth_free_modifier ( Object *ob, ClothModifierData *clmd )
+void cloth_free_modifier(ClothModifierData *clmd )
{
Cloth *cloth = NULL;
@@ -813,7 +804,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
}
}
-static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first)
+static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float UNUSED(framenr), int first)
{
int i = 0;
MVert *mvert = NULL;
@@ -826,7 +817,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
// If we have a clothObject, free it.
if ( clmd->clothObject != NULL )
{
- cloth_free_modifier ( ob, clmd );
+ cloth_free_modifier ( clmd );
if(G.rt > 0)
printf("cloth_free_modifier cloth_from_object\n");
}
@@ -850,7 +841,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
if ( !dm )
return 0;
- cloth_from_mesh ( ob, clmd, dm );
+ cloth_from_mesh ( clmd, dm );
// create springs
clmd->clothObject->springs = NULL;
@@ -906,7 +897,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
if ( !cloth_build_springs ( clmd, dm ) )
{
- cloth_free_modifier ( ob, clmd );
+ cloth_free_modifier ( clmd );
modifier_setError ( & ( clmd->modifier ), "Can't build springs." );
printf("cloth_free_modifier cloth_build_springs\n");
return 0;
@@ -940,7 +931,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
return 1;
}
-static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *dm )
+static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
{
unsigned int numverts = dm->getNumVerts ( dm );
unsigned int numfaces = dm->getNumFaces ( dm );
@@ -952,7 +943,7 @@ static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *
clmd->clothObject->verts = MEM_callocN ( sizeof ( ClothVertex ) * clmd->clothObject->numverts, "clothVertex" );
if ( clmd->clothObject->verts == NULL )
{
- cloth_free_modifier ( ob, clmd );
+ cloth_free_modifier ( clmd );
modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->verts." );
printf("cloth_free_modifier clmd->clothObject->verts\n");
return;
@@ -963,7 +954,7 @@ static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *
clmd->clothObject->mfaces = MEM_callocN ( sizeof ( MFace ) * clmd->clothObject->numfaces, "clothMFaces" );
if ( clmd->clothObject->mfaces == NULL )
{
- cloth_free_modifier ( ob, clmd );
+ cloth_free_modifier ( clmd );
modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->mfaces." );
printf("cloth_free_modifier clmd->clothObject->mfaces\n");
return;
@@ -1015,7 +1006,7 @@ int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned in
return 0;
}
-static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *edgehash, LinkNode **edgelist)
+static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), LinkNode **edgelist)
{
unsigned int i = 0;
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index af12d23b2c2..5c9cc441b95 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -79,7 +79,7 @@ void collision_move_object ( CollisionModifierData *collmd, float step, float pr
bvhtree_update_from_mvert ( collmd->bvhtree, collmd->mfaces, collmd->numfaces, collmd->current_x, collmd->current_xnew, collmd->numverts, 1 );
}
-BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon )
+BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int UNUSED(numverts), float epsilon )
{
BVHTree *tree;
float co[12];
@@ -106,7 +106,7 @@ BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert
return tree;
}
-void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, MVert *xnew, int numverts, int moving )
+void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, MVert *xnew, int UNUSED(numverts), int moving )
{
int i;
MFace *mfaces = faces;
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 90ffa39c88f..83ed65a1bf2 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -53,7 +53,7 @@
#include "IMB_imbuf_types.h"
-void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w)
+void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int UNUSED(w))
{
int x, y;
float *rf= rectf;
@@ -74,7 +74,7 @@ void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, i
}
}
-void floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w)
+void floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int UNUSED(w))
{
int x, y;
float *rf= rectf;
@@ -356,7 +356,7 @@ void curvemap_sethandle(CurveMap *cuma, int type)
/* *********************** Making the tables and display ************** */
/* reduced copy of garbled calchandleNurb() code in curve.c */
-static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
+static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int UNUSED(mode))
{
float *p1,*p2,*p3,pt[3];
float dx1,dy1, dx,dy, vx,vy, len,len1,len2;
@@ -830,6 +830,10 @@ void colorcorrection_do_ibuf(ImBuf *ibuf, const char *profile)
cmsCloseProfile(proofingProfile);
}
}
+#else
+ /* unused */
+ (void)ibuf;
+ (void)profile;
#endif
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index fe69f13bbda..5dad01a126f 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -655,7 +655,7 @@ static bConstraintTypeInfo CTI_CONSTRNAME = {
/* This function should be used for the get_target_matrix member of all
* constraints that are not picky about what happens to their target matrix.
*/
-static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime)
+static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
if (VALID_CONS_TARGET(ct))
constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
@@ -1107,7 +1107,7 @@ static void kinematic_flush_tars (bConstraint *con, ListBase *list, short nocopy
}
}
-static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime)
+static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bKinematicConstraint *data= con->data;
@@ -1195,13 +1195,13 @@ static void followpath_flush_tars (bConstraint *con, ListBase *list, short nocop
}
}
-static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime)
+static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bFollowPathConstraint *data= con->data;
if (VALID_CONS_TARGET(ct)) {
Curve *cu= ct->tar->data;
- float q[4], vec[4], dir[3], quat[4], radius, x1;
+ float vec[4], dir[3], radius;
float totmat[4][4];
float curvetime;
@@ -1217,7 +1217,8 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
makeDispListCurveTypes(cob->scene, ct->tar, 0);
if (cu->path && cu->path->data) {
- if ((data->followflag & FOLLOWPATH_STATIC) == 0) {
+ float quat[4];
+ if ((data->followflag & FOLLOWPATH_STATIC) == 0) {
/* animated position along curve depending on time */
if (cob->scene)
curvetime= bsystem_time(cob->scene, ct->tar, cu->ctime, 0.0) - data->offset;
@@ -1238,8 +1239,10 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
curvetime= data->offset_fac;
}
- if ( where_on_path(ct->tar, curvetime, vec, dir, NULL, &radius, NULL) ) {
+ if ( where_on_path(ct->tar, curvetime, vec, dir, (data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL, &radius, NULL) ) { /* quat_pt is quat or NULL*/
if (data->followflag & FOLLOWPATH_FOLLOW) {
+#if 0
+ float x1, q[4];
vec_to_quat(quat, dir, (short)data->trackflag, (short)data->upflag);
normalize_v3(dir);
@@ -1249,10 +1252,13 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
q[2]= -x1*dir[1];
q[3]= -x1*dir[2];
mul_qt_qtqt(quat, q, quat);
-
+#else
+ quat_apply_track(quat, data->trackflag, data->upflag);
+#endif
+
quat_to_mat4(totmat, quat);
}
-
+
if (data->followflag & FOLLOWPATH_RADIUS) {
float tmat[4][4], rmat[4][4];
scale_m4_fl(tmat, radius);
@@ -1324,7 +1330,7 @@ static bConstraintTypeInfo CTI_FOLLOWPATH = {
/* --------- Limit Location --------- */
-static void loclimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void loclimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
{
bLocLimitConstraint *data = con->data;
@@ -1372,7 +1378,7 @@ static bConstraintTypeInfo CTI_LOCLIMIT = {
/* -------- Limit Rotation --------- */
-static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
{
bRotLimitConstraint *data = con->data;
float loc[3];
@@ -1431,7 +1437,7 @@ static bConstraintTypeInfo CTI_ROTLIMIT = {
/* --------- Limit Scaling --------- */
-static void sizelimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void sizelimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
{
bSizeLimitConstraint *data = con->data;
float obsize[3], size[3];
@@ -1825,7 +1831,7 @@ static void translike_flush_tars (bConstraint *con, ListBase *list, short nocopy
}
}
-static void translike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void translike_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
{
bConstraintTarget *ct= targets->first;
@@ -1861,7 +1867,7 @@ static void samevolume_new_data (void *cdata)
data->volume = 1.0f;
}
-static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
{
bSameVolumeConstraint *data= con->data;
@@ -1975,7 +1981,7 @@ static void pycon_id_looper (bConstraint *con, ConstraintIDFunc func, void *user
}
/* Whether this approach is maintained remains to be seen (aligorith) */
-static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime)
+static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
#ifndef DISABLE_PYTHON
bPythonConstraint *data= con->data;
@@ -2099,7 +2105,7 @@ static void actcon_flush_tars (bConstraint *con, ListBase *list, short nocopy)
}
}
-static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime)
+static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
extern void chan_calc_mat(bPoseChannel *chan);
bActionConstraint *data = con->data;
@@ -2190,7 +2196,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
}
}
-static void actcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void actcon_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
{
bConstraintTarget *ct= targets->first;
@@ -3070,7 +3076,7 @@ static void clampto_flush_tars (bConstraint *con, ListBase *list, short nocopy)
}
}
-static void clampto_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime)
+static void clampto_get_tarmat (bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
if (VALID_CONS_TARGET(ct)) {
Curve *cu= ct->tar->data;
@@ -3404,7 +3410,7 @@ static void shrinkwrap_flush_tars (bConstraint *con, ListBase *list, short nocop
}
-static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime)
+static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data;
@@ -3507,7 +3513,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
}
}
-static void shrinkwrap_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void shrinkwrap_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
{
bConstraintTarget *ct= targets->first;
@@ -3723,7 +3729,7 @@ static void splineik_flush_tars (bConstraint *con, ListBase *list, short nocopy)
}
}
-static void splineik_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime)
+static void splineik_get_tarmat (bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
if (VALID_CONS_TARGET(ct)) {
Curve *cu= ct->tar->data;
@@ -4155,7 +4161,7 @@ void id_loop_constraints (ListBase *conlist, ConstraintIDFunc func, void *userda
/* ......... */
/* helper for copy_constraints(), to be used for making sure that ID's are valid */
-static void con_extern_cb(bConstraint *con, ID **idpoin, void *userdata)
+static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, void *UNUSED(userData))
{
if (*idpoin && (*idpoin)->lib)
id_lib_extern(*idpoin);
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 9578b5185af..a7dd80bff4d 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -2951,7 +2951,7 @@ void switchdirectionNurb(Nurb *nu)
}
-float (*curve_getVertexCos(Curve *cu, ListBase *lb, int *numVerts_r))[3]
+float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
{
int i, numVerts = *numVerts_r = count_curveverts(lb);
float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos");
@@ -2979,7 +2979,7 @@ float (*curve_getVertexCos(Curve *cu, ListBase *lb, int *numVerts_r))[3]
return cos;
}
-void curve_applyVertexCos(Curve *cu, ListBase *lb, float (*vertexCos)[3])
+void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3])
{
float *co = vertexCos[0];
Nurb *nu;
@@ -3004,7 +3004,7 @@ void curve_applyVertexCos(Curve *cu, ListBase *lb, float (*vertexCos)[3])
}
}
-float (*curve_getKeyVertexCos(Curve *cu, ListBase *lb, float *key))[3]
+float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
{
int i, numVerts = count_curveverts(lb);
float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos");
@@ -3035,7 +3035,7 @@ float (*curve_getKeyVertexCos(Curve *cu, ListBase *lb, float *key))[3]
return cos;
}
-void curve_applyKeyVertexTilts(Curve *cu, ListBase *lb, float *key)
+void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
{
Nurb *nu;
int i;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 7e4de5e36d6..414373742c7 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -48,6 +48,7 @@
#include "BKE_customdata.h"
#include "BKE_customdata_file.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_utildefines.h"
#include "ptex.h"
@@ -147,7 +148,7 @@ static void linklist_free_simple(void *link)
}
static void layerInterp_mdeformvert(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+ float *UNUSED(sub_weights), int count, void *dest)
{
MDeformVert *dvert = dest;
LinkNode *dest_dw = NULL; /* a list of lists of MDeformWeight pointers */
@@ -205,7 +206,7 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
static void layerInterp_msticky(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+ float *UNUSED(sub_weights), int count, void *dest)
{
float co[2], w;
MSticky *mst;
@@ -444,8 +445,15 @@ static void mdisps_bilinear(float out[3], float (*disps)[3], int st, float u, fl
static int mdisp_corners(MDisps *s)
{
- /* silly trick because we don't get it from callback */
- return (s->totdisp % (3*3) == 0)? 3: 4;
+ int lvl= 13;
+
+ while(lvl > 0) {
+ int side = (1 << (lvl-1)) + 1;
+ if ((s->totdisp % (side*side)) == 0) return s->totdisp / (side*side);
+ lvl--;
+ }
+
+ return 0;
}
static void layerSwap_mdisps(void *data, const int *ci)
@@ -454,24 +462,33 @@ static void layerSwap_mdisps(void *data, const int *ci)
float (*d)[3] = NULL;
int corners, cornersize, S;
- /* this function is untested .. */
if(s->disps) {
- corners = mdisp_corners(s);
- cornersize = s->totdisp/corners;
+ int nverts= (ci[1] == 3) ? 4 : 3; /* silly way to know vertex count of face */
+ corners= mdisp_corners(s);
+ cornersize= s->totdisp/corners;
+
+ if(corners!=nverts) {
+ /* happens when face changed vertex count in edit mode
+ if it happened, just forgot displacement */
- d = MEM_callocN(sizeof(float) * 3 * s->totdisp, "mdisps swap");
+ MEM_freeN(s->disps);
+ s->disps= NULL;
+ s->totdisp= 0; /* flag to update totdisp */
+ return;
+ }
+
+ d= MEM_callocN(sizeof(float) * 3 * s->totdisp, "mdisps swap");
for(S = 0; S < corners; S++)
memcpy(d + cornersize*S, s->disps + cornersize*ci[S], cornersize*3*sizeof(float));
- if(s->disps)
- MEM_freeN(s->disps);
- s->disps = d;
+ MEM_freeN(s->disps);
+ s->disps= d;
}
}
-static void layerInterp_mdisps(void **sources, float *weights, float *sub_weights,
- int count, void *dest)
+static void layerInterp_mdisps(void **UNUSED(sources), float *UNUSED(weights),
+ float *UNUSED(sub_weights), int UNUSED(count), void *dest)
{
MDisps *d = dest;
int i;
@@ -549,7 +566,7 @@ static void layerCopy_mdisps(const void *source, void *dest, int count)
}
}
-static void layerFree_mdisps(void *data, int count, int size)
+static void layerFree_mdisps(void *data, int count, int UNUSED(size))
{
int i;
MDisps *d = data;
@@ -595,7 +612,7 @@ static int layerWrite_mdisps(CDataFile *cdf, void *data, int count)
return 1;
}
-static size_t layerFilesize_mdisps(CDataFile *cdf, void *data, int count)
+static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), void *data, int count)
{
MDisps *d = data;
size_t size = 0;
@@ -2707,13 +2724,13 @@ void CustomData_multires_rename(CustomDataMultires *cdm, int type,
static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external)
{
- char *path = (id->lib)? id->lib->filepath: G.sce;
+ char *path = (id->lib)? id->lib->filepath: G.main->name;
BLI_strncpy(filename, external->filename, FILE_MAX);
BLI_path_abs(filename, path);
}
-void CustomData_external_reload(CustomData *data, ID *id, CustomDataMask mask, int totelem)
+void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem)
{
CustomDataLayer *layer;
const LayerTypeInfo *typeInfo;
@@ -2883,7 +2900,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
cdf_free(cdf);
}
-void CustomData_external_add(CustomData *data, ID *id, int type, int totelem, const char *filename)
+void CustomData_external_add(CustomData *data, ID *UNUSED(id), int type, int UNUSED(totelem), const char *filename)
{
CustomDataExternal *external= data->external;
CustomDataLayer *layer;
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index 65a0d731beb..5954ac1b022 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -379,7 +379,7 @@ int cdf_write_open(CDataFile *cdf, char *filename)
return 1;
}
-int cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay)
+int cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay))
{
return 1;
}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 382c0690ae3..d95b7010993 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -846,7 +846,7 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob)
return node;
}
-static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name)
+static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, DagNode *fob2, short rel, char *name)
{
DagAdjList *itA = fob2->parent;
@@ -2280,7 +2280,7 @@ void DAG_on_load_update(Main *bmain)
}
}
-static void dag_id_flush_update__isDependentTexture(void *userData, Object *ob, ID **idpoin)
+static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUSED(ob), ID **idpoin)
{
struct { ID *id; int is_dependent; } *data = userData;
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index d0336d9f786..d1830cb8243 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -289,7 +289,7 @@ static void init_fastshade_shadeinput(Render *re)
shi.combinedflag= -1;
}
-static Render *fastshade_get_render(Scene *scene)
+static Render *fastshade_get_render(Scene *UNUSED(scene))
{
// XXX 2.5: this crashes combined with previewrender
// due to global R so disabled for now
@@ -979,7 +979,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
dl= dl->next;
}
- if(totvert && BLI_edgefill(0, 0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
+ if(totvert && BLI_edgefill(0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
/* count faces */
tot= 0;
@@ -1117,7 +1117,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
}
-static void curve_to_filledpoly(Curve *cu, ListBase *nurb, ListBase *dispbase)
+static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dispbase)
{
if(cu->flag & CU_3D) return;
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 4860e7d8eed..70e814ef956 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -264,6 +264,9 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector
eff = new_effector_cache(scene, ob, NULL, ob->pd);
+ /* make sure imat is up to date */
+ invert_m4_m4(ob->imat, ob->obmat);
+
BLI_addtail(*effectors, eff);
}
static void add_particles_to_effectors(ListBase **effectors, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src)
@@ -410,7 +413,7 @@ void pd_point_from_soft(Scene *scene, float *loc, float *vel, int index, Effecte
/************************************************/
// triangle - ray callback function
-static void eff_tri_ray_hit(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
+static void eff_tri_ray_hit(void *UNUSED(userData), int UNUSED(index), const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit)
{
// whenever we hit a bounding box, we don't check further
hit->dist = -1;
@@ -515,7 +518,7 @@ static float falloff_func_rad(PartDeflect *pd, float fac)
return falloff_func(fac, pd->flag&PFIELD_USEMINR, pd->minrad, pd->flag&PFIELD_USEMAXR, pd->maxrad, pd->f_power_r);
}
-float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, EffectorWeights *weights)
+float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNUSED(point), EffectorWeights *weights)
{
float temp[3];
float falloff = weights ? weights->weight[0] * weights->weight[eff->pd->forcefield] : 1.0f;
@@ -774,7 +777,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
}
if(eff->pd->flag & PFIELD_TEX_OBJECT) {
- mul_m4_v3(eff->ob->obmat, tex_co);
+ mul_m4_v3(eff->ob->imat, tex_co);
}
hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL,NULL, 0, result);
diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c
index 9dac409226b..c5431005b18 100644
--- a/source/blender/blenkernel/intern/exotic.c
+++ b/source/blender/blenkernel/intern/exotic.c
@@ -557,7 +557,7 @@ static int write_derivedmesh_stl(FILE *fpSTL, Object *ob, DerivedMesh *dm)
return numfacets;
}
-static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob, Mesh *me)
+static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob)
{
int numfacets = 0;
DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
@@ -572,7 +572,6 @@ static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob, Mesh *me)
void write_stl(Scene *scene, char *str)
{
Object *ob;
- Mesh *me;
Base *base;
FILE *fpSTL;
int numfacets = 0;
@@ -605,9 +604,8 @@ void write_stl(Scene *scene, char *str)
if (base->flag & SELECT) {
ob = base->object;
if (ob->type == OB_MESH) {
- me = ob->data;
- if (me)
- numfacets += write_object_stl(fpSTL, scene, ob, me);
+ if(ob->data)
+ numfacets += write_object_stl(fpSTL, scene, ob);
}
}
base= base->next;
@@ -978,7 +976,7 @@ static int all_digits(char *str)
return 1;
}
-static int dxf_get_layer_col(char *layer)
+static int dxf_get_layer_col(char *UNUSED(layer))
{
return 1;
}
@@ -1016,8 +1014,8 @@ static void myfgets(char *str, int len, FILE *fp)
/* three types of enters, \n \r and \r\n */
if(c == '\n') break;
if(c=='\r') {
- c= getc(dxf_fp); // read the linefeed from stream
- if(c != 10) ungetc(c, dxf_fp); // put back, if it's not one...
+ c= getc(fp); // read the linefeed from stream
+ if(c != 10) ungetc(c, fp); // put back, if it's not one...
break;
}
}
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 43f01199b69..1575f69209f 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -556,7 +556,7 @@ void bezt_add_to_cfra_elem (ListBase *lb, BezTriple *bezt)
/* Basic sampling callback which acts as a wrapper for evaluate_fcurve()
* 'data' arg here is unneeded here...
*/
-float fcurve_samplingcb_evalcurve (FCurve *fcu, void *data, float evaltime)
+float fcurve_samplingcb_evalcurve (FCurve *fcu, void *UNUSED(data), float evaltime)
{
/* assume any interference from drivers on the curve is intended... */
return evaluate_fcurve(fcu, evaltime);
@@ -1331,7 +1331,7 @@ float driver_get_variable_value (ChannelDriver *driver, DriverVar *dvar)
* - "evaltime" is the frame at which F-Curve is being evaluated
* - has to return a float value
*/
-static float evaluate_driver (ChannelDriver *driver, float evaltime)
+static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime))
{
DriverVar *dvar;
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index f63b58fe489..6660442b14a 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -190,7 +190,7 @@ static void fcm_generator_verify (FModifier *fcm)
}
}
-static void fcm_generator_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
+static void fcm_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime)
{
FMod_Generator *data= (FMod_Generator *)fcm->data;
@@ -303,7 +303,7 @@ static double sinc (double x)
return sin(M_PI * x) / (M_PI * x);
}
-static void fcm_fn_generator_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
+static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime)
{
FMod_FunctionGenerator *data= (FMod_FunctionGenerator *)fcm->data;
double arg= data->phase_multiplier*evaltime + data->phase_offset;
@@ -432,7 +432,7 @@ static void fcm_envelope_verify (FModifier *fcm)
}
}
-static void fcm_envelope_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
+static void fcm_envelope_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime)
{
FMod_Envelope *env= (FMod_Envelope *)fcm->data;
FCM_EnvelopeData *fed, *prevfed, *lastfed;
@@ -524,12 +524,12 @@ static void fcm_cycles_new_data (void *mdata)
data->before_mode= data->after_mode= FCM_EXTRAPOLATE_CYCLIC;
}
-static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime)
+static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue), float evaltime)
{
FMod_Cycles *data= (FMod_Cycles *)fcm->data;
float prevkey[2], lastkey[2], cycyofs=0.0f;
short side=0, mode=0;
- int cycles=0;
+ int cycles=0, ofs=0;
/* check if modifier is first in stack, otherwise disable ourself... */
// FIXME...
@@ -571,6 +571,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e
side= -1;
mode= data->before_mode;
cycles= data->before_cycles;
+ ofs= prevkey[0];
}
}
else if (evaltime > lastkey[0]) {
@@ -578,6 +579,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e
side= 1;
mode= data->after_mode;
cycles= data->after_cycles;
+ ofs= lastkey[0];
}
}
if ELEM(0, side, mode)
@@ -585,11 +587,8 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e
/* find relative place within a cycle */
{
- float cycdx=0, cycdy=0, ofs=0;
- float cycle= 0;
-
- /* ofs is start frame of cycle */
- ofs= prevkey[0];
+ float cycdx=0, cycdy=0;
+ float cycle= 0, cyct=0;
/* calculate period and amplitude (total height) of a cycle */
cycdx= lastkey[0] - prevkey[0];
@@ -601,6 +600,9 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e
/* calculate the 'number' of the cycle */
cycle= ((float)side * (evaltime - ofs) / cycdx);
+
+ /* calculate the time inside the cycle */
+ cyct= fmod(evaltime - ofs, cycdx);
/* check that cyclic is still enabled for the specified time */
if (cycles == 0) {
@@ -608,7 +610,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e
* as this indicates infinite cycles...
*/
}
- else if (cycle > (cycles+1)) {
+ else if (cycle > cycles) {
/* we are too far away from range to evaluate
* TODO: but we should still hold last value...
*/
@@ -617,26 +619,36 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e
/* check if 'cyclic extrapolation', and thus calculate y-offset for this cycle */
if (mode == FCM_EXTRAPOLATE_CYCLIC_OFFSET) {
- cycyofs = (float)floor((evaltime - ofs) / cycdx);
+ if(side < 0)
+ cycyofs = (float)floor((evaltime - ofs) / cycdx);
+ else
+ cycyofs = (float)ceil((evaltime - ofs) / cycdx);
cycyofs *= cycdy;
}
-
+
+ /* special case for cycle start/end */
+ if(cyct == 0.0f) {
+ evaltime = (side == 1 ? lastkey[0] : prevkey[0]);
+
+ if((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)cycle % 2))
+ evaltime = (side == 1 ? prevkey[0] : lastkey[0]);
+ }
/* calculate where in the cycle we are (overwrite evaltime to reflect this) */
- if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)(cycle) % 2)) {
+ else if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)(cycle+1) % 2)) {
/* when 'mirror' option is used and cycle number is odd, this cycle is played in reverse
* - for 'before' extrapolation, we need to flip in a different way, otherwise values past
* then end of the curve get referenced (result of fmod will be negative, and with different phase)
*/
if (side < 0)
- evaltime= (float)(prevkey[0] - fmod(evaltime-ofs, cycdx));
+ evaltime= prevkey[0] - cyct;
else
- evaltime= (float)(lastkey[0] - fmod(evaltime-ofs, cycdx));
+ evaltime= lastkey[0] - cyct;
}
else {
/* the cycle is played normally... */
- evaltime= (float)(fmod(evaltime-ofs, cycdx) + ofs);
+ evaltime= prevkey[0] + cyct;
}
- if (evaltime < ofs) evaltime += cycdx;
+ if (evaltime < prevkey[0]) evaltime += cycdx;
}
/* store temp data if needed */
@@ -652,7 +664,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e
return evaltime;
}
-static void fcm_cycles_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
+static void fcm_cycles_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float UNUSED(evaltime))
{
tFCMED_Cycles *edata= (tFCMED_Cycles *)fcm->edata;
@@ -696,7 +708,7 @@ static void fcm_noise_new_data (void *mdata)
data->modification = FCM_NOISE_MODIF_REPLACE;
}
-static void fcm_noise_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
+static void fcm_noise_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime)
{
FMod_Noise *data= (FMod_Noise *)fcm->data;
float noise;
@@ -788,7 +800,7 @@ static void fcm_python_copy (FModifier *fcm, FModifier *src)
pymod->prop = IDP_CopyProperty(opymod->prop);
}
-static void fcm_python_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
+static void fcm_python_evaluate (FCurve *UNUSED(fcu), FModifier *UNUSED(fcm), float *UNUSED(cvalue), float UNUSED(evaltime))
{
#ifndef DISABLE_PYTHON
//FMod_Python *data= (FMod_Python *)fcm->data;
@@ -817,7 +829,7 @@ static FModifierTypeInfo FMI_PYTHON = {
/* Limits F-Curve Modifier --------------------------- */
-static float fcm_limits_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime)
+static float fcm_limits_time (FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(cvalue), float evaltime)
{
FMod_Limits *data= (FMod_Limits *)fcm->data;
@@ -831,7 +843,7 @@ static float fcm_limits_time (FCurve *fcu, FModifier *fcm, float cvalue, float e
return evaltime;
}
-static void fcm_limits_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
+static void fcm_limits_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float UNUSED(evaltime))
{
FMod_Limits *data= (FMod_Limits *)fcm->data;
@@ -868,7 +880,7 @@ static void fcm_stepped_new_data (void *mdata)
data->step_size = 2.0f;
}
-static float fcm_stepped_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime)
+static float fcm_stepped_time (FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(cvalue), float evaltime)
{
FMod_Stepped *data= (FMod_Stepped *)fcm->data;
int snapblock;
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 47627d09b97..131b16b319e 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -514,11 +514,12 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float
float *fp, fsize, shear, x, si, co;
VFontData *vfd = NULL;
VChar *che = NULL;
- int i, sel=0;
+ int i;
vfd= vfont_get_data(which_vfont(cu, info));
if (!vfd) return;
+ /*
if (cu->selend < cu->selstart) {
if ((charidx >= (cu->selend)) && (charidx <= (cu->selstart-2)))
sel= 1;
@@ -527,6 +528,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float
if ((charidx >= (cu->selstart-1)) && (charidx <= (cu->selend-1)))
sel= 1;
}
+ */
/* make a copy at distance ofsx,ofsy with shear*/
fsize= cu->fsize;
@@ -1148,14 +1150,12 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
if(mode == FO_EDIT) {
/* make nurbdata */
- unsigned long cha;
-
freeNurblist(&cu->nurb);
ct= chartransdata;
if (cu->sepchar==0) {
for (i= 0; i<slen; i++) {
- cha = (uintptr_t) mem[i];
+ unsigned long cha = (uintptr_t) mem[i];
info = &(custrinfo[i]);
if (info->mat_nr > (ob->totcol)) {
/* printf("Error: Illegal material index (%d) in text object, setting to 0\n", info->mat_nr); */
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index bdf203119c3..5a031d62fcb 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -42,6 +42,7 @@
#include "BLI_blenlib.h"
+#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_group.h"
#include "BKE_library.h"
@@ -327,7 +328,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
you can draw everything, leaves tags in objects to signal it needs further updating */
/* note: does not work for derivedmesh and render... it recreates all again in convertblender.c */
-void group_handle_recalc_and_update(Scene *scene, Object *parent, Group *group)
+void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group *group)
{
GroupObject *go;
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index a0df73d6c42..639e2062f83 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -421,9 +421,7 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src)
IDProperty *loop, *prop;
for (prop=src->data.group.first; prop; prop=prop->next) {
for (loop=dest->data.group.first; loop; loop=loop->next) {
- if (BSTR_EQ(loop->name, prop->name)) {
- int copy_done= 0;
-
+ if (strcmp(loop->name, prop->name)==0) {
if(prop->type==loop->type) {
switch (prop->type) {
@@ -431,11 +429,9 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src)
case IDP_FLOAT:
case IDP_DOUBLE:
loop->data= prop->data;
- copy_done= 1;
break;
case IDP_GROUP:
IDP_SyncGroupValues(loop, prop);
- copy_done= 1;
break;
default:
{
@@ -702,7 +698,6 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name)
case IDP_STRING:
{
char *st = val.str;
- int stlen;
prop = MEM_callocN(sizeof(IDProperty), "IDProperty string");
if (st == NULL) {
@@ -710,7 +705,7 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name)
prop->totallen = DEFAULT_ALLOC_FOR_NULL_STRINGS;
prop->len = 1; /*NULL string, has len of 1 to account for null byte.*/
} else {
- stlen = strlen(st) + 1;
+ int stlen = strlen(st) + 1;
prop->data.pointer = MEM_callocN(stlen, "id property string 2");
prop->len = prop->totallen = stlen;
strcpy(prop->data.pointer, st);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index cb2261932ce..09622b2acfe 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -103,8 +103,8 @@ static void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */
if (ibuf->rect) {
/* make copies */
- tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0);
- tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0);
+ tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect);
+ tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect);
ibuf->x *= 2;
@@ -131,8 +131,8 @@ static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */
if (ibuf->rect) {
/* make copies */
- tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0);
- tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0);
+ tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect);
+ tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect);
ibuf->x *= 2;
@@ -330,7 +330,7 @@ void BKE_image_merge(Image *dest, Image *source)
/* otherwise creates new. */
/* does not load ibuf itself */
/* pass on optional frame for #name images */
-Image *BKE_add_image_file(const char *name, int frame)
+Image *BKE_add_image_file(const char *name)
{
Image *ima;
int file, len;
@@ -338,7 +338,7 @@ Image *BKE_add_image_file(const char *name, int frame)
char str[FILE_MAX], strtest[FILE_MAX];
BLI_strncpy(str, name, sizeof(str));
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
/* exists? */
file= open(str, O_BINARY|O_RDONLY);
@@ -349,7 +349,7 @@ Image *BKE_add_image_file(const char *name, int frame)
for(ima= G.main->image.first; ima; ima= ima->id.next) {
if(ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) {
BLI_strncpy(strtest, ima->name, sizeof(ima->name));
- BLI_path_abs(strtest, G.sce);
+ BLI_path_abs(strtest, G.main->name);
if( strcmp(strtest, str)==0 ) {
if(ima->anim==NULL || ima->id.us==0) {
@@ -389,15 +389,15 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, char *name,
float *rect_float= NULL;
if (floatbuf) {
- ibuf= IMB_allocImBuf(width, height, depth, IB_rectfloat, 0);
+ ibuf= IMB_allocImBuf(width, height, depth, IB_rectfloat);
rect_float= (float*)ibuf->rect_float;
}
else {
- ibuf= IMB_allocImBuf(width, height, depth, IB_rect, 0);
+ ibuf= IMB_allocImBuf(width, height, depth, IB_rect);
rect= (unsigned char*)ibuf->rect;
}
- strcpy(ibuf->name, "//Untitled");
+ BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));
ibuf->userflags |= IB_BITMAPDIRTY;
switch(uvtestgrid) {
@@ -596,7 +596,7 @@ void BKE_image_free_all_textures(void)
{
Tex *tex;
Image *ima;
- unsigned int totsize= 0;
+ /* unsigned int totsize= 0; */
for(ima= G.main->image.first; ima; ima= ima->id.next)
ima->id.flag &= ~LIB_DOIT;
@@ -607,13 +607,14 @@ void BKE_image_free_all_textures(void)
for(ima= G.main->image.first; ima; ima= ima->id.next) {
if(ima->ibufs.first && (ima->id.flag & LIB_DOIT)) {
+ /*
ImBuf *ibuf;
for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
if(ibuf->mipmap[0])
totsize+= 1.33*ibuf->x*ibuf->y*4;
else
totsize+= ibuf->x*ibuf->y*4;
- }
+ } */
image_free_buffers(ima);
}
}
@@ -860,8 +861,8 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
if (scene->r.stamp & R_STAMP_FILENAME) {
if (G.relbase_valid) {
- if (do_prefix) sprintf(stamp_data->file, "File %s", G.sce);
- else sprintf(stamp_data->file, "%s", G.sce);
+ if (do_prefix) sprintf(stamp_data->file, "File %s", G.main->name);
+ else sprintf(stamp_data->file, "%s", G.main->name);
} else {
if (do_prefix) strcpy(stamp_data->file, "File <untitled>");
else strcpy(stamp_data->file, "<untitled>");
@@ -1160,7 +1161,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
}
if (stamp_data.strip[0]) {
- BLF_width_and_height(mono, stamp_data.scene, &w, &h); h= h_fixed;
+ BLF_width_and_height(mono, stamp_data.strip, &w, &h); h= h_fixed;
/* Top right corner, with an extra space because blenfont is too strict! */
x= width - w - pad;
@@ -1201,7 +1202,8 @@ void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf)
int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimtype, int quality)
{
int ok;
-
+ (void)subimtype; /* quies unused warnings */
+
if(imtype==0) {
/* pass */
}
@@ -1309,7 +1311,7 @@ void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_
{
if (string==NULL) return;
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_path_frame(string, frame, 4);
if(use_ext)
@@ -1607,7 +1609,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
if(ima->id.lib)
BLI_path_abs(name, ima->id.lib->filepath);
else
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
flag= IB_rect|IB_multilayer;
if(ima->flag & IMA_DO_PREMUL)
@@ -1679,11 +1681,12 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
if(rpass) {
// printf("load from pass %s\n", rpass->name);
/* since we free render results, we copy the rect */
- ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0, 0);
+ ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0);
ibuf->rect_float= MEM_dupallocN(rpass->rect);
ibuf->flags |= IB_rectfloat;
ibuf->mall= IB_rectfloat;
ibuf->channels= rpass->channels;
+ ibuf->profile = IB_PROFILE_LINEAR_RGB;
image_initialize_after_load(ima, ibuf);
image_assign_ibuf(ima, ibuf, iuser?iuser->multi_index:0, frame);
@@ -1714,7 +1717,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
if(ima->id.lib)
BLI_path_abs(str, ima->id.lib->filepath);
else
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
ima->anim = openanim(str, IB_rect);
@@ -1775,7 +1778,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
if(ima->id.lib)
BLI_path_abs(str, ima->id.lib->filepath);
else
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
/* read ibuf */
ibuf = IMB_loadiffname(str, flag);
@@ -1828,7 +1831,7 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
RenderPass *rpass= BKE_image_multilayer_index(ima->rr, iuser);
if(rpass) {
- ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0, 0);
+ ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0);
image_initialize_after_load(ima, ibuf);
@@ -1935,7 +1938,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
/* make ibuf if needed, and initialize it */
if(ibuf==NULL) {
- ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0, 0);
+ ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
}
@@ -2145,7 +2148,7 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
if(!ibuf) {
/* Composite Viewer, all handled in compositor */
/* fake ibuf, will be filled in compositor */
- ibuf= IMB_allocImBuf(256, 256, 32, IB_rect, 0);
+ ibuf= IMB_allocImBuf(256, 256, 32, IB_rect);
image_assign_ibuf(ima, ibuf, 0, frame);
}
}
@@ -2183,7 +2186,7 @@ ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr)
{
- int imanr, len;
+ int len;
/* here (+fie_ima/2-1) makes sure that division happens correctly */
len= (iuser->fie_ima*iuser->frames)/2;
@@ -2192,8 +2195,9 @@ void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr)
iuser->framenr= 0;
}
else {
+ int imanr;
cfra= cfra - iuser->sfra+1;
-
+
/* cyclic */
if(iuser->cycl) {
cfra= ( (cfra) % len );
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 158f964a846..e0077ec7d26 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -726,7 +726,7 @@ typedef struct Implicit_Data
fmatrix3x3 *A, *dFdV, *dFdX, *S, *P, *Pinv, *bigI, *M;
} Implicit_Data;
-int implicit_init (Object *ob, ClothModifierData *clmd)
+int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
{
unsigned int i = 0;
unsigned int pinned = 0;
@@ -1218,7 +1218,7 @@ DO_INLINE void dfdx_damp(float to[3][3], float dir[3],float length,const float
}
-DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, lfVector *lF, lfVector *X, lfVector *V, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, float time)
+DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, lfVector *UNUSED(lF), lfVector *X, lfVector *V, fmatrix3x3 *UNUSED(dFdV), fmatrix3x3 *UNUSED(dFdX), float time)
{
Cloth *cloth = clmd->clothObject;
ClothVertex *verts = cloth->verts;
@@ -1353,7 +1353,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
}
}
-DO_INLINE void cloth_apply_spring_force(ClothModifierData *clmd, ClothSpring *s, lfVector *lF, lfVector *X, lfVector *V, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX)
+DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSpring *s, lfVector *lF, lfVector *UNUSED(X), lfVector *UNUSED(V), fmatrix3x3 *dFdV, fmatrix3x3 *dFdX)
{
if(s->flags & CLOTH_SPRING_FLAG_NEEDED)
{
@@ -1555,7 +1555,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
free_collider_cache(&colliders);
}
-static void cloth_calc_force(ClothModifierData *clmd, float frame, lfVector *lF, lfVector *lX, lfVector *lV, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, ListBase *effectors, float time, fmatrix3x3 *M)
+static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVector *lF, lfVector *lX, lfVector *lV, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, ListBase *effectors, float time, fmatrix3x3 *M)
{
/* Collect forces and derivatives: F,dFdX,dFdV */
Cloth *cloth = clmd->clothObject;
@@ -1708,7 +1708,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float frame, lfVector *lF,
// printf("\n");
}
-static void simulate_implicit_euler(lfVector *Vnew, lfVector *lX, lfVector *lV, lfVector *lF, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, float dt, fmatrix3x3 *A, lfVector *B, lfVector *dV, fmatrix3x3 *S, lfVector *z, lfVector *olddV, fmatrix3x3 *P, fmatrix3x3 *Pinv, fmatrix3x3 *M, fmatrix3x3 *bigI)
+static void simulate_implicit_euler(lfVector *Vnew, lfVector *UNUSED(lX), lfVector *lV, lfVector *lF, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, float dt, fmatrix3x3 *A, lfVector *B, lfVector *dV, fmatrix3x3 *S, lfVector *z, lfVector *olddV, fmatrix3x3 *UNUSED(P), fmatrix3x3 *UNUSED(Pinv), fmatrix3x3 *M, fmatrix3x3 *UNUSED(bigI))
{
unsigned int numverts = dFdV[0].vcount;
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 5c0c0fbf0c1..846592f0f2f 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -317,7 +317,7 @@ static char *constraint_adrcodes_to_paths (int adrcode, int *array_index)
* NOTE: as we don't have access to the keyblock where the data comes from (for now),
* we'll just use numerical indicies for now...
*/
-static char *shapekey_adrcodes_to_paths (int adrcode, int *array_index)
+static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index))
{
static char buf[128];
@@ -331,7 +331,7 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *array_index)
}
/* MTex (Texture Slot) types */
-static char *mtex_adrcodes_to_paths (int adrcode, int *array_index)
+static char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index))
{
char *base=NULL, *prop=NULL;
static char buf[128];
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 708403ab1f7..aa9d0b4f57c 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1163,7 +1163,7 @@ static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float
}
}
-static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float ctime, char *out, int tot)
+static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float UNUSED(ctime), char *out, int tot)
{
Nurb *nu;
int a, step;
@@ -1657,7 +1657,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
}
}
-void key_to_curve(KeyBlock *kb, Curve *cu, ListBase *nurb)
+void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
{
Nurb *nu;
BezTriple *bezt;
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 1390f0dbd56..638cab58229 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -599,16 +599,6 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
}
#endif
-
- static float q_x90d[4] = {0.70710676908493, 0.70710676908493, 0.0, 0.0}; // float rot_axis[3]= {1,0,0}; axis_angle_to_quat(q, rot_axis, 90 * (M_PI / 180));
- static float q_y90d[4] = {0.70710676908493, 0.0, 0.70710676908493, 0.0}; // float rot_axis[3]= {0,1,0}; axis_angle_to_quat(q, rot_axis, 90 * (M_PI / 180));
- static float q_z90d[4] = {0.70710676908493, 0.0, 0.0, 0.70710676908493}; // float rot_axis[3]= {0,0,2}; axis_angle_to_quat(q, rot_axis, 90 * (M_PI / 180));
-
- static float q_nx90d[4] = {0.70710676908493, -0.70710676908493, 0.0, 0.0}; // float rot_axis[3]= {1,0,0}; axis_angle_to_quat(q, rot_axis, -90 * (M_PI / 180));
- static float q_ny90d[4] = {0.70710676908493, 0.0, -0.70710676908493, 0.0}; // float rot_axis[3]= {0,1,0}; axis_angle_to_quat(q, rot_axis, -90 * (M_PI / 180));
- static float q_nz90d[4] = {0.70710676908493, 0.0, 0.0, -0.70710676908493}; // float rot_axis[3]= {0,0,2}; axis_angle_to_quat(q, rot_axis, -90 * (M_PI / 180));
-
-
if(cd->no_rot_axis) { /* set by caller */
/* this is not exactly the same as 2.4x, since the axis is having rotation removed rather then
@@ -635,53 +625,18 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
* Notice X,Y,Z Up all have light colors and each ordered CCW.
*
* Now for Neg Up XYZ, the colors are all dark, and ordered clockwise - Campbell
+ *
+ * note: moved functions into quat_apply_track/vec_apply_track
* */
+ copy_qt_qt(quat, new_quat);
+ copy_v3_v3(cent, co);
+
+ /* zero the axis which is not used,
+ * the big block of text above now applies to these 3 lines */
+ quat_apply_track(quat, axis-1, (axis==1 || axis==3) ? 1:0); /* up flag is a dummy, set so no rotation is done */
+ vec_apply_track(cent, axis-1);
+ cent[axis < 4 ? axis-1 : axis-4]= 0.0f;
- switch(axis) {
- case MOD_CURVE_POSX:
- mul_qt_qtqt(quat, new_quat, q_y90d);
-
- cent[0]= 0.0;
- cent[1]= co[2];
- cent[2]= co[1];
- break;
- case MOD_CURVE_NEGX:
- mul_qt_qtqt(quat, new_quat, q_ny90d);
-
- cent[0]= 0.0;
- cent[1]= -co[1];
- cent[2]= co[2];
-
- break;
- case MOD_CURVE_POSY:
- mul_qt_qtqt(quat, new_quat, q_x90d);
-
- cent[0]= co[2];
- cent[1]= 0.0;
- cent[2]= -co[0];
- break;
- case MOD_CURVE_NEGY:
- mul_qt_qtqt(quat, new_quat, q_nx90d);
-
- cent[0]= -co[0];
- cent[1]= 0.0;
- cent[2]= -co[2];
- break;
- case MOD_CURVE_POSZ:
- mul_qt_qtqt(quat, new_quat, q_z90d);
-
- cent[0]= co[1];
- cent[1]= -co[0];
- cent[2]= 0.0;
- break;
- case MOD_CURVE_NEGZ:
- mul_qt_qtqt(quat, new_quat, q_nz90d);
-
- cent[0]= co[0];
- cent[1]= -co[1];
- cent[2]= 0.0;
- break;
- }
/* scale if enabled */
if(cu->flag & CU_PATH_RADIUS)
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 834e7de5811..dfc82152e8c 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -39,6 +39,7 @@
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
+#include <assert.h>
#include "MEM_guardedalloc.h"
@@ -70,6 +71,7 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
+#include "BKE_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_library.h"
@@ -335,7 +337,7 @@ int id_unlink(ID *id, int test)
break;
case ID_OB:
if(test) return 1;
- unlink_object(NULL, (Object*)id);
+ unlink_object((Object*)id);
break;
}
@@ -649,11 +651,9 @@ void *copy_libblock(void *rt)
lb= which_libbase(G.main, GS(id->name));
idn= alloc_libblock(lb, GS(id->name), id->name+2);
-
- if(idn==NULL) {
- printf("ERROR: Illegal ID name for %s (Crashing now)\n", id->name);
- }
-
+
+ assert(idn != NULL);
+
idn_len= MEM_allocN_len(idn);
if(idn_len - sizeof(ID) > 0) {
cp= (char *)id;
@@ -669,7 +669,7 @@ void *copy_libblock(void *rt)
return idn;
}
-static void free_library(Library *lib)
+static void free_library(Library *UNUSED(lib))
{
/* no freeing needed for libraries yet */
}
@@ -681,7 +681,7 @@ void set_free_windowmanager_cb(void (*func)(bContext *C, wmWindowManager *) )
free_windowmanager_cb= func;
}
-void animdata_dtar_clear_cb(ID *id, AnimData *adt, void *userdata)
+void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata)
{
ChannelDriver *driver;
FCurve *fcu;
@@ -822,7 +822,7 @@ void free_libblock_us(ListBase *lb, void *idv) /* test users */
else printf("ERROR block %s users %d\n", id->name, id->us);
}
if(id->us==0) {
- if( GS(id->name)==ID_OB ) unlink_object(NULL, (Object *)id);
+ if( GS(id->name)==ID_OB ) unlink_object((Object *)id);
free_libblock(lb, id);
}
@@ -1234,7 +1234,7 @@ static void image_fix_relative_path(Image *ima)
if(ima->id.lib==NULL) return;
if(strncmp(ima->name, "//", 2)==0) {
BLI_path_abs(ima->name, ima->id.lib->filepath);
- BLI_path_rel(ima->name, G.sce);
+ BLI_path_rel(ima->name, G.main->name);
}
}
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 6f1cdefbcad..faefbdacb45 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -71,7 +71,7 @@ EditMesh *BKE_mesh_get_editmesh(Mesh *me)
return me->edit_mesh;
}
-void BKE_mesh_end_editmesh(Mesh *me, EditMesh *em)
+void BKE_mesh_end_editmesh(Mesh *UNUSED(me), EditMesh *UNUSED(em))
{
}
@@ -561,7 +561,7 @@ static void mfaces_strip_loose(MFace *mface, int *totface)
}
/* Create edges based on known verts and faces */
-static void make_edges_mdata(MVert *allvert, MFace *allface, int totvert, int totface,
+static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, int UNUSED(totvert), int totface,
int old, MEdge **alledge, int *_totedge)
{
MFace *mface;
@@ -1221,7 +1221,7 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth)
void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float **faceNors_r)
{
float (*tnorms)[3]= MEM_callocN(numVerts*sizeof(*tnorms), "tnorms");
- float *fnors= MEM_mallocN(sizeof(*fnors)*3*numFaces, "meshnormals");
+ float *fnors= MEM_callocN(sizeof(*fnors)*3*numFaces, "meshnormals");
int i;
for (i=0; i<numFaces; i++) {
@@ -1441,7 +1441,7 @@ void mesh_pmv_free(PartialVisibility *pv)
MEM_freeN(pv);
}
-void mesh_pmv_revert(Object *ob, Mesh *me)
+void mesh_pmv_revert(Mesh *me)
{
if(me->pv) {
unsigned i;
@@ -1480,10 +1480,10 @@ void mesh_pmv_revert(Object *ob, Mesh *me)
}
}
-void mesh_pmv_off(Object *ob, Mesh *me)
+void mesh_pmv_off(Mesh *me)
{
- if(ob && me->pv) {
- mesh_pmv_revert(ob, me);
+ if(me->pv) {
+ mesh_pmv_revert(me);
MEM_freeN(me->pv);
me->pv= NULL;
}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 43d26f26d1f..dc2992662c9 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -59,12 +59,12 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
static int types_init = 1;
if (types_init) {
- modifier_type_init(types, type); /* MOD_utils.c */
+ modifier_type_init(types); /* MOD_utils.c */
types_init= 0;
}
- if(type >= 0 && type < NUM_MODIFIER_TYPES &&
- types[type]->name[0] != '\0') {
+ /* type unsigned, no need to chech < 0 */
+ if(type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') {
return types[type];
}
else {
@@ -492,7 +492,7 @@ int modifier_isCorrectableDeformed(ModifierData *md)
return 0;
}
-int modifiers_isCorrectableDeformed(struct Scene *scene, Object *ob)
+int modifiers_isCorrectableDeformed(Object *ob)
{
ModifierData *md = modifiers_getVirtualModifierList(ob);
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 686c2223774..56914dad6d7 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -502,7 +502,7 @@ static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm,
static void init_gridkey_from_customdata(GridKey *gridkey,
CustomData *vdata,
- CustomData *fdata)
+ CustomData *UNUSED(fdata))
{
GRIDELEM_KEY_INIT(gridkey, 1, 0,
CustomData_get_multires_count(vdata, CD_PAINTMASK),
@@ -1103,7 +1103,7 @@ void multires_stitch_grids(Object *ob)
}
DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int local_mmd, DerivedMesh *dm, Object *ob,
- GridKey *gridkey, int useRenderParams, int isFinalCalc)
+ GridKey *gridkey, int useRenderParams, int UNUSED(isFinalCalc))
{
Mesh *me= ob->data;
DerivedMesh *result;
@@ -1200,7 +1200,7 @@ static void old_mdisps_bilinear(float out[3], float (*disps)[3], int st, float u
add_v3_v3v3(out, d2[0], d2[1]);
}
-static void old_mdisps_rotate(int S, int newside, int oldside, int x, int y, float *u, float *v)
+static void old_mdisps_rotate(int S, int UNUSED(newside), int oldside, int x, int y, float *u, float *v)
{
float offset = oldside*0.5f - 0.5f;
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index b053d615756..67c3e746a63 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1585,7 +1585,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt)
/* Baking Tools ------------------------------------------- */
-void BKE_nla_bake (Scene *scene, ID *id, AnimData *adt, int flag)
+void BKE_nla_bake (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag))
{
/* verify that data is valid
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index c5a12d1fb4e..40ba7db7305 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -297,7 +297,7 @@ static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Objec
}
}
-void unlink_object(Scene *scene, Object *ob)
+void unlink_object(Object *ob)
{
Main *bmain= G.main;
Object *obt;
@@ -1241,6 +1241,17 @@ static void copy_object_pose(Object *obn, Object *ob)
}
}
+static void copy_object_transform(Object *ob_tar, Object *ob_src)
+{
+ copy_v3_v3(ob_tar->loc, ob_src->loc);
+ copy_v3_v3(ob_tar->rot, ob_src->rot);
+ copy_v3_v3(ob_tar->quat, ob_src->quat);
+ copy_v3_v3(ob_tar->rotAxis, ob_src->rotAxis);
+ ob_tar->rotAngle= ob_src->rotAngle;
+ ob_tar->rotmode= ob_src->rotmode;
+ copy_v3_v3(ob_tar->size, ob_src->size);
+}
+
Object *copy_object(Object *ob)
{
Object *obn;
@@ -1507,23 +1518,23 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
ob->recalc= target->recalc= OB_RECALC_ALL;
- /* copy transform */
+ /* copy transform
+ * - gob means this proxy comes from a group, just apply the matrix
+ * so the object wont move from its dupli-transform.
+ *
+ * - no gob means this is being made from a linked object,
+ * this is closer to making a copy of the object - in-place. */
if(gob) {
- VECCOPY(ob->loc, gob->loc);
- VECCOPY(ob->rot, gob->rot);
- VECCOPY(ob->size, gob->size);
-
- group_tag_recalc(gob->dup_group);
+ ob->rotmode= target->rotmode;
+ mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat);
+ object_apply_mat4(ob, ob->obmat);
}
else {
- VECCOPY(ob->loc, target->loc);
- VECCOPY(ob->rot, target->rot);
- VECCOPY(ob->size, target->size);
+ copy_object_transform(ob, target);
+ ob->parent= target->parent; /* libdata */
+ copy_m4_m4(ob->parentinv, target->parentinv);
}
- ob->parent= target->parent; /* libdata */
- copy_m4_m4(ob->parentinv, target->parentinv);
-
/* copy animdata stuff - drivers only for now... */
object_copy_proxy_drivers(ob, target);
@@ -1583,7 +1594,7 @@ void disable_speed_curve(int val)
// XXX THIS CRUFT NEEDS SERIOUS RECODING ASAP!
/* ob can be NULL */
-float bsystem_time(struct Scene *scene, Object *ob, float cfra, float ofs)
+float bsystem_time(struct Scene *scene, Object *UNUSED(ob), float cfra, float ofs)
{
/* returns float ( see BKE_curframe in scene.c) */
cfra += scene->r.subframe;
@@ -1612,7 +1623,7 @@ void object_scale_to_mat3(Object *ob, float mat[][3])
size_to_mat3( mat,vec);
}
-// TODO: this should take rotation orders into account later...
+
void object_rot_to_mat3(Object *ob, float mat[][3])
{
float rmat[3][3], dmat[3][3];
@@ -1641,7 +1652,6 @@ void object_rot_to_mat3(Object *ob, float mat[][3])
}
/* combine these rotations */
- // XXX is this correct? if errors, change the order of multiplication...
mul_m3_m3m3(mat, dmat, rmat);
}
@@ -1665,29 +1675,28 @@ void object_mat3_to_rot(Object *ob, float mat[][3], int use_compat)
/* see pchan_apply_mat4() for the equivalent 'pchan' function */
void object_apply_mat4(Object *ob, float mat[][4])
{
- float mat3[3][3], tmat[3][3], imat[3][3];
+ float mat3[3][3]; /* obmat -> 3x3 */
+ float mat3_n[3][3]; /* obmat -> normalized, 3x3 */
+ float imat3_n[3][3]; /* obmat -> normalized & inverted, 3x3 */
/* location */
copy_v3_v3(ob->loc, mat[3]);
/* rotation */
copy_m3_m4(mat3, mat);
- object_mat3_to_rot(ob, mat3, 0);
-
+ /* so scale doesnt interfear with rotation [#24291] */
+ normalize_m3_m3(mat3_n, (const float(*)[3])mat3);
+
+ object_mat3_to_rot(ob, mat3_n, 0);
+
/* scale */
-#if 0
- /* works fine except for neg scales */
- mat4_to_size(ob->size, mat);
-#else
- /* this is more complicated but works for negative scales */
- object_rot_to_mat3(ob, tmat);
- invert_m3_m3(imat, tmat);
- mul_m3_m3m3(tmat, imat, mat3);
-
- ob->size[0]= tmat[0][0];
- ob->size[1]= tmat[1][1];
- ob->size[2]= tmat[2][2];
-#endif
+ /* note: mat4_to_size(ob->size, mat) fails for negative scale */
+ invert_m3_m3(imat3_n, mat3_n);
+ mul_m3_m3m3(mat3, imat3_n, mat3);
+
+ ob->size[0]= mat3[0][0];
+ ob->size[1]= mat3[1][1];
+ ob->size[2]= mat3[2][2];
}
void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
@@ -1720,7 +1729,7 @@ int enable_cu_speed= 1;
static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
{
Curve *cu;
- float q[4], vec[4], dir[3], quat[4], radius, x1, ctime;
+ float vec[4], dir[3], quat[4], radius, ctime;
float timeoffs = 0.0, sf_orig = 0.0;
unit_m4(mat);
@@ -1768,9 +1777,11 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
/* vec: 4 items! */
- if( where_on_path(par, ctime, vec, dir, NULL, &radius, NULL) ) {
+ if( where_on_path(par, ctime, vec, dir, cu->flag & CU_FOLLOW ? quat:NULL, &radius, NULL) ) {
if(cu->flag & CU_FOLLOW) {
+#if 0
+ float x1, q[4];
vec_to_quat( quat,dir, ob->trackflag, ob->upflag);
/* the tilt */
@@ -1781,8 +1792,11 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
q[2]= -x1*dir[1];
q[3]= -x1*dir[2];
mul_qt_qtqt(quat, q, quat);
-
- quat_to_mat4( mat,quat);
+#else
+ quat_apply_track(quat, ob->trackflag, ob->upflag);
+#endif
+
+ quat_to_mat4(mat,quat);
}
if(cu->flag & CU_PATH_RADIUS) {
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 919a724d1ec..33f1949c5ac 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -179,7 +179,7 @@ PackedFile *newPackedFile(ReportList *reports, char *filename)
// convert relative filenames to absolute filenames
strcpy(name, filename);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
// open the file
// and create a PackedFile structure
@@ -214,10 +214,17 @@ void packAll(Main *bmain, ReportList *reports)
Image *ima;
VFont *vf;
bSound *sound;
-
- for(ima=bmain->image.first; ima; ima=ima->id.next)
- if(ima->packedfile == NULL && ima->id.lib==NULL && ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
- ima->packedfile = newPackedFile(reports, ima->name);
+
+ for(ima=bmain->image.first; ima; ima=ima->id.next) {
+ if(ima->packedfile == NULL && ima->id.lib==NULL) {
+ if(ima->source==IMA_SRC_FILE) {
+ ima->packedfile = newPackedFile(reports, ima->name);
+ }
+ else if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
+ BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported.", ima->id.name+2);
+ }
+ }
+ }
for(vf=bmain->vfont.first; vf; vf=vf->id.next)
if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, "<builtin>") != 0)
@@ -267,7 +274,7 @@ int writePackedFile(ReportList *reports, char *filename, PackedFile *pf, int gui
if (guimode) {} //XXX waitcursor(1);
strcpy(name, filename);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
if (BLI_exists(name)) {
for (number = 1; number <= 999; number++) {
@@ -332,7 +339,7 @@ int checkPackedFile(char *filename, PackedFile *pf)
char name[FILE_MAXDIR + FILE_MAXFILE];
strcpy(name, filename);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
if (stat(name, &st)) {
ret_val = PF_NOFILE;
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index f2b64a3068b..dad835d531e 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -32,6 +32,7 @@
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
+#include "BKE_utildefines.h"
#include "BKE_brush.h"
#include "BKE_DerivedMesh.h"
#include "BKE_dmgrid.h"
@@ -108,7 +109,7 @@ void paint_init(Paint *p, const char col[3])
p->flags |= PAINT_SHOW_BRUSH;
}
-void free_paint(Paint *paint)
+void free_paint(Paint *UNUSED(paint))
{
/* nothing */
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 723ff7faed3..624587338c9 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -380,7 +380,7 @@ void psys_free_settings(ParticleSettings *part)
fluid_free_settings(part->fluid);
}
-void free_hair(Object *ob, ParticleSystem *psys, int dynamics)
+void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
{
PARTICLE_P;
@@ -402,9 +402,10 @@ void free_hair(Object *ob, ParticleSystem *psys, int dynamics)
modifier_free((ModifierData*)psys->clmd);
psys->clmd = NULL;
+ psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
}
else {
- cloth_free_modifier(ob, psys->clmd);
+ cloth_free_modifier(psys->clmd);
}
}
@@ -1051,7 +1052,7 @@ typedef struct ParticleInterpolationData {
} ParticleInterpolationData;
/* Assumes pointcache->mem_cache exists, so for disk cached particles call psys_make_temp_pointcache() before use */
/* It uses ParticleInterpolationData->pm to store the current memory cache frame so it's thread safe. */
-static void get_pointcache_keys_for_time(Object *ob, PointCache *cache, PTCacheMem **cur, int index, float t, ParticleKey *key1, ParticleKey *key2)
+static void get_pointcache_keys_for_time(Object *UNUSED(ob), PointCache *cache, PTCacheMem **cur, int index, float t, ParticleKey *key1, ParticleKey *key2)
{
static PTCacheMem *pm = NULL;
@@ -1646,7 +1647,7 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, float *
return DMCACHE_NOTFOUND;
}
-static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, int *mapindex, float *mapfw)
+static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float UNUSED(foffset), int *mapindex, float *mapfw)
{
if(index < 0)
return 0;
@@ -1802,7 +1803,7 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys)
/* Particles on a shape */
/************************************************/
/* ready for future use */
-static void psys_particle_on_shape(int distr, int index, float *fuv, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
+static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *UNUSED(fuv), float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
{
/* TODO */
float zerovec[3]={0.0f,0.0f,0.0f};
@@ -2184,7 +2185,7 @@ static void do_rough_end(float *loc, float mat[4][4], float t, float fac, float
VECADDFAC(state->co,state->co,mat[0],rough[0]);
VECADDFAC(state->co,state->co,mat[1],rough[1]);
}
-static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *rootco, float effector, float dfra, float cfra, float *length, float *vec)
+static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *UNUSED(rootco), float effector, float UNUSED(dfra), float UNUSED(cfra), float *length, float *vec)
{
float force[3] = {0.0f,0.0f,0.0f};
ParticleKey eff_key;
@@ -3338,7 +3339,7 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m
triatomat(v[0], v[1], v[2], (osface)? osface->uv: NULL, mat);
}
-void psys_mat_hair_to_object(Object *ob, DerivedMesh *dm, short from, ParticleData *pa, float hairmat[][4])
+void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, ParticleData *pa, float hairmat[][4])
{
float vec[3];
@@ -3817,7 +3818,7 @@ float psys_get_child_time(ParticleSystem *psys, ChildParticle *cpa, float cfra,
return (cfra-time)/life;
}
-float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float cfra, float *pa_time)
+float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED(cfra), float *UNUSED(pa_time))
{
ParticleSettings *part = psys->part;
float size; // time XXX
@@ -4248,7 +4249,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
}
}
-void psys_get_dupli_texture(Object *ob, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float *uv, float *orco)
+void psys_get_dupli_texture(Object *UNUSED(ob), ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float *uv, float *orco)
{
MFace *mface;
MTFace *mtface;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 47a220dcefb..71ec1114848 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -63,6 +63,7 @@
#include "BLI_listbase.h"
#include "BLI_threads.h"
+#include "BKE_main.h"
#include "BKE_animsys.h"
#include "BKE_boids.h"
#include "BKE_cdderivedmesh.h"
@@ -1437,7 +1438,7 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
}
/* ready for future use, to emit particles without geometry */
-static void distribute_particles_on_shape(ParticleSimulationData *sim, int from)
+static void distribute_particles_on_shape(ParticleSimulationData *sim, int UNUSED(from))
{
ParticleSystem *psys = sim->psys;
PARTICLE_P;
@@ -2289,7 +2290,7 @@ static void psys_update_effectors(ParticleSimulationData *sim)
In theory, there could be unlimited implementation
of SPH simulators
**************************************************/
-void particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings *part, ParticleSimulationData *sim, float dfra, float cfra, float mass){
+void particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings *part, ParticleSimulationData *sim, float dfra, float UNUSED(cfra), float mass){
/****************************************************************************************************************
* This code uses in some parts adapted algorithms from the pseduo code as outlined in the Research paper
* Titled: Particle-based Viscoelastic Fluid Simulation.
@@ -3284,7 +3285,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra)
psys_calc_dmcache(sim->ob, sim->psmd->dm, psys);
if(psys->clmd)
- cloth_free_modifier(sim->ob, psys->clmd);
+ cloth_free_modifier(psys->clmd);
}
/* dynamics with cloth simulation */
@@ -3298,7 +3299,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra)
psys->flag |= PSYS_HAIR_UPDATED;
}
-static void save_hair(ParticleSimulationData *sim, float cfra){
+static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)){
Object *ob = sim->ob;
ParticleSystem *psys = sim->psys;
HairKey *key, *root;
@@ -3574,7 +3575,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
}
}
-static void particles_fluid_step(ParticleSimulationData *sim, int cfra)
+static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
{
ParticleSystem *psys = sim->psys;
if(psys->particles){
@@ -3607,7 +3608,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int cfra)
// ok, start loading
strcpy(filename, fss->surfdataPath);
strcat(filename, suffix);
- BLI_path_abs(filename, G.sce);
+ BLI_path_abs(filename, G.main->name);
BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
strcat(filename, suffix2);
@@ -3682,7 +3683,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int cfra)
#endif // DISABLE_ELBEEM
}
-static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float cfra)
+static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNUSED(cfra))
{
ParticleSystem *psys = sim->psys;
ParticleSettings *part = psys->part;
@@ -4016,8 +4017,13 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
switch(part->type) {
case PART_HAIR:
{
+ /* nothing to do so bail out early */
+ if(psys->totpart == 0 && part->totpart == 0) {
+ psys_free_path_cache(psys, NULL);
+ free_hair(ob, psys, 0);
+ }
/* (re-)create hair */
- if(hair_needs_recalc(psys)) {
+ else if(hair_needs_recalc(psys)) {
float hcfra=0.0f;
int i, recalc = psys->recalc;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index e1006cd99cd..37d2b103ef0 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -132,7 +132,7 @@ static int ptcache_write_basic_header(PTCacheFile *pf)
return 1;
}
/* Softbody functions */
-static int ptcache_write_softbody(int index, void *soft_v, void **data, int cfra)
+static int ptcache_write_softbody(int index, void *soft_v, void **data, int UNUSED(cfra))
{
SoftBody *soft= soft_v;
BodyPoint *bp = soft->bpoint + index;
@@ -142,7 +142,7 @@ static int ptcache_write_softbody(int index, void *soft_v, void **data, int cfra
return 1;
}
-static void ptcache_read_softbody(int index, void *soft_v, void **data, float frs_sec, float cfra, float *old_data)
+static void ptcache_read_softbody(int index, void *soft_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data)
{
SoftBody *soft= soft_v;
BodyPoint *bp = soft->bpoint + index;
@@ -156,7 +156,7 @@ static void ptcache_read_softbody(int index, void *soft_v, void **data, float fr
PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, 0, bp->vec);
}
}
-static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data)
+static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data)
{
SoftBody *soft= soft_v;
BodyPoint *bp = soft->bpoint + index;
@@ -188,7 +188,7 @@ static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, f
VECCOPY(bp->pos, keys->co);
VECCOPY(bp->vec, keys->vel);
}
-static int ptcache_totpoint_softbody(void *soft_v, int cfra)
+static int ptcache_totpoint_softbody(void *soft_v, int UNUSED(cfra))
{
SoftBody *soft= soft_v;
return soft->totpoint;
@@ -348,7 +348,7 @@ static void ptcache_interpolate_particle(int index, void *psys_v, void **data, f
pa->state.time = cfra;
}
-static int ptcache_totpoint_particle(void *psys_v, int cfra)
+static int ptcache_totpoint_particle(void *psys_v, int UNUSED(cfra))
{
ParticleSystem *psys = psys_v;
return psys->totpart;
@@ -493,7 +493,7 @@ static int ptcache_totwrite_particle(void *psys_v, int cfra)
//}
//
/* Cloth functions */
-static int ptcache_write_cloth(int index, void *cloth_v, void **data, int cfra)
+static int ptcache_write_cloth(int index, void *cloth_v, void **data, int UNUSED(cfra))
{
ClothModifierData *clmd= cloth_v;
Cloth *cloth= clmd->clothObject;
@@ -505,7 +505,7 @@ static int ptcache_write_cloth(int index, void *cloth_v, void **data, int cfra)
return 1;
}
-static void ptcache_read_cloth(int index, void *cloth_v, void **data, float frs_sec, float cfra, float *old_data)
+static void ptcache_read_cloth(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data)
{
ClothModifierData *clmd= cloth_v;
Cloth *cloth= clmd->clothObject;
@@ -522,7 +522,7 @@ static void ptcache_read_cloth(int index, void *cloth_v, void **data, float frs_
PTCACHE_DATA_TO(data, BPHYS_DATA_XCONST, 0, vert->xconst);
}
}
-static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data)
+static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data)
{
ClothModifierData *clmd= cloth_v;
Cloth *cloth= clmd->clothObject;
@@ -558,7 +558,7 @@ static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, flo
/* should vert->xconst be interpolated somehow too? - jahka */
}
-static int ptcache_totpoint_cloth(void *cloth_v, int cfra)
+static int ptcache_totpoint_cloth(void *cloth_v, int UNUSED(cfra))
{
ClothModifierData *clmd= cloth_v;
return clmd->clothObject ? clmd->clothObject->numverts : 0;
@@ -635,7 +635,7 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
}
/* Smoke functions */
-static int ptcache_totpoint_smoke(void *smoke_v, int cfra)
+static int ptcache_totpoint_smoke(void *smoke_v, int UNUSED(cfra))
{
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
@@ -648,7 +648,7 @@ static int ptcache_totpoint_smoke(void *smoke_v, int cfra)
}
/* Smoke functions */
-static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int cfra)
+static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int UNUSED(cfra))
{
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
@@ -671,6 +671,8 @@ static int ptcache_compress_write(PTCacheFile *pf, unsigned char *in, unsigned i
unsigned char *props = MEM_callocN(16*sizeof(char), "tmp");
size_t sizeOfIt = 5;
+ (void)mode; /* unused when building w/o compression */
+
#ifdef WITH_LZO
out_len= LZO_OUT_LEN(in_len);
if(mode == 1) {
@@ -1082,8 +1084,8 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
static int ptcache_path(PTCacheID *pid, char *filename)
{
- Library *lib= (pid)? pid->ob->id.lib: NULL;
- const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce;
+ Library *lib= (pid->ob)? pid->ob->id.lib: NULL;
+ const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.main->name;
size_t i;
if(pid->cache->flag & PTCACHE_EXTERNAL) {
@@ -1890,7 +1892,7 @@ int BKE_ptcache_write_cache(PTCacheID *pid, int cfra)
}
if(cache->cached_frames)
- cache->cached_frames[cfra] = 1;
+ cache->cached_frames[cfra-cache->startframe] = 1;
if(pf) ptcache_file_close(pf);
@@ -2220,7 +2222,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
cache->flag &= ~PTCACHE_REDO_NEEDED;
if(pid->type == PTCACHE_TYPE_CLOTH)
- cloth_free_modifier(pid->ob, pid->calldata);
+ cloth_free_modifier(pid->calldata);
else if(pid->type == PTCACHE_TYPE_SOFTBODY)
sbFreeSimulation(pid->calldata);
else if(pid->type == PTCACHE_TYPE_PARTICLES)
@@ -2993,13 +2995,17 @@ void BKE_ptcache_update_info(PTCacheID *pid)
void BKE_ptcache_validate(PointCache *cache, int framenr)
{
- cache->flag |= PTCACHE_SIMULATION_VALID;
- cache->simframe = framenr;
+ if(cache) {
+ cache->flag |= PTCACHE_SIMULATION_VALID;
+ cache->simframe = framenr;
+ }
}
void BKE_ptcache_invalidate(PointCache *cache)
{
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe = 0;
- cache->last_exact = MIN2(cache->startframe, 0);
+ if(cache) {
+ cache->flag &= ~PTCACHE_SIMULATION_VALID;
+ cache->simframe = 0;
+ cache->last_exact = MIN2(cache->startframe, 0);
+ }
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 8793c412d7d..e399e0bb83d 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -106,7 +106,7 @@ void free_qtcodecdata(QuicktimeCodecData *qcd)
}
}
-Scene *copy_scene(Main *bmain, Scene *sce, int type)
+Scene *copy_scene(Scene *sce, int type)
{
Scene *scen;
ToolSettings *ts;
@@ -210,6 +210,9 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type)
if(type == SCE_COPY_LINK_DATA || type == SCE_COPY_FULL) {
ID_NEW(scen->camera);
}
+
+ /* before scene copy */
+ sound_create_scene(scen);
/* world */
if(type == SCE_COPY_FULL) {
@@ -221,12 +224,10 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type)
if(sce->ed) {
scen->ed= MEM_callocN( sizeof(Editing), "addseq");
scen->ed->seqbasep= &scen->ed->seqbase;
- seqbase_dupli_recursive(sce, &scen->ed->seqbase, &sce->ed->seqbase, SEQ_DUPE_ALL);
+ seqbase_dupli_recursive(sce, scen, &scen->ed->seqbase, &sce->ed->seqbase, SEQ_DUPE_ALL);
}
}
- sound_create_scene(scen);
-
return scen;
}
@@ -565,11 +566,11 @@ Scene *set_scene_name(Main *bmain, char *name)
Scene *sce= (Scene *)find_id("SC", name);
if(sce) {
set_scene_bg(bmain, sce);
- printf("Scene switch: '%s' in file: '%s'\n", name, G.sce);
+ printf("Scene switch: '%s' in file: '%s'\n", name, G.main->name);
return sce;
}
- printf("Can't find scene: '%s' in file: '%s'\n", name, G.sce);
+ printf("Can't find scene: '%s' in file: '%s'\n", name, G.main->name);
return NULL;
}
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 7b428661c6d..6477c6b4f75 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -53,7 +53,7 @@
#include "RNA_access.h"
/* **** XXX **** */
-static void error(const char *error, ...) {}
+static void error(const char *UNUSED(error), ...) {}
#define INT 96
#define FLO 128
@@ -77,15 +77,15 @@ static struct ImBuf * prepare_effect_imbufs(
if (!ibuf1 && !ibuf2 && !ibuf3) {
/* hmmm, global float option ? */
- out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0);
+ out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect);
} else if ((ibuf1 && ibuf1->rect_float) ||
(ibuf2 && ibuf2->rect_float) ||
(ibuf3 && ibuf3->rect_float)) {
/* if any inputs are rectfloat, output is float too */
- out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat, 0);
+ out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat);
} else {
- out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0);
+ out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect);
}
if (ibuf1 && !ibuf1->rect_float && out->rect_float) {
@@ -273,9 +273,9 @@ static ImBuf * IMB_cast_away_list(ImBuf * i)
}
static struct ImBuf * do_plugin_effect(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float cfra,
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -370,8 +370,8 @@ static struct ImBuf * do_plugin_effect(
return out;
}
-static int do_plugin_early_out(struct Sequence *seq,
- float facf0, float facf1)
+static int do_plugin_early_out(struct Sequence *UNUSED(seq),
+ float UNUSED(facf0), float UNUSED(facf1))
{
return 0;
}
@@ -524,9 +524,9 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
}
static struct ImBuf * do_alphaover_effect(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -696,9 +696,9 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
}
static struct ImBuf* do_alphaunder_effect(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -821,9 +821,9 @@ void do_cross_effect_float(float facf0, float facf1, int x, int y,
/* carefull: also used by speed effect! */
static struct ImBuf* do_cross_effect(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -976,19 +976,19 @@ static void build_gammatabs()
}
}
-static void init_gammacross(Sequence * seq)
+static void init_gammacross(Sequence * UNUSED(seq))
{
}
-static void load_gammacross(Sequence * seq)
+static void load_gammacross(Sequence * UNUSED(seq))
{
}
-static void free_gammacross(Sequence * seq)
+static void free_gammacross(Sequence * UNUSED(seq))
{
}
-static void do_gammacross_effect_byte(float facf0, float facf1,
+static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1),
int x, int y,
unsigned char *rect1,
unsigned char *rect2,
@@ -1044,7 +1044,7 @@ static void do_gammacross_effect_byte(float facf0, float facf1,
}
-static void do_gammacross_effect_float(float facf0, float facf1,
+static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
int x, int y,
float *rect1, float *rect2,
float *out)
@@ -1088,9 +1088,9 @@ static void do_gammacross_effect_float(float facf0, float facf1,
}
static struct ImBuf * do_gammacross_effect(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -1206,9 +1206,9 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y,
}
}
-static struct ImBuf * do_add_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra,
+static struct ImBuf * do_add_effect(Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -1323,9 +1323,9 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y,
}
static struct ImBuf * do_sub_effect(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -1537,9 +1537,9 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
}
static struct ImBuf * do_mul_effect(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -1876,7 +1876,7 @@ static void copy_wipe_effect(Sequence *dst, Sequence *src)
dst->effectdata = MEM_dupallocN(src->effectdata);
}
-static void do_wipe_effect_byte(Sequence *seq, float facf0, float facf1,
+static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
int x, int y,
unsigned char *rect1,
unsigned char *rect2, unsigned char *out)
@@ -1934,7 +1934,7 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float facf1,
}
}
-static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1,
+static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1),
int x, int y,
float *rect1,
float *rect2, float *out)
@@ -1993,9 +1993,9 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1,
}
static struct ImBuf * do_wipe_effect(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -2111,7 +2111,7 @@ static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out
}
}
-static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y,
+static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x, int y,
struct ImBuf *ibuf1,struct ImBuf *out)
{
TransformVars *transform = (TransformVars *)seq->effectdata;
@@ -2144,9 +2144,9 @@ static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y,
static struct ImBuf * do_transform_effect(
- Main *bmain, Scene *scene, Sequence *seq,float cfra,
- float facf0, float facf1, int x, int y,
- int preview_render_size,
+ Main *UNUSED(bmain), Scene *scene, Sequence *seq,float UNUSED(cfra),
+ float facf0, float UNUSED(facf1), int x, int y,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -2631,9 +2631,9 @@ static void copy_glow_effect(Sequence *dst, Sequence *src)
}
//void do_glow_effect(Cast *cast, float facf0, float facf1, int xo, int yo, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *outbuf, ImBuf *use)
-static void do_glow_effect_byte(Sequence *seq, float facf0, float facf1,
+static void do_glow_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
int x, int y, char *rect1,
- char *rect2, char *out)
+ char *UNUSED(rect2), char *out)
{
unsigned char *outbuf=(unsigned char *)out;
unsigned char *inbuf=(unsigned char *)rect1;
@@ -2646,9 +2646,9 @@ static void do_glow_effect_byte(Sequence *seq, float facf0, float facf1,
RVAddBitmaps_byte (inbuf , outbuf, outbuf, x, y);
}
-static void do_glow_effect_float(Sequence *seq, float facf0, float facf1,
+static void do_glow_effect_float(Sequence *seq, float facf0, float UNUSED(facf1),
int x, int y,
- float *rect1, float *rect2, float *out)
+ float *rect1, float *UNUSED(rect2), float *out)
{
float *outbuf = out;
float *inbuf = rect1;
@@ -2662,9 +2662,9 @@ static void do_glow_effect_float(Sequence *seq, float facf0, float facf1,
}
static struct ImBuf * do_glow_effect(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -2716,16 +2716,16 @@ static void copy_solid_color(Sequence *dst, Sequence *src)
dst->effectdata = MEM_dupallocN(src->effectdata);
}
-static int early_out_color(struct Sequence *seq,
- float facf0, float facf1)
+static int early_out_color(struct Sequence *UNUSED(seq),
+ float UNUSED(facf0), float UNUSED(facf1))
{
return -1;
}
static struct ImBuf * do_solid_color(
- Main *bmain, Scene *scene, Sequence *seq, float cfra,
+ Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra),
float facf0, float facf1, int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@@ -2813,17 +2813,17 @@ static int num_inputs_multicam()
return 0;
}
-static int early_out_multicam(struct Sequence *seq, float facf0, float facf1)
+static int early_out_multicam(struct Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1))
{
return -1;
}
static struct ImBuf * do_multicam(
Main *bmain, Scene *scene, Sequence *seq, float cfra,
- float facf0, float facf1, int x, int y,
+ float UNUSED(facf0), float UNUSED(facf1), int x, int y,
int preview_render_size,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3)
+ struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2),
+ struct ImBuf *UNUSED(ibuf3))
{
struct ImBuf * i;
struct ImBuf * out;
@@ -2907,14 +2907,14 @@ static void copy_speed_effect(Sequence *dst, Sequence *src)
v->length = 0;
}
-static int early_out_speed(struct Sequence *seq,
- float facf0, float facf1)
+static int early_out_speed(struct Sequence *UNUSED(seq),
+ float UNUSED(facf0), float UNUSED(facf1))
{
return 1;
}
static void store_icu_yrange_speed(struct Sequence * seq,
- short adrcode, float * ymin, float * ymax)
+ short UNUSED(adrcode), float * ymin, float * ymax)
{
SpeedControlVars * v = (SpeedControlVars *)seq->effectdata;
@@ -3039,22 +3039,22 @@ static void do_speed_effect(Sequence * seq,int cfra,
********************************************************************** */
-static void init_noop(struct Sequence *seq)
+static void init_noop(struct Sequence *UNUSED(seq))
{
}
-static void load_noop(struct Sequence *seq)
+static void load_noop(struct Sequence *UNUSED(seq))
{
}
-static void init_plugin_noop(struct Sequence *seq, const char * fname)
+static void init_plugin_noop(struct Sequence *UNUSED(seq), const char *UNUSED(fname))
{
}
-static void free_noop(struct Sequence *seq)
+static void free_noop(struct Sequence *UNUSED(seq))
{
}
@@ -3064,13 +3064,13 @@ static int num_inputs_default()
return 2;
}
-static int early_out_noop(struct Sequence *seq,
- float facf0, float facf1)
+static int early_out_noop(struct Sequence *UNUSED(seq),
+ float UNUSED(facf0), float UNUSED(facf1))
{
return 0;
}
-static int early_out_fade(struct Sequence *seq,
+static int early_out_fade(struct Sequence *UNUSED(seq),
float facf0, float facf1)
{
if (facf0 == 0.0 && facf1 == 0.0) {
@@ -3081,7 +3081,7 @@ static int early_out_fade(struct Sequence *seq,
return 0;
}
-static int early_out_mul_input2(struct Sequence *seq,
+static int early_out_mul_input2(struct Sequence *UNUSED(seq),
float facf0, float facf1)
{
if (facf0 == 0.0 && facf1 == 0.0) {
@@ -3090,13 +3090,13 @@ static int early_out_mul_input2(struct Sequence *seq,
return 0;
}
-static void store_icu_yrange_noop(struct Sequence * seq,
- short adrcode, float * ymin, float * ymax)
+static void store_icu_yrange_noop(struct Sequence * UNUSED(seq),
+ short UNUSED(adrcode), float *UNUSED(ymin), float *UNUSED(ymax))
{
/* defaults are fine */
}
-static void get_default_fac_noop(struct Sequence *seq, float cfra,
+static void get_default_fac_noop(struct Sequence *UNUSED(seq), float UNUSED(cfra),
float * facf0, float * facf1)
{
*facf0 = *facf1 = 1.0;
@@ -3111,10 +3111,10 @@ static void get_default_fac_fade(struct Sequence *seq, float cfra,
*facf1 /= seq->len;
}
-static struct ImBuf * do_overdrop_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra,
+static struct ImBuf * do_overdrop_effect(Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1,
int x, int y,
- int preview_render_size,
+ int UNUSED(preview_render_size),
struct ImBuf * ibuf1,
struct ImBuf * ibuf2,
struct ImBuf * ibuf3)
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index b6bb5c3a51b..21b7cfd010c 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -554,7 +554,7 @@ void calc_sequence(Scene *scene, Sequence *seq)
}
/* note: caller should run calc_sequence(scene, seq) after */
-void reload_sequence_new_file(Main *bmain, Scene *scene, Sequence * seq, int lock_range)
+void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
{
char str[FILE_MAXDIR+FILE_MAXFILE];
int prev_startdisp, prev_enddisp;
@@ -579,7 +579,7 @@ void reload_sequence_new_file(Main *bmain, Scene *scene, Sequence * seq, int loc
if (seq->type != SEQ_SCENE && seq->type != SEQ_META &&
seq->type != SEQ_IMAGE) {
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
}
if (seq->type == SEQ_IMAGE) {
@@ -621,7 +621,7 @@ void reload_sequence_new_file(Main *bmain, Scene *scene, Sequence * seq, int loc
seq->strip->len = seq->len;
} else if (seq->type == SEQ_SCENE) {
/* 'seq->scenenr' should be replaced with something more reliable */
- Scene * sce = bmain->scene.first;
+ Scene * sce = G.main->scene.first;
int nr = 1;
while(sce) {
@@ -1005,7 +1005,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
}
}
- for (;b <= chanshown; b++) {
+ for (;b <= chanshown && b >= 0; b++) {
if (video_seq_is_rendered(seq_arr[b])) {
seq_arr_out[cnt++] = seq_arr[b];
}
@@ -1021,7 +1021,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
#define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE)
-static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * name, int render_size)
+static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, char * name, int render_size)
{
int frameno;
char dir[FILE_MAXDIR];
@@ -1044,7 +1044,7 @@ static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * na
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
BLI_join_dirfile(name, dir, seq->strip->proxy->file);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
return TRUE;
}
@@ -1071,7 +1071,7 @@ static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * na
render_size);
}
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
BLI_path_frame(name, frameno, 0);
@@ -1444,7 +1444,7 @@ static void color_balance(Sequence * seq, ImBuf* ibuf, float mul)
*/
int input_have_to_preprocess(
- Scene *scene, Sequence * seq, float cfra, int seqrectx, int seqrecty)
+ Scene *UNUSED(scene), Sequence * seq, float UNUSED(cfra), int UNUSED(seqrectx), int UNUSED(seqrecty))
{
float mul;
@@ -1476,7 +1476,7 @@ int input_have_to_preprocess(
}
static ImBuf * input_preprocess(
- Scene *scene, Sequence *seq, float cfra, int seqrectx, int seqrecty,
+ Scene *scene, Sequence *seq, float UNUSED(cfra), int seqrectx, int seqrecty,
ImBuf * ibuf)
{
float mul;
@@ -1521,9 +1521,9 @@ static ImBuf * input_preprocess(
ImBuf * i;
if (ibuf->rect_float) {
- i = IMB_allocImBuf(dx, dy,32, IB_rectfloat, 0);
+ i = IMB_allocImBuf(dx, dy,32, IB_rectfloat);
} else {
- i = IMB_allocImBuf(dx, dy,32, IB_rect, 0);
+ i = IMB_allocImBuf(dx, dy,32, IB_rect);
}
IMB_rectcpy(i, ibuf,
@@ -1787,7 +1787,7 @@ finish:
if (!out) {
out = IMB_allocImBuf(
- (short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
+ (short)seqrectx, (short)seqrecty, 32, IB_rect);
}
return out;
@@ -1861,6 +1861,15 @@ static ImBuf * seq_render_scene_strip_impl(
if(rendering)
re= RE_NewRender(" do_build_seq_ibuf");
+ /* If the top level scene that does the sequencer rendering is included
+ * as a strip the default render name for the strip will conflict with
+ * the original render, so override the name in this case.
+ * See bugs #22236 and #24160 for examples.
+ * XXX: Somebody with deeper insight to the rendering pipeline should
+ * probably check if this is the best way to handle this. -jahka
+ */
+ else if(seq->scene == scene)
+ re= RE_NewRender("scene_conflict_render");
else
re= RE_NewRender(sce->id.name);
@@ -1869,7 +1878,7 @@ static ImBuf * seq_render_scene_strip_impl(
RE_AcquireResultImage(re, &rres);
if(rres.rectf) {
- ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat, 0);
+ ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat);
memcpy(ibuf->rect_float, rres.rectf, 4*sizeof(float)*rres.rectx*rres.recty);
if(rres.rectz) {
addzbuffloatImBuf(ibuf);
@@ -1881,7 +1890,7 @@ static ImBuf * seq_render_scene_strip_impl(
IMB_convert_profile(ibuf, IB_PROFILE_SRGB);
}
else if (rres.rect32) {
- ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect, 0);
+ ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect);
memcpy(ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty);
}
@@ -1993,7 +2002,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
if(ibuf == 0 && s_elem) {
BLI_join_dirfile(name, seq->strip->dir, s_elem->name);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
ibuf = seq_proxy_fetch(scene, seq, cfra, render_size);
}
@@ -2029,7 +2038,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
BLI_join_dirfile(name,
seq->strip->dir,
seq->strip->stripdata->name);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
seq->anim = openanim(
name, IB_rect |
@@ -2070,7 +2079,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
if (!ibuf) {
ibuf = IMB_allocImBuf(
- (short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
+ (short)seqrectx, (short)seqrecty, 32, IB_rect);
}
if (ibuf->x != seqrectx || ibuf->y != seqrecty) {
@@ -2204,7 +2213,7 @@ static ImBuf* seq_render_strip_stack(
if (i == 0) {
out = IMB_allocImBuf(
(short)seqrectx, (short)seqrecty,
- 32, IB_rect, 0);
+ 32, IB_rect);
}
break;
case 0:
@@ -3483,7 +3492,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
struct anim *an;
BLI_strncpy(path, seq_load->path, sizeof(path));
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
an = openanim(path, IB_rect);
@@ -3531,8 +3540,9 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
}
-static Sequence *seq_dupli(struct Scene *scene, Sequence *seq, int dupe_flag)
+static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence *seq, int dupe_flag)
{
+ Scene *sce_audio= scene_to ? scene_to : scene;
Sequence *seqn = MEM_dupallocN(seq);
seq->tmp = seqn;
@@ -3566,7 +3576,7 @@ static Sequence *seq_dupli(struct Scene *scene, Sequence *seq, int dupe_flag)
} else if(seq->type == SEQ_SCENE) {
seqn->strip->stripdata = 0;
if(seq->scene_sound)
- seqn->scene_sound = sound_scene_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
+ seqn->scene_sound = sound_scene_add_scene_sound(sce_audio, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
} else if(seq->type == SEQ_MOVIE) {
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
@@ -3575,7 +3585,7 @@ static Sequence *seq_dupli(struct Scene *scene, Sequence *seq, int dupe_flag)
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
if(seq->scene_sound)
- seqn->scene_sound = sound_add_scene_sound(scene, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
+ seqn->scene_sound = sound_add_scene_sound(sce_audio, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
seqn->sound->id.us++;
} else if(seq->type == SEQ_IMAGE) {
@@ -3610,13 +3620,13 @@ static Sequence *seq_dupli(struct Scene *scene, Sequence *seq, int dupe_flag)
return seqn;
}
-Sequence * seq_dupli_recursive(struct Scene *scene, Sequence * seq, int dupe_flag)
+Sequence * seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequence * seq, int dupe_flag)
{
- Sequence * seqn = seq_dupli(scene, seq, dupe_flag);
+ Sequence * seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
if (seq->type == SEQ_META) {
Sequence *s;
for(s= seq->seqbase.first; s; s = s->next) {
- Sequence *n = seq_dupli_recursive(scene, s, dupe_flag);
+ Sequence *n = seq_dupli_recursive(scene, scene_to, s, dupe_flag);
if (n) {
BLI_addtail(&seqn->seqbase, n);
}
@@ -3625,7 +3635,7 @@ Sequence * seq_dupli_recursive(struct Scene *scene, Sequence * seq, int dupe_fla
return seqn;
}
-void seqbase_dupli_recursive(Scene *scene, ListBase *nseqbase, ListBase *seqbase, int dupe_flag)
+void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag)
{
Sequence *seq;
Sequence *seqn = 0;
@@ -3634,7 +3644,7 @@ void seqbase_dupli_recursive(Scene *scene, ListBase *nseqbase, ListBase *seqbase
for(seq= seqbase->first; seq; seq= seq->next) {
seq->tmp= NULL;
if((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) {
- seqn = seq_dupli(scene, seq, dupe_flag);
+ seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
if (seqn) { /*should never fail */
if(dupe_flag & SEQ_DUPE_CONTEXT) {
seq->flag &= ~SEQ_ALLSEL;
@@ -3643,7 +3653,7 @@ void seqbase_dupli_recursive(Scene *scene, ListBase *nseqbase, ListBase *seqbase
BLI_addtail(nseqbase, seqn);
if(seq->type==SEQ_META)
- seqbase_dupli_recursive(scene, &seqn->seqbase, &seq->seqbase, dupe_flag);
+ seqbase_dupli_recursive(scene, scene_to, &seqn->seqbase, &seq->seqbase, dupe_flag);
if(dupe_flag & SEQ_DUPE_CONTEXT) {
if (seq == last_seq) {
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 965ce9801d7..d1eed94d330 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -435,7 +435,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
}
/*! init triangle divisions */
-void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len)
+void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len)
{
// mTriangleDivs1.resize( faces.size() );
// mTriangleDivs2.resize( faces.size() );
@@ -1270,7 +1270,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
}
}
}
-void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc)
+void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
{
if((smd->type & MOD_SMOKE_TYPE_FLOW))
{
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 98a50eee146..978b3c9864f 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -171,7 +171,7 @@ static void Vec3PlusStVec(float *v, float s, float *v1);
/*physical unit of force is [kg * m / sec^2]*/
-static float sb_grav_force_scale(Object *ob)
+static float sb_grav_force_scale(Object *UNUSED(ob))
/* since unit of g is [m/sec^2] and F = mass * g we rescale unit mass of node to 1 gramm
put it to a function here, so we can add user options later without touching simulation code
*/
@@ -179,7 +179,7 @@ static float sb_grav_force_scale(Object *ob)
return (0.001f);
}
-static float sb_fric_force_scale(Object *ob)
+static float sb_fric_force_scale(Object *UNUSED(ob))
/* rescaling unit of drag [1 / sec] to somehow reasonable
put it to a function here, so we can add user options later without touching simulation code
*/
@@ -678,7 +678,7 @@ static void add_mesh_quad_diag_springs(Object *ob)
}
}
-static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int addsprings)
+static void add_2nd_order_roller(Object *ob,float UNUSED(stiffness), int *counter, int addsprings)
{
/*assume we have a softbody*/
SoftBody *sb= ob->soft; /* is supposed to be there */
@@ -1029,7 +1029,7 @@ static int query_external_colliders(Scene *scene, Object *me)
/* +++ the aabb "force" section*/
-static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_layer,struct Object *vertexowner,float time)
+static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int UNUSED(par_layer),struct Object *vertexowner,float UNUSED(time))
{
Object *ob;
SoftBody *sb=vertexowner->soft;
@@ -1094,7 +1094,7 @@ static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_laye
/* +++ the face external section*/
static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp,
- float force[3], unsigned int par_layer,struct Object *vertexowner,float time)
+ float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time)
{
Object *ob;
GHash *hash;
@@ -1192,7 +1192,7 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp,
- float force[3], unsigned int par_layer,struct Object *vertexowner,float time)
+ float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time)
{
Object *ob;
GHash *hash;
@@ -1418,7 +1418,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
/* +++ the spring external section*/
static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],float *damp,
- float force[3], unsigned int par_layer,struct Object *vertexowner,float time)
+ float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time)
{
Object *ob;
GHash *hash;
@@ -1659,7 +1659,7 @@ static void *exec_scan_for_ext_spring_forces(void *data)
return 0;
}
-static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *ptr_to_break_func())
+static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *UNUSED(ptr_to_break_func()))
{
ListBase *do_effector = NULL;
ListBase threads;
@@ -1749,7 +1749,7 @@ static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,fl
static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], float *damp,
- float force[3], unsigned int par_layer,struct Object *vertexowner,
+ float force[3], unsigned int UNUSED(par_layer), struct Object *vertexowner,
float time,float vel[3], float *intrusion)
{
Object *ob= NULL;
@@ -2084,7 +2084,7 @@ static void dfdv_goal(int ia, int ic,float factor)
for(i=0;i<3;i++) nlMatrixAdd(ia+i,ic+i,factor);
}
*/
-static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float forcetime,int nl_flags)
+static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UNUSED(forcetime), int nl_flags)
{
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp1,*bp2;
@@ -2175,7 +2175,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float fo
/* since this is definitely the most CPU consuming task here .. try to spread it */
/* core function _softbody_calc_forces_slice_in_a_thread */
/* result is int to be able to flag user break */
-static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *ptr_to_break_func(),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
+static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *UNUSED(ptr_to_break_func()),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
{
float iks;
int bb,do_selfcollision,do_springcollision,do_aero;
@@ -2386,7 +2386,7 @@ static void *exec_softbody_calc_forces(void *data)
return 0;
}
-static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *ptr_to_break_func(),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
+static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *UNUSED(ptr_to_break_func()),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
{
ListBase threads;
SB_thread_context *sb_threads;
@@ -2444,7 +2444,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
MEM_freeN(sb_threads);
}
-static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, float timenow, int nl_flags)
+static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, float timenow, int UNUSED(nl_flags))
{
/* rule we never alter free variables :bp->vec bp->pos in here !
* this will ruin adaptive stepsize AKA heun! (BM)
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 5e95b19b64f..cc941c81131 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -110,6 +110,8 @@ void sound_init(struct Main *bmain)
#ifdef WITH_JACK
AUD_setSyncCallback(sound_sync_callback, bmain);
+#else
+ (void)bmain; /* unused */
#endif
}
@@ -129,7 +131,7 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename)
strcpy(str, filename);
- path = /*bmain ? bmain->name :*/ G.sce;
+ path = /*bmain ? bmain->name :*/ G.main->name;
BLI_path_abs(str, path);
@@ -234,7 +236,7 @@ void sound_delete_cache(struct bSound* sound)
}
}
-void sound_load(struct Main *bmain, struct bSound* sound)
+void sound_load(struct Main *UNUSED(bmain), struct bSound* sound)
{
if(sound)
{
@@ -264,7 +266,8 @@ void sound_load(struct Main *bmain, struct bSound* sound)
if(sound->id.lib)
path = sound->id.lib->filepath;
else
- path = /*bmain ? bmain->name :*/ G.sce;
+ // XXX this should be fixed!
+ path = /*bmain ? bmain->name :*/ G.main->name;
BLI_path_abs(fullpath, path);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 90a8ca03079..f056731d10e 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -117,13 +117,13 @@ static void *arena_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSiz
}
return p2;
}
-static void arena_free(CCGAllocatorHDL a, void *ptr) {
+static void arena_free(CCGAllocatorHDL UNUSED(a), void *UNUSED(ptr)) {
}
static void arena_release(CCGAllocatorHDL a) {
BLI_memarena_free(a);
}
-static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, GridKey *gridkey, int subdivLevels, int useAging, int useArena, int useFlatSubdiv) {
+static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, GridKey *gridkey, int subdivLevels, int useAging, int useArena, int UNUSED(useFlatSubdiv)) {
CCGMeshIFC ifc;
CCGSubSurf *ccgSS;
@@ -1261,7 +1261,7 @@ static void ccgDM_drawVerts(DerivedMesh *dm) {
ccgFaceIterator_free(fi);
glEnd();
}
-static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges) {
+static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
@@ -1650,7 +1650,7 @@ static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *a
dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL);
}
-static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned char *col1, unsigned char *col2) {
+static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), unsigned char *col1, unsigned char *col2) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
@@ -1757,9 +1757,12 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
if(drawParams)
flag = drawParams(tf, mcol, mat_nr);
- else
+ else if (index != ORIGINDEX_NONE)
flag= (drawParamsMapped)? drawParamsMapped(userData, index): 1;
-
+ else
+ flag= GPU_enable_material(mat_nr, NULL) ? 1:0;
+
+
if (flag == 0) { /* flag 0 == the face is hidden or invisible */
if(tf) tf += gridFaces*gridFaces*numVerts;
if(mcol) mcol += gridFaces*gridFaces*numVerts*4;
@@ -1915,7 +1918,9 @@ static void gl_color_from_grid(DMGridData *elem, GridKey *gridkey)
static void ccgDM_drawMappedFaces(DerivedMesh *dm,
float (*partial_redraw_planes)[4],
int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r),
- void *userData, DMDrawFlags flags) {
+ void *userData,
+ int (*setMaterial)(int, void *attribs),
+ DMDrawFlags flags) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
MCol *mcol= NULL;
@@ -1958,10 +1963,14 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
mcol += gridFaces*gridFaces*numVerts*4;
}
- if (index!=-1) {
- int draw;
- draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, index, &drawSmooth);
-
+ {
+ int draw= 1;
+
+ if(index == ORIGINDEX_NONE)
+ draw= setMaterial(faceFlags ? faceFlags[origIndex*2 + 1] + 1: 1, NULL); /* XXX, no faceFlags no material */
+ else if (setDrawOptions)
+ draw= setDrawOptions(userData, index, &drawSmooth);
+
if (draw) {
if (draw==2) {
glEnable(GL_POLYGON_STIPPLE);
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 19bc853276a..bb1a1a88a09 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -241,7 +241,7 @@ int reopen_text(Text *text)
if (!text || !text->name) return 0;
BLI_strncpy(str, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
fp= fopen(str, "r");
if(fp==NULL) return 0;
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 3d984c7e877..25aab77ba9b 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -398,7 +398,6 @@ void bUnit_AsString(char *str, int len_max, double value, int prec, int system,
/* split output makes sense only for length, mass and time */
if(split && (type==B_UNIT_LENGTH || type==B_UNIT_MASS || type==B_UNIT_TIME)) {
- int i;
bUnitDef *unit_a, *unit_b;
double value_a, value_b;
@@ -406,7 +405,7 @@ void bUnit_AsString(char *str, int len_max, double value, int prec, int system,
/* check the 2 is a smaller unit */
if(unit_b > unit_a) {
- i= unit_as_string(str, len_max, value_a, prec, usys, unit_a, '\0');
+ int i= unit_as_string(str, len_max, value_a, prec, usys, unit_a, '\0');
/* is there enough space for at least 1 char of the next unit? */
if(i+2 < len_max) {
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 00614ef0f4f..de708f216fd 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -40,6 +40,7 @@
#include "BLI_blenlib.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_utildefines.h"
#include "BKE_writeavi.h"
@@ -119,7 +120,7 @@ static void filepath_avi (char *string, RenderData *rd)
if (string==NULL) return;
strcpy(string, rd->pic);
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_make_existing_file(string);
@@ -137,6 +138,8 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
int quality;
double framerate;
+ (void)scene; /* unused */
+
filepath_avi(name, rd);
sframe = (rd->sfra);
@@ -175,7 +178,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
return 1;
}
-static int append_avi(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports)
+static int append_avi(RenderData *UNUSED(rd), int frame, int *pixels, int rectx, int recty, ReportList *UNUSED(reports))
{
unsigned int *rt1, *rt2, *rectot;
int x, y;
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 473c10d6ced..aae26da02dd 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -19,7 +19,7 @@
#include <string.h>
#include <stdio.h>
-#if defined(_WIN32) && defined(_DEBUG) && !defined(__MINGW32__) && !defined(__CYGWIN__)
+#if defined(_WIN32) && defined(DEBUG) && !defined(__MINGW32__) && !defined(__CYGWIN__)
/* This does not seem necessary or present on MSVC 8, but may be needed in earlier versions? */
#if _MSC_VER < 1400
#include <stdint.h>
@@ -857,7 +857,7 @@ void filepath_ffmpeg(char* string, RenderData* rd) {
if (!string || !exts) return;
strcpy(string, rd->pic);
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_make_existing_file(string);
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index b0c05c31fa1..bbc441f3622 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -47,6 +47,7 @@
#include "DNA_userdef_types.h"
+#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_report.h"
@@ -96,10 +97,12 @@ static int closesocket(int fd)
}
#endif
-int start_frameserver(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
+int start_frameserver(struct Scene *scene, RenderData *UNUSED(rd), int rectx, int recty, ReportList *reports)
{
struct sockaddr_in addr;
int arg = 1;
+
+ (void)scene; /* unused */
if (!startup_socket_system()) {
BKE_report(reports, RPT_ERROR, "Can't startup socket system");
@@ -243,7 +246,7 @@ static int handle_request(RenderData *rd, char * req)
return -1;
}
-int frameserver_loop(RenderData *rd, ReportList *reports)
+int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports))
{
fd_set readfds;
struct timeval tv;
@@ -350,7 +353,7 @@ static void serve_ppm(int *pixels, int rectx, int recty)
connsock = -1;
}
-int append_frameserver(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports)
+int append_frameserver(RenderData *UNUSED(rd), int frame, int *pixels, int rectx, int recty, ReportList *UNUSED(reports))
{
fprintf(stderr, "Serving frame: %d\n", frame);
if (write_ppm) {
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h
index 72489a171b9..34b9e282061 100644
--- a/source/blender/blenlib/BLI_bpath.h
+++ b/source/blender/blenlib/BLI_bpath.h
@@ -50,7 +50,7 @@ struct BPathIterator {
void (*setpath_callback)(struct BPathIterator *, char *);
void (*getpath_callback)(struct BPathIterator *, char *);
- char* base_path; /* base path, the directry the blend file is in - normally G.sce */
+ char* base_path; /* base path, the directry the blend file is in - normally G.main->name */
/* only for seq data */
struct BPathIteratorSeqData seqdata;
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index 6c98d30e4b1..b721a21b1b9 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -36,6 +36,10 @@
#ifndef BLI_FILEOPS_H
#define BLI_FILEOPS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void BLI_recurdir_fileops(char *dirname);
int BLI_link(char *file, char *to);
int BLI_is_writable(char *filename);
@@ -60,5 +64,9 @@ char *first_slash(char *string);
void BLI_setCmdCallBack(int (*f)(char*));
#endif
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 48ad46282c2..77266e2e9d8 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -70,6 +70,11 @@ extern "C" {
#define M_LN10 2.30258509299404568402
#endif
+/* non-standard defines, used in some places */
+#ifndef MAXFLOAT
+#define MAXFLOAT ((float)3.40282347e+38)
+#endif
+
#ifndef sqrtf
#define sqrtf(a) ((float)sqrt(a))
#endif
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index 2f40520e59a..2095c40b5aa 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -61,6 +61,7 @@ void cpack_to_rgb(unsigned int col, float *r, float *g, float *b);
void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv);
void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace);
void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv);
+void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv);
unsigned int rgb_to_cpack(float r, float g, float b);
unsigned int hsv_to_cpack(float h, float s, float v);
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 77ebcb24975..6b3d8bf9d0b 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -102,7 +102,9 @@ void transpose_m3(float R[3][3]);
void transpose_m4(float R[4][4]);
void normalize_m3(float R[3][3]);
+void normalize_m3_m3(float R[3][3], const float A[3][3]);
void normalize_m4(float R[4][4]);
+void normalize_m4_m4(float R[4][4], const float A[4][4]);
void orthogonalize_m3(float R[3][3], int axis);
void orthogonalize_m4(float R[4][4], int axis);
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index 1b3f4dced02..321fd28a62f 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -169,6 +169,9 @@ void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq);
void mat4_to_dquat(DualQuat *r, float base[4][4], float M[4][4]);
void dquat_to_mat4(float R[4][4], DualQuat *dq);
+void quat_apply_track(float quat[4], short axis, short upflag);
+void vec_apply_track(float vec[3], short axis);
+
float lens_to_angle(float lens);
float angle_to_lens(float angle);
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index b160097a33d..5c17ac6b639 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -129,6 +129,8 @@ MINLINE int compare_len_v3v3(float a[3], float b[3], float limit);
MINLINE int compare_v4v4(float a[4], float b[4], float limit);
MINLINE int equals_v4v4(float a[4], float b[4]);
+MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]);
+
/********************************** Angles ***********************************/
/* - angle with 2 arguments is angle between vector */
/* - angle with 3 arguments is angle between 3 points at the middle point */
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index 0ae40c0b83d..bae5375f757 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -50,7 +50,7 @@ extern "C" {
/* scanfill.c: used in displist only... */
struct EditVert *BLI_addfillvert(float *vec);
struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2);
-int BLI_edgefill(int mode, int mat_nr);
+int BLI_edgefill(int mat_nr);
void BLI_end_edgefill(void);
/* These callbacks are needed to make the lib finction properly */
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index cf94a0c9ffe..0d541c1fe37 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -132,6 +132,7 @@ void BLI_kdtree_balance(KDTree *tree)
static float squared_distance(float *v2, float *v1, float *n1, float *n2)
{
float d[3], dist;
+ (void)n1; /* unused */
d[0]= v2[0]-v1[0];
d[1]= v2[1]-v1[1];
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index cf7eb873409..862df4103a7 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -92,7 +92,7 @@ void BLI_bpathIterator_init( struct BPathIterator *bpi, char *base_path ) {
bpi->seqdata.seqar = NULL;
bpi->seqdata.scene = NULL;
- bpi->base_path= base_path ? base_path : G.sce;
+ bpi->base_path= base_path ? base_path : G.main->name;
BLI_bpathIterator_step(bpi);
}
diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c
index 55d6ce7a241..a674f38cec6 100644
--- a/source/blender/blenlib/intern/dynlib.c
+++ b/source/blender/blenlib/intern/dynlib.c
@@ -122,6 +122,7 @@ void *PIL_dynlib_find_symbol(PILdynlib* lib, char *symname) {
}
char *PIL_dynlib_get_error_as_string(PILdynlib* lib) {
+ (void)lib; /* unused */
return dlerror();
}
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 2b6a091cc8d..c481744156a 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -25,6 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
* */
+#include <assert.h>
#include "BLI_math.h"
@@ -133,6 +134,8 @@ void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, in
cb=(-0.16874f*sr)-(0.33126f*sg)+(0.5f*sb)+128.0f;
cr=(0.5f*sr)-(0.41869f*sg)-(0.08131f*sb)+128.0f;
break;
+ default:
+ assert(!"invalid colorspace");
}
*ly=y;
@@ -163,6 +166,8 @@ void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, in
g=y-0.34414f*cb - 0.71414f*cr + 135.45984f;
b=y+1.772f*cb - 226.816f;
break;
+ default:
+ assert(!"invalid colorspace");
}
*lr=r/255.0f;
*lg=g/255.0f;
@@ -172,13 +177,16 @@ void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, in
void hex_to_rgb(char *hexcol, float *r, float *g, float *b)
{
unsigned int ri, gi, bi;
-
+
if (hexcol[0] == '#') hexcol++;
-
- if (sscanf(hexcol, "%02x%02x%02x", &ri, &gi, &bi)) {
+
+ if (sscanf(hexcol, "%02x%02x%02x", &ri, &gi, &bi)==3) {
*r = ri / 255.0f;
*g = gi / 255.0f;
*b = bi / 255.0f;
+ CLAMP(*r, 0.0f, 1.0f);
+ CLAMP(*g, 0.0f, 1.0f);
+ CLAMP(*b, 0.0f, 1.0f);
}
}
@@ -227,6 +235,26 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv)
*lv = v;
}
+void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv)
+{
+ float orig_h= *lh;
+ float orig_s= *ls;
+
+ rgb_to_hsv(r, g, b, lh, ls, lv);
+
+ if(*lv <= 0.0f) {
+ *lh= orig_h;
+ *ls= orig_s;
+ }
+ else if (*ls <= 0.0f) {
+ *lh= orig_h;
+ }
+
+ if(*lh==0.0f && orig_h >= 1.0f) {
+ *lh= 1.0f;
+ }
+}
+
/*http://brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html */
void xyz_to_rgb(float xc, float yc, float zc, float *r, float *g, float *b, int colorspace)
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 2aec707b4ea..c2e765388c8 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -336,20 +336,19 @@ static short IsectLLPt2Df(float x0,float y0,float x1,float y1,
return 1;
} // end Intersect_Lines
-#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
/* point in tri */
-// XXX was called IsectPT2Df
+
int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2])
{
- if (SIDE_OF_LINE(v1,v2,pt)>=0.0) {
- if (SIDE_OF_LINE(v2,v3,pt)>=0.0) {
- if (SIDE_OF_LINE(v3,v1,pt)>=0.0) {
+ if (line_point_side_v2(v1,v2,pt)>=0.0) {
+ if (line_point_side_v2(v2,v3,pt)>=0.0) {
+ if (line_point_side_v2(v3,v1,pt)>=0.0) {
return 1;
}
}
} else {
- if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0)) {
- if (! (SIDE_OF_LINE(v3,v1,pt)>=0.0)) {
+ if (! (line_point_side_v2(v2,v3,pt)>=0.0)) {
+ if (! (line_point_side_v2(v3,v1,pt)>=0.0)) {
return -1;
}
}
@@ -360,18 +359,18 @@ int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2])
/* point in quad - only convex quads */
int isect_point_quad_v2(float pt[2], float v1[2], float v2[2], float v3[2], float v4[2])
{
- if (SIDE_OF_LINE(v1,v2,pt)>=0.0) {
- if (SIDE_OF_LINE(v2,v3,pt)>=0.0) {
- if (SIDE_OF_LINE(v3,v4,pt)>=0.0) {
- if (SIDE_OF_LINE(v4,v1,pt)>=0.0) {
+ if (line_point_side_v2(v1,v2,pt)>=0.0) {
+ if (line_point_side_v2(v2,v3,pt)>=0.0) {
+ if (line_point_side_v2(v3,v4,pt)>=0.0) {
+ if (line_point_side_v2(v4,v1,pt)>=0.0) {
return 1;
}
}
}
} else {
- if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0)) {
- if (! (SIDE_OF_LINE(v3,v4,pt)>=0.0)) {
- if (! (SIDE_OF_LINE(v4,v1,pt)>=0.0)) {
+ if (! (line_point_side_v2(v2,v3,pt)>=0.0)) {
+ if (! (line_point_side_v2(v3,v4,pt)>=0.0)) {
+ if (! (line_point_side_v2(v4,v1,pt)>=0.0)) {
return -1;
}
}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 3b5ffa2d442..9bbd0fc64ac 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -750,6 +750,14 @@ void normalize_m3(float mat[][3])
normalize_v3(mat[2]);
}
+void normalize_m3_m3(float rmat[][3], const float mat[][3])
+{
+ normalize_v3_v3(rmat[0], mat[0]);
+ normalize_v3_v3(rmat[1], mat[1]);
+ normalize_v3_v3(rmat[2], mat[2]);
+}
+
+
void normalize_m4(float mat[][4])
{
float len;
@@ -762,6 +770,18 @@ void normalize_m4(float mat[][4])
if(len!=0.0) mat[2][3]/= len;
}
+void normalize_m4_m4(float rmat[][4], const float mat[][4])
+{
+ float len;
+
+ len= normalize_v3_v3(rmat[0], mat[0]);
+ if(len!=0.0) rmat[0][3]= mat[0][3] / len;
+ len= normalize_v3_v3(rmat[1], mat[1]);
+ if(len!=0.0) rmat[1][3]= mat[1][3] / len;
+ len= normalize_v3_v3(rmat[2], mat[2]);
+ if(len!=0.0) rmat[2][3]= mat[2][3] / len;;
+}
+
void adjoint_m3_m3(float m1[][3], float m[][3])
{
m1[0][0]=m[1][1]*m[2][2]-m[1][2]*m[2][1];
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index b8cef511293..3b58fe88bf5 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1530,6 +1530,73 @@ void copy_dq_dq(DualQuat *dq1, DualQuat *dq2)
memcpy(dq1, dq2, sizeof(DualQuat));
}
+/* axis matches eTrackToAxis_Modes */
+void quat_apply_track(float quat[4], short axis, short upflag)
+{
+ /* rotations are hard coded to match vec_to_quat */
+ const float quat_track[][4]= {{0.70710676908493, 0.0, -0.70710676908493, 0.0}, /* pos-y90 */
+ {0.5, 0.5, 0.5, 0.5}, /* Quaternion((1,0,0), radians(90)) * Quaternion((0,1,0), radians(90)) */
+ {0.70710676908493, 0.0, 0.0, 0.70710676908493}, /* pos-z90 */
+ {0.70710676908493, 0.0, 0.70710676908493, 0.0}, /* neg-y90 */
+ {0.5, -0.5, -0.5, 0.5}, /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */
+ {-3.0908619663705394e-08, 0.70710676908493, 0.70710676908493, 3.0908619663705394e-08}}; /* no rotation */
+
+ mul_qt_qtqt(quat, quat, quat_track[axis]);
+
+ if(axis>2)
+ axis= axis-3;
+
+ /* there are 2 possible up-axis for each axis used, the 'quat_track' applies so the first
+ * up axis is used X->Y, Y->X, Z->X, if this first up axis isn used then rotate 90d
+ * the strange bit shift below just find the low axis {X:Y, Y:X, Z:X} */
+ if(upflag != (2-axis)>>1) {
+ float q[4]= {0.70710676908493, 0.0, 0.0, 0.0}; /* assign 90d rotation axis */
+ q[axis+1] = ((axis==1)) ? 0.70710676908493 : -0.70710676908493; /* flip non Y axis */
+ mul_qt_qtqt(quat, quat, q);
+ }
+}
+
+
+void vec_apply_track(float vec[3], short axis)
+{
+ float tvec[3];
+
+ copy_v3_v3(tvec, vec);
+
+ switch(axis) {
+ case 0: /* pos-x */
+ /* vec[0]= 0.0; */
+ vec[1]= tvec[2];
+ vec[2]= -tvec[1];
+ break;
+ case 1: /* pos-y */
+ /* vec[0]= tvec[0]; */
+ /* vec[1]= 0.0; */
+ /* vec[2]= tvec[2]; */
+ break;
+ case 2: /* pos-z */
+ /* vec[0]= tvec[0]; */
+ /* vec[1]= tvec[1]; */
+ // vec[2]= 0.0; */
+ break;
+ case 3: /* neg-x */
+ /* vec[0]= 0.0; */
+ vec[1]= tvec[2];
+ vec[2]= -tvec[1];
+ break;
+ case 4: /* neg-y */
+ vec[0]= -tvec[2];
+ /* vec[1]= 0.0; */
+ vec[2]= tvec[0];
+ break;
+ case 5: /* neg-z */
+ vec[0]= -tvec[0];
+ vec[1]= -tvec[1];
+ /* vec[2]= 0.0; */
+ break;
+ }
+}
+
/* lense/angle conversion (radians) */
float lens_to_angle(float lens)
{
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 2f75fcead79..a45356f0bde 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -454,5 +454,11 @@ MINLINE int compare_v4v4(float *v1, float *v2, float limit)
return 0;
}
+MINLINE float line_point_side_v2(const float *l1, const float *l2, const float *pt)
+{
+ return ((l1[0]-pt[0]) * (l2[1]-pt[1])) -
+ ((l2[0]-pt[0]) * (l1[1]-pt[1]));
+}
+
#endif /* BLI_MATH_VECTOR_INLINE */
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 141e5438bc9..801130eebc8 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -1052,15 +1052,17 @@ float BLI_hnoisep(float noisesize, float x, float y, float z)
/* Camberra omitted, didn't seem useful */
/* distance squared */
-static float dist_Squared(float x, float y, float z, float e) { return (x*x + y*y + z*z); }
+static float dist_Squared(float x, float y, float z, float e) { (void)e; return (x*x + y*y + z*z); }
/* real distance */
-static float dist_Real(float x, float y, float z, float e) { return sqrt(x*x + y*y + z*z); }
+static float dist_Real(float x, float y, float z, float e) { (void)e; return sqrt(x*x + y*y + z*z); }
/* manhattan/taxicab/cityblock distance */
-static float dist_Manhattan(float x, float y, float z, float e) { return (fabs(x) + fabs(y) + fabs(z)); }
+static float dist_Manhattan(float x, float y, float z, float e) { (void)e; return (fabs(x) + fabs(y) + fabs(z)); }
/* Chebychev */
static float dist_Chebychev(float x, float y, float z, float e)
{
float t;
+ (void)e;
+
x = fabs(x);
y = fabs(y);
z = fabs(z);
@@ -1072,12 +1074,14 @@ static float dist_Chebychev(float x, float y, float z, float e)
static float dist_MinkovskyH(float x, float y, float z, float e)
{
float d = sqrt(fabs(x)) + sqrt(fabs(y)) + sqrt(fabs(z));
+ (void)e;
return (d*d);
}
/* minkovsky preset exponent 4 */
static float dist_Minkovsky4(float x, float y, float z, float e)
{
+ (void)e;
x *= x;
y *= y;
z *= z;
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 23972c64ee1..61b525d50af 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1607,7 +1607,7 @@ void BLI_where_am_i(char *fullname, const char *name)
} while (temp);
}
}
-#ifndef NDEBUG
+#if defined(DEBUG)
if (strcmp(name, fullname)) {
printf("guessing '%s' == '%s'\n", name, fullname);
}
@@ -1620,7 +1620,7 @@ void BLI_where_am_i(char *fullname, const char *name)
// with spawnv(P_WAIT, bprogname, argv) instead of system() but
// that's even uglier
GetShortPathName(fullname, fullname, FILE_MAXDIR+FILE_MAXFILE);
-#ifndef NDEBUG
+#if defined(DEBUG)
printf("Shortname = '%s'\n", fullname);
#endif
#endif
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index b8c229080d5..1e4a2e89d06 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -1629,6 +1629,7 @@ typedef struct {
PBVH *pbvh;
DMDrawFlags flags;
} PBVHDrawData;
+
void BLI_pbvh_node_draw(PBVHNode *node, void *data_v)
{
#if 0
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 7896ebdd263..85af307be16 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -747,7 +747,7 @@ static void scanfill(PolyFill *pf, int mat_nr)
-int BLI_edgefill(int mode, int mat_nr)
+int BLI_edgefill(int mat_nr)
{
/*
- fill works with its own lists, so create that first (no faces!)
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 726ed817f8b..eb2057220fe 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -442,6 +442,8 @@ ThreadedWorker *BLI_create_worker(void *(*do_thread)(void *), int tot, int sleep
{
ThreadedWorker *worker;
+ (void)sleep_time; /* unused */
+
worker = MEM_callocN(sizeof(ThreadedWorker), "threadedworker");
if (tot > RE_MAX_THREAD)
diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h
index 182c582cc0f..5758eca6076 100644
--- a/source/blender/blenloader/BLO_writefile.h
+++ b/source/blender/blenloader/BLO_writefile.h
@@ -36,8 +36,7 @@ struct Main;
struct ReportList;
extern int BLO_write_file(struct Main *mainvar, char *dir, int write_flags, struct ReportList *reports, int *thumb);
-extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current,
- int write_flags, struct ReportList *reports);
+extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags);
extern int BLO_write_runtime(struct Main *mainvar, char *file, char *exename, struct ReportList *reports);
#define BLEN_THUMB_SIZE 128
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index b637d538b91..c892e8457ca 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -284,7 +284,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
strcpy(fd->relabase, filename);
/* clear ob->proxy_from pointers in old main */
- blo_clear_proxy_pointers_from_lib(fd, oldmain);
+ blo_clear_proxy_pointers_from_lib(oldmain);
/* separate libraries from old main */
blo_split_main(&mainlist, oldmain);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index acb565cda97..51d68560116 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -704,7 +704,7 @@ BHead *blo_firstbhead(FileData *fd)
return(bhead);
}
-BHead *blo_prevbhead(FileData *fd, BHead *thisblock)
+BHead *blo_prevbhead(FileData *UNUSED(fd), BHead *thisblock)
{
BHeadN *bheadn= (BHeadN *) (((char *) thisblock) - GET_INT_FROM_POINTER( &((BHeadN*)0)->bhead) );
BHeadN *prev= bheadn->prev;
@@ -1155,7 +1155,7 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi
* to clear that pointer before reading the undo memfile since
* the object might be removed, it is set again in reading
* if the local object still exists */
-void blo_clear_proxy_pointers_from_lib(FileData *fd, Main *oldmain)
+void blo_clear_proxy_pointers_from_lib(Main *oldmain)
{
Object *ob= oldmain->object.first;
@@ -1384,8 +1384,8 @@ static void test_pointer_array(FileData *fd, void **mat)
/* ************ READ ID Properties *************** */
-void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd);
-void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, FileData *fd);
+static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd);
+static void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, FileData *fd);
static void IDP_DirectLinkIDPArray(IDProperty *prop, int switch_endian, FileData *fd)
{
@@ -1442,7 +1442,7 @@ static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *f
}
}
-static void IDP_DirectLinkString(IDProperty *prop, int switch_endian, FileData *fd)
+static void IDP_DirectLinkString(IDProperty *prop, FileData *fd)
{
/*since we didn't save the extra string buffer, set totallen to len.*/
prop->totallen = prop->len;
@@ -1469,7 +1469,7 @@ void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd)
IDP_DirectLinkGroup(prop, switch_endian, fd);
break;
case IDP_STRING:
- IDP_DirectLinkString(prop, switch_endian, fd);
+ IDP_DirectLinkString(prop, fd);
break;
case IDP_ARRAY:
IDP_DirectLinkArray(prop, switch_endian, fd);
@@ -1499,7 +1499,7 @@ void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd)
}
/*stub function*/
-void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, FileData *fd)
+void IDP_LibLinkProperty(IDProperty *UNUSED(prop), int UNUSED(switch_endian), FileData *UNUSED(fd))
{
}
@@ -1552,7 +1552,7 @@ static void direct_link_brush(FileData *fd, Brush *brush)
brush->icon_imbuf= NULL;
}
-static void direct_link_script(FileData *fd, Script *script)
+static void direct_link_script(FileData *UNUSED(fd), Script *script)
{
script->id.us = 1;
SCRIPT_SET_NULL(script)
@@ -2030,7 +2030,7 @@ static void lib_link_nodetree(FileData *fd, Main *main)
/* verify types for nodes and groups, all data has to be read */
/* open = 0: appending/linking, open = 1: open new file (need to clean out dynamic
* typedefs*/
-static void lib_verify_nodetree(Main *main, int open)
+static void lib_verify_nodetree(Main *main, int UNUSED(open))
{
Scene *sce;
Material *ma;
@@ -2139,7 +2139,7 @@ typedef struct tConstraintLinkData {
ID *id;
} tConstraintLinkData;
/* callback function used to relink constraint ID-links */
-static void lib_link_constraint_cb(bConstraint *con, ID **idpoin, void *userdata)
+static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata)
{
tConstraintLinkData *cld= (tConstraintLinkData *)userdata;
*idpoin = newlibadr(cld->fd, cld->id->lib, *idpoin);
@@ -2534,7 +2534,7 @@ static void direct_link_world(FileData *fd, World *wrld)
/* ************ READ VFONT ***************** */
-static void lib_link_vfont(FileData *fd, Main *main)
+static void lib_link_vfont(FileData *UNUSED(fd), Main *main)
{
VFont *vf;
@@ -2555,7 +2555,7 @@ static void direct_link_vfont(FileData *fd, VFont *vf)
/* ************ READ TEXT ****************** */
-static void lib_link_text(FileData *fd, Main *main)
+static void lib_link_text(FileData *UNUSED(fd), Main *main)
{
Text *text;
@@ -4689,6 +4689,7 @@ static void lib_link_screen(FileData *fd, Main *main)
SpaceText *st= (SpaceText *)sl;
st->text= newlibadr(fd, sc->id.lib, st->text);
+ st->drawcache= NULL;
}
else if(sl->spacetype==SPACE_SCRIPT) {
@@ -4920,6 +4921,8 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
st->text= restore_pointer_by_name(newmain, (ID *)st->text, 1);
if(st->text==NULL) st->text= newmain->text.first;
+
+ st->drawcache= NULL;
}
else if(sl->spacetype==SPACE_SCRIPT) {
SpaceScript *scpt= (SpaceScript *)sl;
@@ -5301,7 +5304,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
lib->parent= NULL;
}
-static void lib_link_library(FileData *fd, Main *main)
+static void lib_link_library(FileData *UNUSED(fd), Main *main)
{
Library *lib;
for(lib= main->library.first; lib; lib= lib->id.next) {
@@ -6513,7 +6516,7 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype)
}
}
-static void do_version_mdef_250(FileData *fd, Library *lib, Main *main)
+static void do_version_mdef_250(Main *main)
{
Object *ob;
ModifierData *md;
@@ -9747,7 +9750,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
char str[FILE_MAX];
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
seq->sound = sound_new_file(main, str);
}
/* don't know, if anybody used that
@@ -10939,7 +10942,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- do_version_mdef_250(fd, lib, main);
+ do_version_mdef_250(main);
/* parent type to modifier */
for(ob = main->object.first; ob; ob = ob->id.next) {
@@ -11331,7 +11334,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filename)
lib_link_all(fd, bfd->main);
//do_versions_after_linking(fd, NULL, bfd->main); // XXX: not here (or even in this function at all)! this causes crashes on many files - Aligorith (July 04, 2010)
- lib_verify_nodetree(bfd->main, 1);
+ lib_verify_nodetree(bfd->main, TRUE);
fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */
link_global(fd, bfd); /* as last */
@@ -11816,7 +11819,7 @@ typedef struct tConstraintExpandData {
Main *mainvar;
} tConstraintExpandData;
/* callback function used to expand constraint ID-links */
-static void expand_constraint_cb(bConstraint *con, ID **idpoin, void *userdata)
+static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata)
{
tConstraintExpandData *ced= (tConstraintExpandData *)userdata;
expand_doit(ced->fd, ced->mainvar, *idpoin);
@@ -12409,7 +12412,7 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir)
blo_split_main(&(*fd)->mainlist, mainvar);
/* which one do we need? */
- mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.sce);
+ mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.main->name);
/* needed for do_version */
mainl->versionfile= (*fd)->fileversion;
@@ -12476,29 +12479,33 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
{
Main *mainvar= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
+ Library *curlib;
/* make main consistent */
expand_main(*fd, mainl);
/* do this when expand found other libs */
read_libraries(*fd, &(*fd)->mainlist);
+
+ curlib= mainl->curlib;
/* make the lib path relative if required */
if(flag & FILE_RELPATH) {
/* use the full path, this could have been read by other library even */
- BLI_strncpy(mainl->curlib->name, mainl->curlib->filepath, sizeof(mainl->curlib->name));
+ BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name));
/* uses current .blend file as reference */
- BLI_path_rel(mainl->curlib->name, G.sce);
+ BLI_path_rel(curlib->name, G.main->name);
}
blo_join_main(&(*fd)->mainlist);
mainvar= (*fd)->mainlist.first;
+ mainl= NULL; /* blo_join_main free's mainl, cant use anymore */
lib_link_all(*fd, mainvar);
- lib_verify_nodetree(mainvar, 0);
- fix_relpaths_library(G.sce, mainvar); /* make all relative paths, relative to the open blend file */
+ lib_verify_nodetree(mainvar, FALSE);
+ fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */
/* give a base to loose objects. If group append, do it for objects too */
if(scene) {
@@ -12509,7 +12516,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
if (flag & FILE_LINK) {
give_base_to_objects(mainvar, scene, NULL, 0);
} else {
- give_base_to_objects(mainvar, scene, mainl->curlib, 1);
+ give_base_to_objects(mainvar, scene, curlib, 1);
}
if (flag & FILE_GROUP_INSTANCE) {
@@ -12529,7 +12536,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
*fd = NULL;
}
- append_do_cursor(scene, mainl->curlib, flag);
+ append_do_cursor(scene, curlib, flag);
}
void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag)
@@ -12614,7 +12621,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
while(fd==NULL) {
char newlib_path[240] = { 0 };
printf("Missing library...'\n");
- printf(" current file: %s\n", G.sce);
+ printf(" current file: %s\n", G.main->name);
printf(" absolute lib: %s\n", mainptr->curlib->filepath);
printf(" relative lib: %s\n", mainptr->curlib->name);
printf(" enter a new path:\n");
@@ -12622,7 +12629,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
if(scanf("%s", newlib_path) > 0) {
strcpy(mainptr->curlib->name, newlib_path);
strcpy(mainptr->curlib->filepath, newlib_path);
- cleanup_path(G.sce, mainptr->curlib->filepath);
+ cleanup_path(G.main->name, mainptr->curlib->filepath);
fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index 8e391fa438e..ed89e93d66a 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -114,7 +114,7 @@ FileData *blo_openblenderfile(char *name, struct ReportList *reports);
FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports);
FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports);
-void blo_clear_proxy_pointers_from_lib(FileData *fd, Main *oldmain);
+void blo_clear_proxy_pointers_from_lib(Main *oldmain);
void blo_make_image_pointer_map(FileData *fd, Main *oldmain);
void blo_end_image_pointer_map(FileData *fd, Main *oldmain);
void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index c101eaed4bb..3ad3936cbed 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2520,14 +2520,14 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
if(strcmp(dir1, dir2)==0)
write_flags &= ~G_FILE_RELATIVE_REMAP;
else
- makeFilesAbsolute(G.sce, NULL);
+ makeFilesAbsolute(G.main->name, NULL);
}
- BLI_make_file_string(G.sce, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
+ BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
write_user_block= BLI_streq(dir, userfilename);
if(write_flags & G_FILE_RELATIVE_REMAP)
- makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.sce */
+ makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.main->name */
/* actual file writing */
err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb);
@@ -2579,7 +2579,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
}
/* return: success (1) */
-int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int write_flags, ReportList *reports)
+int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int write_flags)
{
int err;
diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h
index b8628b00575..668d14508ec 100644
--- a/source/blender/blenpluginapi/iff.h
+++ b/source/blender/blenpluginapi/iff.h
@@ -81,7 +81,7 @@ typedef struct ImBuf {
int refcounter; /* reference counter for multiple users */
} ImBuf;
-LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint,uchar);
+LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint);
LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *);
LIBIMPORT void freeImBuf(struct ImBuf*);
diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c
index 9e739f7927d..a12488ae868 100644
--- a/source/blender/blenpluginapi/intern/pluginapi.c
+++ b/source/blender/blenpluginapi/intern/pluginapi.c
@@ -101,10 +101,9 @@ LIBEXPORT void freeT(void *vmemh)
LIBEXPORT struct ImBuf *allocImBuf(short x,
short y,
uchar d,
- uint flags,
- uchar bitmap)
+ uint flags)
{
- return IMB_allocImBuf(x, y, d, flags, bitmap);
+ return IMB_allocImBuf(x, y, d, flags);
}
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
new file mode 100644
index 00000000000..32390fe01eb
--- /dev/null
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -0,0 +1,1149 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "DNA_armature_types.h"
+
+#include "ED_keyframing.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+
+#include "BKE_action.h"
+#include "BKE_armature.h"
+#include "BKE_fcurve.h"
+#include "BKE_object.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "collada_utils.h"
+#include "AnimationImporter.h"
+#include "ArmatureImporter.h"
+
+#include <algorithm>
+
+// use this for retrieving bone names, since these must be unique
+template<class T>
+static const char *bc_get_joint_name(T *node)
+{
+ const std::string& id = node->getOriginalId();
+ return id.size() ? id.c_str() : node->getName().c_str();
+}
+
+FCurve *AnimationImporter::create_fcurve(int array_index, const char *rna_path)
+{
+ FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve");
+
+ fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
+ fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
+ fcu->array_index = array_index;
+ return fcu;
+}
+
+void AnimationImporter::create_bezt(FCurve *fcu, float frame, float output)
+{
+ BezTriple bez;
+ memset(&bez, 0, sizeof(BezTriple));
+ bez.vec[1][0] = frame;
+ bez.vec[1][1] = output;
+ bez.ipo = U.ipo_new; /* use default interpolation mode here... */
+ bez.f1 = bez.f2 = bez.f3 = SELECT;
+ bez.h1 = bez.h2 = HD_AUTO;
+ insert_bezt_fcurve(fcu, &bez, 0);
+ calchandles_fcurve(fcu);
+}
+
+// create one or several fcurves depending on the number of parameters being animated
+void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
+{
+ COLLADAFW::FloatOrDoubleArray& input = curve->getInputValues();
+ COLLADAFW::FloatOrDoubleArray& output = curve->getOutputValues();
+ // COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues();
+ // COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues();
+ float fps = (float)FPS;
+ size_t dim = curve->getOutDimension();
+ unsigned int i;
+
+ std::vector<FCurve*>& fcurves = curve_map[curve->getUniqueId()];
+
+ switch (dim) {
+ case 1: // X, Y, Z or angle
+ case 3: // XYZ
+ case 16: // matrix
+ {
+ for (i = 0; i < dim; i++ ) {
+ FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve");
+
+ fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
+ // fcu->rna_path = BLI_strdupn(path, strlen(path));
+ fcu->array_index = 0;
+ //fcu->totvert = curve->getKeyCount();
+
+ // create beztriple for each key
+ for (unsigned int j = 0; j < curve->getKeyCount(); j++) {
+ BezTriple bez;
+ memset(&bez, 0, sizeof(BezTriple));
+
+ // intangent
+ // bez.vec[0][0] = get_float_value(intan, j * 6 + i + i) * fps;
+ // bez.vec[0][1] = get_float_value(intan, j * 6 + i + i + 1);
+
+ // input, output
+ bez.vec[1][0] = bc_get_float_value(input, j) * fps;
+ bez.vec[1][1] = bc_get_float_value(output, j * dim + i);
+
+ // outtangent
+ // bez.vec[2][0] = get_float_value(outtan, j * 6 + i + i) * fps;
+ // bez.vec[2][1] = get_float_value(outtan, j * 6 + i + i + 1);
+
+ bez.ipo = U.ipo_new; /* use default interpolation mode here... */
+ bez.f1 = bez.f2 = bez.f3 = SELECT;
+ bez.h1 = bez.h2 = HD_AUTO;
+ insert_bezt_fcurve(fcu, &bez, 0);
+ }
+
+ calchandles_fcurve(fcu);
+
+ fcurves.push_back(fcu);
+ }
+ }
+ break;
+ default:
+ fprintf(stderr, "Output dimension of %d is not yet supported (animation id = %s)\n", dim, curve->getOriginalId().c_str());
+ }
+
+ for (std::vector<FCurve*>::iterator it = fcurves.begin(); it != fcurves.end(); it++)
+ unused_curves.push_back(*it);
+}
+
+void AnimationImporter::fcurve_deg_to_rad(FCurve *cu)
+{
+ for (unsigned int i = 0; i < cu->totvert; i++) {
+ // TODO convert handles too
+ cu->bezt[i].vec[1][1] *= M_PI / 180.0f;
+ }
+}
+
+void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated)
+{
+ bAction *act;
+
+ if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID*)&ob->id, 1);
+ else act = ob->adt->action;
+
+ std::vector<FCurve*>::iterator it;
+ int i;
+
+#if 0
+ char *p = strstr(rna_path, "rotation_euler");
+ bool is_rotation = p && *(p + strlen("rotation_euler")) == '\0';
+
+ // convert degrees to radians for rotation
+ if (is_rotation)
+ fcurve_deg_to_rad(fcu);
+#endif
+
+ for (it = curves.begin(), i = 0; it != curves.end(); it++, i++) {
+ FCurve *fcu = *it;
+ fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
+
+ if (array_index == -1) fcu->array_index = i;
+ else fcu->array_index = array_index;
+
+ if (ob->type == OB_ARMATURE) {
+ bActionGroup *grp = NULL;
+ const char *bone_name = bc_get_joint_name(animated->node);
+
+ if (bone_name) {
+ /* try to find group */
+ grp = action_groups_find_named(act, bone_name);
+
+ /* no matching groups, so add one */
+ if (grp == NULL) {
+ /* Add a new group, and make it active */
+ grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
+
+ grp->flag = AGRP_SELECTED;
+ BLI_strncpy(grp->name, bone_name, sizeof(grp->name));
+
+ BLI_addtail(&act->groups, grp);
+ BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64);
+ }
+
+ /* add F-Curve to group */
+ action_groups_add_channel(act, grp, fcu);
+
+ }
+#if 0
+ if (is_rotation) {
+ fcurves_actionGroup_map[grp].push_back(fcu);
+ }
+#endif
+ }
+ else {
+ BLI_addtail(&act->curves, fcu);
+ }
+
+ // curve is used, so remove it from unused_curves
+ unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end());
+ }
+}
+
+AnimationImporter::AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene) :
+ TransformReader(conv), armature_importer(arm), scene(scene) { }
+
+AnimationImporter::~AnimationImporter()
+{
+ // free unused FCurves
+ for (std::vector<FCurve*>::iterator it = unused_curves.begin(); it != unused_curves.end(); it++)
+ free_fcurve(*it);
+
+ if (unused_curves.size())
+ fprintf(stderr, "removed %u unused curves\n", unused_curves.size());
+}
+
+bool AnimationImporter::write_animation(const COLLADAFW::Animation* anim)
+{
+ if (anim->getAnimationType() == COLLADAFW::Animation::ANIMATION_CURVE) {
+ COLLADAFW::AnimationCurve *curve = (COLLADAFW::AnimationCurve*)anim;
+
+ // XXX Don't know if it's necessary
+ // Should we check outPhysicalDimension?
+ if (curve->getInPhysicalDimension() != COLLADAFW::PHYSICAL_DIMENSION_TIME) {
+ fprintf(stderr, "Inputs physical dimension is not time. \n");
+ return true;
+ }
+
+ // a curve can have mixed interpolation type,
+ // in this case curve->getInterpolationTypes returns a list of interpolation types per key
+ COLLADAFW::AnimationCurve::InterpolationType interp = curve->getInterpolationType();
+
+ if (interp != COLLADAFW::AnimationCurve::INTERPOLATION_MIXED) {
+ switch (interp) {
+ case COLLADAFW::AnimationCurve::INTERPOLATION_LINEAR:
+ case COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER:
+ animation_to_fcurves(curve);
+ break;
+ default:
+ // TODO there're also CARDINAL, HERMITE, BSPLINE and STEP types
+ fprintf(stderr, "CARDINAL, HERMITE, BSPLINE and STEP anim interpolation types not supported yet.\n");
+ break;
+ }
+ }
+ else {
+ // not supported yet
+ fprintf(stderr, "MIXED anim interpolation type is not supported yet.\n");
+ }
+ }
+ else {
+ fprintf(stderr, "FORMULA animation type is not supported yet.\n");
+ }
+
+ return true;
+}
+
+// called on post-process stage after writeVisualScenes
+bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList* animlist)
+{
+ const COLLADAFW::UniqueId& animlist_id = animlist->getUniqueId();
+
+ animlist_map[animlist_id] = animlist;
+
+#if 0
+ // should not happen
+ if (uid_animated_map.find(animlist_id) == uid_animated_map.end()) {
+ return true;
+ }
+
+ // for bones rna_path is like: pose.bones["bone-name"].rotation
+
+ // what does this AnimationList animate?
+ Animation& animated = uid_animated_map[animlist_id];
+ Object *ob = animated.ob;
+
+ char rna_path[100];
+ char joint_path[100];
+ bool is_joint = false;
+
+ // if ob is NULL, it should be a JOINT
+ if (!ob) {
+ ob = armature_importer->get_armature_for_joint(animated.node);
+
+ if (!ob) {
+ fprintf(stderr, "Cannot find armature for node %s\n", get_joint_name(animated.node));
+ return true;
+ }
+
+ armature_importer->get_rna_path_for_joint(animated.node, joint_path, sizeof(joint_path));
+
+ is_joint = true;
+ }
+
+ const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
+
+ switch (animated.tm->getTransformationType()) {
+ case COLLADAFW::Transformation::TRANSLATE:
+ case COLLADAFW::Transformation::SCALE:
+ {
+ bool loc = animated.tm->getTransformationType() == COLLADAFW::Transformation::TRANSLATE;
+ if (is_joint)
+ BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, loc ? "location" : "scale");
+ else
+ BLI_strncpy(rna_path, loc ? "location" : "scale", sizeof(rna_path));
+
+ for (int i = 0; i < bindings.getCount(); i++) {
+ const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i];
+ COLLADAFW::UniqueId anim_uid = binding.animation;
+
+ if (curve_map.find(anim_uid) == curve_map.end()) {
+ fprintf(stderr, "Cannot find FCurve by animation UID.\n");
+ continue;
+ }
+
+ std::vector<FCurve*>& fcurves = curve_map[anim_uid];
+
+ switch (binding.animationClass) {
+ case COLLADAFW::AnimationList::POSITION_X:
+ add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated);
+ break;
+ case COLLADAFW::AnimationList::POSITION_Y:
+ add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated);
+ break;
+ case COLLADAFW::AnimationList::POSITION_Z:
+ add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated);
+ break;
+ case COLLADAFW::AnimationList::POSITION_XYZ:
+ add_fcurves_to_object(ob, fcurves, rna_path, -1, &animated);
+ break;
+ default:
+ fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
+ binding.animationClass, loc ? "TRANSLATE" : "SCALE");
+ }
+ }
+ }
+ break;
+ case COLLADAFW::Transformation::ROTATE:
+ {
+ if (is_joint)
+ BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_euler", joint_path);
+ else
+ BLI_strncpy(rna_path, "rotation_euler", sizeof(rna_path));
+
+ COLLADAFW::Rotate* rot = (COLLADAFW::Rotate*)animated.tm;
+ COLLADABU::Math::Vector3& axis = rot->getRotationAxis();
+
+ for (int i = 0; i < bindings.getCount(); i++) {
+ const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i];
+ COLLADAFW::UniqueId anim_uid = binding.animation;
+
+ if (curve_map.find(anim_uid) == curve_map.end()) {
+ fprintf(stderr, "Cannot find FCurve by animation UID.\n");
+ continue;
+ }
+
+ std::vector<FCurve*>& fcurves = curve_map[anim_uid];
+
+ switch (binding.animationClass) {
+ case COLLADAFW::AnimationList::ANGLE:
+ if (COLLADABU::Math::Vector3::UNIT_X == axis) {
+ add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated);
+ }
+ else if (COLLADABU::Math::Vector3::UNIT_Y == axis) {
+ add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated);
+ }
+ else if (COLLADABU::Math::Vector3::UNIT_Z == axis) {
+ add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated);
+ }
+ break;
+ case COLLADAFW::AnimationList::AXISANGLE:
+ // TODO convert axis-angle to quat? or XYZ?
+ default:
+ fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n",
+ binding.animationClass);
+ }
+ }
+ }
+ break;
+ case COLLADAFW::Transformation::MATRIX:
+ case COLLADAFW::Transformation::SKEW:
+ case COLLADAFW::Transformation::LOOKAT:
+ fprintf(stderr, "Animation of MATRIX, SKEW and LOOKAT transformations is not supported yet.\n");
+ break;
+ }
+#endif
+
+ return true;
+}
+
+void AnimationImporter::read_node_transform(COLLADAFW::Node *node, Object *ob)
+{
+ float mat[4][4];
+ TransformReader::get_node_mat(mat, node, &uid_animated_map, ob);
+ if (ob) {
+ copy_m4_m4(ob->obmat, mat);
+ object_apply_mat4(ob, ob->obmat);
+ }
+}
+
+#if 0
+virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
+{
+ bActionGroup *grp;
+ int i;
+
+ for (grp = (bActionGroup*)act->groups.first; grp; grp = grp->next) {
+
+ FCurve *eulcu[3] = {NULL, NULL, NULL};
+
+ if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end())
+ continue;
+
+ std::vector<FCurve*> &rot_fcurves = fcurves_actionGroup_map[grp];
+
+ if (rot_fcurves.size() > 3) continue;
+
+ for (i = 0; i < rot_fcurves.size(); i++)
+ eulcu[rot_fcurves[i]->array_index] = rot_fcurves[i];
+
+ char joint_path[100];
+ char rna_path[100];
+
+ BLI_snprintf(joint_path, sizeof(joint_path), "pose.bones[\"%s\"]", grp->name);
+ BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_quaternion", joint_path);
+
+ FCurve *quatcu[4] = {
+ create_fcurve(0, rna_path),
+ create_fcurve(1, rna_path),
+ create_fcurve(2, rna_path),
+ create_fcurve(3, rna_path)
+ };
+
+ bPoseChannel *chan = get_pose_channel(ob->pose, grp->name);
+
+ float m4[4][4], irest[3][3];
+ invert_m4_m4(m4, chan->bone->arm_mat);
+ copy_m3_m4(irest, m4);
+
+ for (i = 0; i < 3; i++) {
+
+ FCurve *cu = eulcu[i];
+
+ if (!cu) continue;
+
+ for (int j = 0; j < cu->totvert; j++) {
+ float frame = cu->bezt[j].vec[1][0];
+
+ float eul[3] = {
+ eulcu[0] ? evaluate_fcurve(eulcu[0], frame) : 0.0f,
+ eulcu[1] ? evaluate_fcurve(eulcu[1], frame) : 0.0f,
+ eulcu[2] ? evaluate_fcurve(eulcu[2], frame) : 0.0f
+ };
+
+ // make eul relative to bone rest pose
+ float rot[3][3], rel[3][3], quat[4];
+
+ /*eul_to_mat3(rot, eul);
+
+ mul_m3_m3m3(rel, irest, rot);
+
+ mat3_to_quat(quat, rel);
+ */
+
+ eul_to_quat(quat, eul);
+
+ for (int k = 0; k < 4; k++)
+ create_bezt(quatcu[k], frame, quat[k]);
+ }
+ }
+
+ // now replace old Euler curves
+
+ for (i = 0; i < 3; i++) {
+ if (!eulcu[i]) continue;
+
+ action_groups_remove_channel(act, eulcu[i]);
+ free_fcurve(eulcu[i]);
+ }
+
+ chan->rotmode = ROT_MODE_QUAT;
+
+ for (i = 0; i < 4; i++)
+ action_groups_add_channel(act, grp, quatcu[i]);
+ }
+
+ bPoseChannel *pchan;
+ for (pchan = (bPoseChannel*)ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+ pchan->rotmode = ROT_MODE_QUAT;
+ }
+}
+#endif
+
+// prerequisites:
+// animlist_map - map animlist id -> animlist
+// curve_map - map anim id -> curve(s)
+Object *AnimationImporter::translate_animation(COLLADAFW::Node *node,
+ std::map<COLLADAFW::UniqueId, Object*>& object_map,
+ std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
+ COLLADAFW::Transformation::TransformationType tm_type,
+ Object *par_job)
+{
+ bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE;
+ bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX;
+ bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
+
+ COLLADAFW::Node *root = root_map.find(node->getUniqueId()) == root_map.end() ? node : root_map[node->getUniqueId()];
+ Object *ob = is_joint ? armature_importer->get_armature_for_joint(node) : object_map[node->getUniqueId()];
+ const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
+
+ if (!ob) {
+ fprintf(stderr, "cannot find Object for Node with id=\"%s\"\n", node->getOriginalId().c_str());
+ return NULL;
+ }
+
+ // frames at which to sample
+ std::vector<float> frames;
+
+ // for each <rotate>, <translate>, etc. there is a separate Transformation
+ const COLLADAFW::TransformationPointerArray& tms = node->getTransformations();
+
+ unsigned int i;
+
+ // find frames at which to sample plus convert all rotation keys to radians
+ for (i = 0; i < tms.getCount(); i++) {
+ COLLADAFW::Transformation *tm = tms[i];
+ COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
+
+ if (type == tm_type) {
+ const COLLADAFW::UniqueId& listid = tm->getAnimationList();
+
+ if (animlist_map.find(listid) != animlist_map.end()) {
+ const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+ const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
+
+ if (bindings.getCount()) {
+ for (unsigned int j = 0; j < bindings.getCount(); j++) {
+ std::vector<FCurve*>& curves = curve_map[bindings[j].animation];
+ bool xyz = ((type == COLLADAFW::Transformation::TRANSLATE || type == COLLADAFW::Transformation::SCALE) && bindings[j].animationClass == COLLADAFW::AnimationList::POSITION_XYZ);
+
+ if ((!xyz && curves.size() == 1) || (xyz && curves.size() == 3) || is_matrix) {
+ std::vector<FCurve*>::iterator iter;
+
+ for (iter = curves.begin(); iter != curves.end(); iter++) {
+ FCurve *fcu = *iter;
+
+ if (is_rotation)
+ fcurve_deg_to_rad(fcu);
+
+ for (unsigned int k = 0; k < fcu->totvert; k++) {
+ float fra = fcu->bezt[k].vec[1][0];
+ if (std::find(frames.begin(), frames.end(), fra) == frames.end())
+ frames.push_back(fra);
+ }
+ }
+ }
+ else {
+ fprintf(stderr, "expected %d curves, got %u\n", xyz ? 3 : 1, curves.size());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ float irest_dae[4][4];
+ float rest[4][4], irest[4][4];
+
+ if (is_joint) {
+ get_joint_rest_mat(irest_dae, root, node);
+ invert_m4(irest_dae);
+
+ Bone *bone = get_named_bone((bArmature*)ob->data, bone_name);
+ if (!bone) {
+ fprintf(stderr, "cannot find bone \"%s\"\n", bone_name);
+ return NULL;
+ }
+
+ unit_m4(rest);
+ copy_m4_m4(rest, bone->arm_mat);
+ invert_m4_m4(irest, rest);
+ }
+
+ Object *job = NULL;
+
+#ifdef ARMATURE_TEST
+ FCurve *job_curves[10];
+ job = get_joint_object(root, node, par_job);
+#endif
+
+ if (frames.size() == 0)
+ return job;
+
+ std::sort(frames.begin(), frames.end());
+
+ const char *tm_str = NULL;
+ switch (tm_type) {
+ case COLLADAFW::Transformation::ROTATE:
+ tm_str = "rotation_quaternion";
+ break;
+ case COLLADAFW::Transformation::SCALE:
+ tm_str = "scale";
+ break;
+ case COLLADAFW::Transformation::TRANSLATE:
+ tm_str = "location";
+ break;
+ case COLLADAFW::Transformation::MATRIX:
+ break;
+ default:
+ return job;
+ }
+
+ char rna_path[200];
+ char joint_path[200];
+
+ if (is_joint)
+ armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path));
+
+ // new curves
+ FCurve *newcu[10]; // if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale
+ unsigned int totcu = is_matrix ? 10 : (is_rotation ? 4 : 3);
+
+ for (i = 0; i < totcu; i++) {
+
+ int axis = i;
+
+ if (is_matrix) {
+ if (i < 4) {
+ tm_str = "rotation_quaternion";
+ axis = i;
+ }
+ else if (i < 7) {
+ tm_str = "location";
+ axis = i - 4;
+ }
+ else {
+ tm_str = "scale";
+ axis = i - 7;
+ }
+ }
+
+ if (is_joint)
+ BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str);
+ else
+ strcpy(rna_path, tm_str);
+
+ newcu[i] = create_fcurve(axis, rna_path);
+
+#ifdef ARMATURE_TEST
+ if (is_joint)
+ job_curves[i] = create_fcurve(axis, tm_str);
+#endif
+ }
+
+ std::vector<float>::iterator it;
+
+ // sample values at each frame
+ for (it = frames.begin(); it != frames.end(); it++) {
+ float fra = *it;
+
+ float mat[4][4];
+ float matfra[4][4];
+
+ unit_m4(matfra);
+
+ // calc object-space mat
+ evaluate_transform_at_frame(matfra, node, fra);
+
+ // for joints, we need a special matrix
+ if (is_joint) {
+ // special matrix: iR * M * iR_dae * R
+ // where R, iR are bone rest and inverse rest mats in world space (Blender bones),
+ // iR_dae is joint inverse rest matrix (DAE) and M is an evaluated joint world-space matrix (DAE)
+ float temp[4][4], par[4][4];
+
+ // calc M
+ calc_joint_parent_mat_rest(par, NULL, root, node);
+ mul_m4_m4m4(temp, matfra, par);
+
+ // evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra);
+
+ // calc special matrix
+ mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
+ }
+ else {
+ copy_m4_m4(mat, matfra);
+ }
+
+ float val[4], rot[4], loc[3], scale[3];
+
+ switch (tm_type) {
+ case COLLADAFW::Transformation::ROTATE:
+ mat4_to_quat(val, mat);
+ break;
+ case COLLADAFW::Transformation::SCALE:
+ mat4_to_size(val, mat);
+ break;
+ case COLLADAFW::Transformation::TRANSLATE:
+ copy_v3_v3(val, mat[3]);
+ break;
+ case COLLADAFW::Transformation::MATRIX:
+ mat4_to_quat(rot, mat);
+ copy_v3_v3(loc, mat[3]);
+ mat4_to_size(scale, mat);
+ break;
+ default:
+ break;
+ }
+
+ // add keys
+ for (i = 0; i < totcu; i++) {
+ if (is_matrix) {
+ if (i < 4)
+ add_bezt(newcu[i], fra, rot[i]);
+ else if (i < 7)
+ add_bezt(newcu[i], fra, loc[i - 4]);
+ else
+ add_bezt(newcu[i], fra, scale[i - 7]);
+ }
+ else {
+ add_bezt(newcu[i], fra, val[i]);
+ }
+ }
+
+#ifdef ARMATURE_TEST
+ if (is_joint) {
+ switch (tm_type) {
+ case COLLADAFW::Transformation::ROTATE:
+ mat4_to_quat(val, matfra);
+ break;
+ case COLLADAFW::Transformation::SCALE:
+ mat4_to_size(val, matfra);
+ break;
+ case COLLADAFW::Transformation::TRANSLATE:
+ copy_v3_v3(val, matfra[3]);
+ break;
+ case MATRIX:
+ mat4_to_quat(rot, matfra);
+ copy_v3_v3(loc, matfra[3]);
+ mat4_to_size(scale, matfra);
+ break;
+ default:
+ break;
+ }
+
+ for (i = 0; i < totcu; i++) {
+ if (is_matrix) {
+ if (i < 4)
+ add_bezt(job_curves[i], fra, rot[i]);
+ else if (i < 7)
+ add_bezt(job_curves[i], fra, loc[i - 4]);
+ else
+ add_bezt(job_curves[i], fra, scale[i - 7]);
+ }
+ else {
+ add_bezt(job_curves[i], fra, val[i]);
+ }
+ }
+ }
+#endif
+ }
+
+ verify_adt_action((ID*)&ob->id, 1);
+
+ ListBase *curves = &ob->adt->action->curves;
+
+ // add curves
+ for (i = 0; i < totcu; i++) {
+ if (is_joint)
+ add_bone_fcurve(ob, node, newcu[i]);
+ else
+ BLI_addtail(curves, newcu[i]);
+
+#ifdef ARMATURE_TEST
+ if (is_joint)
+ BLI_addtail(&job->adt->action->curves, job_curves[i]);
+#endif
+ }
+
+ if (is_rotation || is_matrix) {
+ if (is_joint) {
+ bPoseChannel *chan = get_pose_channel(ob->pose, bone_name);
+ chan->rotmode = ROT_MODE_QUAT;
+ }
+ else {
+ ob->rotmode = ROT_MODE_QUAT;
+ }
+ }
+
+ return job;
+}
+
+// internal, better make it private
+// warning: evaluates only rotation
+// prerequisites: animlist_map, curve_map
+void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra)
+{
+ const COLLADAFW::TransformationPointerArray& tms = node->getTransformations();
+
+ unit_m4(mat);
+
+ for (unsigned int i = 0; i < tms.getCount(); i++) {
+ COLLADAFW::Transformation *tm = tms[i];
+ COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
+ float m[4][4];
+
+ unit_m4(m);
+
+ if (!evaluate_animation(tm, m, fra, node->getOriginalId().c_str())) {
+ switch (type) {
+ case COLLADAFW::Transformation::ROTATE:
+ dae_rotate_to_mat4(tm, m);
+ break;
+ case COLLADAFW::Transformation::TRANSLATE:
+ dae_translate_to_mat4(tm, m);
+ break;
+ case COLLADAFW::Transformation::SCALE:
+ dae_scale_to_mat4(tm, m);
+ break;
+ case COLLADAFW::Transformation::MATRIX:
+ dae_matrix_to_mat4(tm, m);
+ break;
+ default:
+ fprintf(stderr, "unsupported transformation type %d\n", type);
+ }
+ }
+
+ float temp[4][4];
+ copy_m4_m4(temp, mat);
+
+ mul_m4_m4m4(mat, m, temp);
+ }
+}
+
+// return true to indicate that mat contains a sane value
+bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id)
+{
+ const COLLADAFW::UniqueId& listid = tm->getAnimationList();
+ COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
+
+ if (type != COLLADAFW::Transformation::ROTATE &&
+ type != COLLADAFW::Transformation::SCALE &&
+ type != COLLADAFW::Transformation::TRANSLATE &&
+ type != COLLADAFW::Transformation::MATRIX) {
+ fprintf(stderr, "animation of transformation %d is not supported yet\n", type);
+ return false;
+ }
+
+ if (animlist_map.find(listid) == animlist_map.end())
+ return false;
+
+ const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+ const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
+
+ if (bindings.getCount()) {
+ float vec[3];
+
+ bool is_scale = (type == COLLADAFW::Transformation::SCALE);
+ bool is_translate = (type == COLLADAFW::Transformation::TRANSLATE);
+
+ if (type == COLLADAFW::Transformation::SCALE)
+ dae_scale_to_v3(tm, vec);
+ else if (type == COLLADAFW::Transformation::TRANSLATE)
+ dae_translate_to_v3(tm, vec);
+
+ for (unsigned int j = 0; j < bindings.getCount(); j++) {
+ const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[j];
+ std::vector<FCurve*>& curves = curve_map[binding.animation];
+ COLLADAFW::AnimationList::AnimationClass animclass = binding.animationClass;
+ char path[100];
+
+ switch (type) {
+ case COLLADAFW::Transformation::ROTATE:
+ BLI_snprintf(path, sizeof(path), "%s.rotate (binding %u)", node_id, j);
+ break;
+ case COLLADAFW::Transformation::SCALE:
+ BLI_snprintf(path, sizeof(path), "%s.scale (binding %u)", node_id, j);
+ break;
+ case COLLADAFW::Transformation::TRANSLATE:
+ BLI_snprintf(path, sizeof(path), "%s.translate (binding %u)", node_id, j);
+ break;
+ case COLLADAFW::Transformation::MATRIX:
+ BLI_snprintf(path, sizeof(path), "%s.matrix (binding %u)", node_id, j);
+ break;
+ default:
+ break;
+ }
+
+ if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
+ fprintf(stderr, "%s: UNKNOWN animation class\n", path);
+ continue;
+ }
+
+ if (type == COLLADAFW::Transformation::ROTATE) {
+ if (curves.size() != 1) {
+ fprintf(stderr, "expected 1 curve, got %u\n", curves.size());
+ return false;
+ }
+
+ // TODO support other animclasses
+ if (animclass != COLLADAFW::AnimationList::ANGLE) {
+ fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
+ return false;
+ }
+
+ COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis();
+ float ax[3] = {axis[0], axis[1], axis[2]};
+ float angle = evaluate_fcurve(curves[0], fra);
+ axis_angle_to_mat4(mat, ax, angle);
+
+ return true;
+ }
+ else if (is_scale || is_translate) {
+ bool is_xyz = animclass == COLLADAFW::AnimationList::POSITION_XYZ;
+
+ if ((!is_xyz && curves.size() != 1) || (is_xyz && curves.size() != 3)) {
+ if (is_xyz)
+ fprintf(stderr, "%s: expected 3 curves, got %u\n", path, curves.size());
+ else
+ fprintf(stderr, "%s: expected 1 curve, got %u\n", path, curves.size());
+ return false;
+ }
+
+ switch (animclass) {
+ case COLLADAFW::AnimationList::POSITION_X:
+ vec[0] = evaluate_fcurve(curves[0], fra);
+ break;
+ case COLLADAFW::AnimationList::POSITION_Y:
+ vec[1] = evaluate_fcurve(curves[0], fra);
+ break;
+ case COLLADAFW::AnimationList::POSITION_Z:
+ vec[2] = evaluate_fcurve(curves[0], fra);
+ break;
+ case COLLADAFW::AnimationList::POSITION_XYZ:
+ vec[0] = evaluate_fcurve(curves[0], fra);
+ vec[1] = evaluate_fcurve(curves[1], fra);
+ vec[2] = evaluate_fcurve(curves[2], fra);
+ break;
+ default:
+ fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
+ break;
+ }
+ }
+ else if (type == COLLADAFW::Transformation::MATRIX) {
+ // for now, of matrix animation, support only the case when all values are packed into one animation
+ if (curves.size() != 16) {
+ fprintf(stderr, "%s: expected 16 curves, got %u\n", path, curves.size());
+ return false;
+ }
+
+ COLLADABU::Math::Matrix4 matrix;
+ int i = 0, j = 0;
+
+ for (std::vector<FCurve*>::iterator it = curves.begin(); it != curves.end(); it++) {
+ matrix.setElement(i, j, evaluate_fcurve(*it, fra));
+ j++;
+ if (j == 4) {
+ i++;
+ j = 0;
+ }
+ }
+
+ COLLADAFW::Matrix tm(matrix);
+ dae_matrix_to_mat4(&tm, mat);
+
+ return true;
+ }
+ }
+
+ if (is_scale)
+ size_to_mat4(mat, vec);
+ else
+ copy_v3_v3(mat[3], vec);
+
+ return is_scale || is_translate;
+ }
+
+ return false;
+}
+
+// gives a world-space mat of joint at rest position
+void AnimationImporter::get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node)
+{
+ // if bind mat is not available,
+ // use "current" node transform, i.e. all those tms listed inside <node>
+ if (!armature_importer->get_joint_bind_mat(mat, node)) {
+ float par[4][4], m[4][4];
+
+ calc_joint_parent_mat_rest(par, NULL, root, node);
+ get_node_mat(m, node, NULL, NULL);
+ mul_m4_m4m4(mat, m, par);
+ }
+}
+
+// gives a world-space mat, end's mat not included
+bool AnimationImporter::calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end)
+{
+ float m[4][4];
+
+ if (node == end) {
+ par ? copy_m4_m4(mat, par) : unit_m4(mat);
+ return true;
+ }
+
+ // use bind matrix if available or calc "current" world mat
+ if (!armature_importer->get_joint_bind_mat(m, node)) {
+ if (par) {
+ float temp[4][4];
+ get_node_mat(temp, node, NULL, NULL);
+ mul_m4_m4m4(m, temp, par);
+ }
+ else {
+ get_node_mat(m, node, NULL, NULL);
+ }
+ }
+
+ COLLADAFW::NodePointerArray& children = node->getChildNodes();
+ for (unsigned int i = 0; i < children.getCount(); i++) {
+ if (calc_joint_parent_mat_rest(mat, m, children[i], end))
+ return true;
+ }
+
+ return false;
+}
+
+#ifdef ARMATURE_TEST
+Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job)
+{
+ if (joint_objects.find(node->getUniqueId()) == joint_objects.end()) {
+ Object *job = add_object(scene, OB_EMPTY);
+
+ rename_id((ID*)&job->id, (char*)get_joint_name(node));
+
+ job->lay = object_in_scene(job, scene)->lay = 2;
+
+ mul_v3_fl(job->size, 0.5f);
+ job->recalc |= OB_RECALC_OB;
+
+ verify_adt_action((ID*)&job->id, 1);
+
+ job->rotmode = ROT_MODE_QUAT;
+
+ float mat[4][4];
+ get_joint_rest_mat(mat, root, node);
+
+ if (par_job) {
+ float temp[4][4], ipar[4][4];
+ invert_m4_m4(ipar, par_job->obmat);
+ copy_m4_m4(temp, mat);
+ mul_m4_m4m4(mat, temp, ipar);
+ }
+
+ TransformBase::decompose(mat, job->loc, NULL, job->quat, job->size);
+
+ if (par_job) {
+ job->parent = par_job;
+
+ par_job->recalc |= OB_RECALC_OB;
+ job->parsubstr[0] = 0;
+ }
+
+ where_is_object(scene, job);
+
+ // after parenting and layer change
+ DAG_scene_sort(CTX_data_main(C), scene);
+
+ joint_objects[node->getUniqueId()] = job;
+ }
+
+ return joint_objects[node->getUniqueId()];
+}
+#endif
+
+#if 0
+// recursively evaluates joint tree until end is found, mat then is world-space matrix of end
+// mat must be identity on enter, node must be root
+bool AnimationImporter::evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra)
+{
+ float m[4][4];
+ if (par) {
+ float temp[4][4];
+ evaluate_transform_at_frame(temp, node, node == end ? fra : 0.0f);
+ mul_m4_m4m4(m, temp, par);
+ }
+ else {
+ evaluate_transform_at_frame(m, node, node == end ? fra : 0.0f);
+ }
+
+ if (node == end) {
+ copy_m4_m4(mat, m);
+ return true;
+ }
+ else {
+ COLLADAFW::NodePointerArray& children = node->getChildNodes();
+ for (int i = 0; i < children.getCount(); i++) {
+ if (evaluate_joint_world_transform_at_frame(mat, m, children[i], end, fra))
+ return true;
+ }
+ }
+
+ return false;
+}
+#endif
+
+void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu)
+{
+ const char *bone_name = bc_get_joint_name(node);
+ bAction *act = ob->adt->action;
+
+ /* try to find group */
+ bActionGroup *grp = action_groups_find_named(act, bone_name);
+
+ /* no matching groups, so add one */
+ if (grp == NULL) {
+ /* Add a new group, and make it active */
+ grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
+
+ grp->flag = AGRP_SELECTED;
+ BLI_strncpy(grp->name, bone_name, sizeof(grp->name));
+
+ BLI_addtail(&act->groups, grp);
+ BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64);
+ }
+
+ /* add F-Curve to group */
+ action_groups_add_channel(act, grp, fcu);
+}
+
+void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value)
+{
+ BezTriple bez;
+ memset(&bez, 0, sizeof(BezTriple));
+ bez.vec[1][0] = fra;
+ bez.vec[1][1] = value;
+ bez.ipo = U.ipo_new; /* use default interpolation mode here... */
+ bez.f1 = bez.f2 = bez.f3 = SELECT;
+ bez.h1 = bez.h2 = HD_AUTO;
+ insert_bezt_fcurve(fcu, &bez, 0);
+ calchandles_fcurve(fcu);
+}
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
new file mode 100644
index 00000000000..01abac38280
--- /dev/null
+++ b/source/blender/collada/AnimationImporter.h
@@ -0,0 +1,132 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BC_ANIMATIONIMPORTER_H__
+#define __BC_ANIMATIONIMPORTER_H__
+
+#include <map>
+#include <vector>
+
+#include "COLLADAFWAnimation.h"
+#include "COLLADAFWAnimationCurve.h"
+#include "COLLADAFWAnimationList.h"
+#include "COLLADAFWNode.h"
+#include "COLLADAFWUniqueId.h"
+
+#include "DNA_anim_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+//#include "ArmatureImporter.h"
+#include "TransformReader.h"
+
+#include "collada_internal.h"
+
+class ArmatureImporter;
+
+class AnimationImporterBase
+{
+public:
+ // virtual void change_eul_to_quat(Object *ob, bAction *act) = 0;
+};
+
+class AnimationImporter : private TransformReader, public AnimationImporterBase
+{
+private:
+
+ ArmatureImporter *armature_importer;
+ Scene *scene;
+
+ std::map<COLLADAFW::UniqueId, std::vector<FCurve*> > curve_map;
+ std::map<COLLADAFW::UniqueId, TransformReader::Animation> uid_animated_map;
+ // std::map<bActionGroup*, std::vector<FCurve*> > fcurves_actionGroup_map;
+ std::map<COLLADAFW::UniqueId, const COLLADAFW::AnimationList*> animlist_map;
+ std::vector<FCurve*> unused_curves;
+ std::map<COLLADAFW::UniqueId, Object*> joint_objects;
+
+ FCurve *create_fcurve(int array_index, const char *rna_path);
+
+ void create_bezt(FCurve *fcu, float frame, float output);
+
+ // create one or several fcurves depending on the number of parameters being animated
+ void animation_to_fcurves(COLLADAFW::AnimationCurve *curve);
+
+ void fcurve_deg_to_rad(FCurve *cu);
+
+ void add_fcurves_to_object(Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated);
+public:
+
+ AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene);
+
+ ~AnimationImporter();
+
+ bool write_animation(const COLLADAFW::Animation* anim);
+
+ // called on post-process stage after writeVisualScenes
+ bool write_animation_list(const COLLADAFW::AnimationList* animlist);
+
+ void read_node_transform(COLLADAFW::Node *node, Object *ob);
+#if 0
+ virtual void change_eul_to_quat(Object *ob, bAction *act);
+#endif
+
+ // prerequisites:
+ // animlist_map - map animlist id -> animlist
+ // curve_map - map anim id -> curve(s)
+ Object *translate_animation(COLLADAFW::Node *node,
+ std::map<COLLADAFW::UniqueId, Object*>& object_map,
+ std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
+ COLLADAFW::Transformation::TransformationType tm_type,
+ Object *par_job = NULL);
+
+ // internal, better make it private
+ // warning: evaluates only rotation
+ // prerequisites: animlist_map, curve_map
+ void evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra);
+
+ // return true to indicate that mat contains a sane value
+ bool evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id);
+
+ // gives a world-space mat of joint at rest position
+ void get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node);
+
+ // gives a world-space mat, end's mat not included
+ bool calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end);
+
+#ifdef ARMATURE_TEST
+ Object *get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job);
+#endif
+
+#if 0
+ // recursively evaluates joint tree until end is found, mat then is world-space matrix of end
+ // mat must be identity on enter, node must be root
+ bool evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra);
+#endif
+
+ void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu);
+
+ void add_bezt(FCurve *fcu, float fra, float value);
+};
+
+ #endif
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
new file mode 100644
index 00000000000..255fb03da10
--- /dev/null
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -0,0 +1,469 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "COLLADASWBaseInputElement.h"
+#include "COLLADASWInstanceController.h"
+#include "COLLADASWPrimitves.h"
+#include "COLLADASWSource.h"
+
+#include "DNA_action_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
+
+#include "BKE_action.h"
+#include "BKE_armature.h"
+
+#include "BLI_listbase.h"
+
+#include "GeometryExporter.h"
+#include "ArmatureExporter.h"
+
+// XXX exporter writes wrong data for shared armatures. A separate
+// controller should be written for each armature-mesh binding how do
+// we make controller ids then?
+ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryControllers(sw) {}
+
+// write bone nodes
+void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce)
+{
+ // write bone nodes
+ bArmature *arm = (bArmature*)ob_arm->data;
+ for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) {
+ // start from root bones
+ if (!bone->parent)
+ add_bone_node(bone, ob_arm);
+ }
+}
+
+bool ArmatureExporter::is_skinned_mesh(Object *ob)
+{
+ return get_assigned_armature(ob) != NULL;
+}
+
+void ArmatureExporter::add_instance_controller(Object *ob)
+{
+ Object *ob_arm = get_assigned_armature(ob);
+ bArmature *arm = (bArmature*)ob_arm->data;
+
+ const std::string& controller_id = get_controller_id(ob_arm, ob);
+
+ COLLADASW::InstanceController ins(mSW);
+ ins.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, controller_id));
+
+ // write root bone URLs
+ Bone *bone;
+ for (bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) {
+ if (!bone->parent)
+ ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm)));
+ }
+
+ InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob);
+
+ ins.add();
+}
+
+void ArmatureExporter::export_controllers(Scene *sce)
+{
+ scene = sce;
+
+ openLibrary();
+
+ GeometryFunctor gf;
+ gf.forEachMeshObjectInScene<ArmatureExporter>(sce, *this);
+
+ closeLibrary();
+}
+
+void ArmatureExporter::operator()(Object *ob)
+{
+ Object *ob_arm = get_assigned_armature(ob);
+
+ if (ob_arm /*&& !already_written(ob_arm)*/)
+ export_controller(ob, ob_arm);
+}
+#if 0
+
+bool ArmatureExporter::already_written(Object *ob_arm)
+{
+ return std::find(written_armatures.begin(), written_armatures.end(), ob_arm) != written_armatures.end();
+}
+
+void ArmatureExporter::wrote(Object *ob_arm)
+{
+ written_armatures.push_back(ob_arm);
+}
+
+void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<Object *>& objects, Scene *sce)
+{
+ objects.clear();
+
+ Base *base= (Base*) sce->base.first;
+ while(base) {
+ Object *ob = base->object;
+
+ if (ob->type == OB_MESH && get_assigned_armature(ob) == ob_arm) {
+ objects.push_back(ob);
+ }
+
+ base= base->next;
+ }
+}
+#endif
+
+Object *ArmatureExporter::get_assigned_armature(Object *ob)
+{
+ Object *ob_arm = NULL;
+
+ if (ob->parent && ob->partype == PARSKEL && ob->parent->type == OB_ARMATURE) {
+ ob_arm = ob->parent;
+ }
+ else {
+ ModifierData *mod = (ModifierData*)ob->modifiers.first;
+ while (mod) {
+ if (mod->type == eModifierType_Armature) {
+ ob_arm = ((ArmatureModifierData*)mod)->object;
+ }
+
+ mod = mod->next;
+ }
+ }
+
+ return ob_arm;
+}
+
+std::string ArmatureExporter::get_joint_sid(Bone *bone, Object *ob_arm)
+{
+ return get_joint_id(bone, ob_arm);
+}
+
+// parent_mat is armature-space
+void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm)
+{
+ std::string node_id = get_joint_id(bone, ob_arm);
+ std::string node_name = std::string(bone->name);
+ std::string node_sid = get_joint_sid(bone, ob_arm);
+
+ COLLADASW::Node node(mSW);
+
+ node.setType(COLLADASW::Node::JOINT);
+ node.setNodeId(node_id);
+ node.setNodeName(node_name);
+ node.setNodeSid(node_sid);
+
+ node.start();
+
+ add_bone_transform(ob_arm, bone, node);
+
+ for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
+ add_bone_node(child, ob_arm);
+ }
+
+ node.end();
+}
+
+void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node)
+{
+ bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
+
+ float mat[4][4];
+
+ if (bone->parent) {
+ // get bone-space matrix from armature-space
+ bPoseChannel *parchan = get_pose_channel(ob_arm->pose, bone->parent->name);
+
+ float invpar[4][4];
+ invert_m4_m4(invpar, parchan->pose_mat);
+ mul_m4_m4m4(mat, pchan->pose_mat, invpar);
+ }
+ else {
+ // get world-space from armature-space
+ mul_m4_m4m4(mat, pchan->pose_mat, ob_arm->obmat);
+ }
+
+ TransformWriter::add_node_transform(node, mat, NULL);
+}
+
+std::string ArmatureExporter::get_controller_id(Object *ob_arm, Object *ob)
+{
+ return translate_id(id_name(ob_arm)) + "_" + translate_id(id_name(ob)) + SKIN_CONTROLLER_ID_SUFFIX;
+}
+
+// ob should be of type OB_MESH
+// both args are required
+void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
+{
+ // joint names
+ // joint inverse bind matrices
+ // vertex weights
+
+ // input:
+ // joint names: ob -> vertex group names
+ // vertex group weights: me->dvert -> groups -> index, weight
+
+ /*
+ me->dvert:
+
+ typedef struct MDeformVert {
+ struct MDeformWeight *dw;
+ int totweight;
+ int flag; // flag only in use for weightpaint now
+ } MDeformVert;
+
+ typedef struct MDeformWeight {
+ int def_nr;
+ float weight;
+ } MDeformWeight;
+ */
+
+ Mesh *me = (Mesh*)ob->data;
+ if (!me->dvert) return;
+
+ std::string controller_name = id_name(ob_arm);
+ std::string controller_id = get_controller_id(ob_arm, ob);
+
+ openSkin(controller_id, controller_name,
+ COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob)));
+
+ add_bind_shape_mat(ob);
+
+ std::string joints_source_id = add_joints_source(ob_arm, &ob->defbase, controller_id);
+ std::string inv_bind_mat_source_id = add_inv_bind_mats_source(ob_arm, &ob->defbase, controller_id);
+ std::string weights_source_id = add_weights_source(me, controller_id);
+
+ add_joints_element(&ob->defbase, joints_source_id, inv_bind_mat_source_id);
+ add_vertex_weights_element(weights_source_id, joints_source_id, me, ob_arm, &ob->defbase);
+
+ closeSkin();
+ closeController();
+}
+
+void ArmatureExporter::add_joints_element(ListBase *defbase,
+ const std::string& joints_source_id, const std::string& inv_bind_mat_source_id)
+{
+ COLLADASW::JointsElement joints(mSW);
+ COLLADASW::InputList &input = joints.getInputList();
+
+ input.push_back(COLLADASW::Input(COLLADASW::JOINT, // constant declared in COLLADASWInputList.h
+ COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id)));
+ input.push_back(COLLADASW::Input(COLLADASW::BINDMATRIX,
+ COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, inv_bind_mat_source_id)));
+ joints.add();
+}
+
+void ArmatureExporter::add_bind_shape_mat(Object *ob)
+{
+ double bind_mat[4][4];
+
+ converter.mat4_to_dae_double(bind_mat, ob->obmat);
+
+ addBindShapeTransform(bind_mat);
+}
+
+std::string ArmatureExporter::add_joints_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id)
+{
+ std::string source_id = controller_id + JOINTS_SOURCE_ID_SUFFIX;
+
+ int totjoint = 0;
+ bDeformGroup *def;
+ for (def = (bDeformGroup*)defbase->first; def; def = def->next) {
+ if (is_bone_defgroup(ob_arm, def))
+ totjoint++;
+ }
+
+ COLLADASW::NameSource source(mSW);
+ source.setId(source_id);
+ source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+ source.setAccessorCount(totjoint);
+ source.setAccessorStride(1);
+
+ COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+ param.push_back("JOINT");
+
+ source.prepareToAppendValues();
+
+ for (def = (bDeformGroup*)defbase->first; def; def = def->next) {
+ Bone *bone = get_bone_from_defgroup(ob_arm, def);
+ if (bone)
+ source.appendValues(get_joint_sid(bone, ob_arm));
+ }
+
+ source.finish();
+
+ return source_id;
+}
+
+std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id)
+{
+ std::string source_id = controller_id + BIND_POSES_SOURCE_ID_SUFFIX;
+
+ COLLADASW::FloatSourceF source(mSW);
+ source.setId(source_id);
+ source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+ source.setAccessorCount(BLI_countlist(defbase));
+ source.setAccessorStride(16);
+
+ source.setParameterTypeName(&COLLADASW::CSWC::CSW_VALUE_TYPE_FLOAT4x4);
+ COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+ param.push_back("TRANSFORM");
+
+ source.prepareToAppendValues();
+
+ bPose *pose = ob_arm->pose;
+ bArmature *arm = (bArmature*)ob_arm->data;
+
+ int flag = arm->flag;
+
+ // put armature in rest position
+ if (!(arm->flag & ARM_RESTPOS)) {
+ arm->flag |= ARM_RESTPOS;
+ where_is_pose(scene, ob_arm);
+ }
+
+ for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) {
+ if (is_bone_defgroup(ob_arm, def)) {
+
+ bPoseChannel *pchan = get_pose_channel(pose, def->name);
+
+ float mat[4][4];
+ float world[4][4];
+ float inv_bind_mat[4][4];
+
+ // make world-space matrix, pose_mat is armature-space
+ mul_m4_m4m4(world, pchan->pose_mat, ob_arm->obmat);
+
+ invert_m4_m4(mat, world);
+ converter.mat4_to_dae(inv_bind_mat, mat);
+
+ source.appendValues(inv_bind_mat);
+ }
+ }
+
+ // back from rest positon
+ if (!(flag & ARM_RESTPOS)) {
+ arm->flag = flag;
+ where_is_pose(scene, ob_arm);
+ }
+
+ source.finish();
+
+ return source_id;
+}
+
+Bone *ArmatureExporter::get_bone_from_defgroup(Object *ob_arm, bDeformGroup* def)
+{
+ bPoseChannel *pchan = get_pose_channel(ob_arm->pose, def->name);
+ return pchan ? pchan->bone : NULL;
+}
+
+bool ArmatureExporter::is_bone_defgroup(Object *ob_arm, bDeformGroup* def)
+{
+ return get_bone_from_defgroup(ob_arm, def) != NULL;
+}
+
+std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& controller_id)
+{
+ std::string source_id = controller_id + WEIGHTS_SOURCE_ID_SUFFIX;
+
+ int i;
+ int totweight = 0;
+
+ for (i = 0; i < me->totvert; i++) {
+ totweight += me->dvert[i].totweight;
+ }
+
+ COLLADASW::FloatSourceF source(mSW);
+ source.setId(source_id);
+ source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+ source.setAccessorCount(totweight);
+ source.setAccessorStride(1);
+
+ COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+ param.push_back("WEIGHT");
+
+ source.prepareToAppendValues();
+
+ // NOTE: COLLADA spec says weights should be normalized
+
+ for (i = 0; i < me->totvert; i++) {
+ MDeformVert *vert = &me->dvert[i];
+ for (int j = 0; j < vert->totweight; j++) {
+ source.appendValues(vert->dw[j].weight);
+ }
+ }
+
+ source.finish();
+
+ return source_id;
+}
+
+void ArmatureExporter::add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id, Mesh *me,
+ Object *ob_arm, ListBase *defbase)
+{
+ COLLADASW::VertexWeightsElement weights(mSW);
+ COLLADASW::InputList &input = weights.getInputList();
+
+ int offset = 0;
+ input.push_back(COLLADASW::Input(COLLADASW::JOINT, // constant declared in COLLADASWInputList.h
+ COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id), offset++));
+ input.push_back(COLLADASW::Input(COLLADASW::WEIGHT,
+ COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, weights_source_id), offset++));
+
+ weights.setCount(me->totvert);
+
+ // write number of deformers per vertex
+ COLLADASW::PrimitivesBase::VCountList vcount;
+ int i;
+ for (i = 0; i < me->totvert; i++) {
+ vcount.push_back(me->dvert[i].totweight);
+ }
+
+ weights.prepareToAppendVCountValues();
+ weights.appendVertexCount(vcount);
+
+ // def group index -> joint index
+ std::map<int, int> joint_index_by_def_index;
+ bDeformGroup *def;
+ int j;
+ for (def = (bDeformGroup*)defbase->first, i = 0, j = 0; def; def = def->next, i++) {
+ if (is_bone_defgroup(ob_arm, def))
+ joint_index_by_def_index[i] = j++;
+ else
+ joint_index_by_def_index[i] = -1;
+ }
+
+ weights.CloseVCountAndOpenVElement();
+
+ // write deformer index - weight index pairs
+ int weight_index = 0;
+ for (i = 0; i < me->totvert; i++) {
+ MDeformVert *dvert = &me->dvert[i];
+ for (int j = 0; j < dvert->totweight; j++) {
+ weights.appendValues(joint_index_by_def_index[dvert->dw[j].def_nr]);
+ weights.appendValues(weight_index++);
+ }
+ }
+
+ weights.finish();
+}
diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h
new file mode 100644
index 00000000000..8d2508282bd
--- /dev/null
+++ b/source/blender/collada/ArmatureExporter.h
@@ -0,0 +1,137 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __ARMATUREEXPORTER_H__
+#define __ARMATUREEXPORTER_H__
+
+#include <string>
+//#include <vector>
+
+#include "COLLADASWStreamWriter.h"
+#include "COLLADASWLibraryControllers.h"
+#include "COLLADASWInputList.h"
+#include "COLLADASWNode.h"
+
+#include "DNA_armature_types.h"
+#include "DNA_listBase.h"
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "TransformWriter.h"
+#include "InstanceWriter.h"
+
+// XXX exporter writes wrong data for shared armatures. A separate
+// controller should be written for each armature-mesh binding how do
+// we make controller ids then?
+class ArmatureExporter: public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
+{
+private:
+ Scene *scene;
+
+public:
+ ArmatureExporter(COLLADASW::StreamWriter *sw);
+
+ // write bone nodes
+ void add_armature_bones(Object *ob_arm, Scene *sce);
+
+ bool is_skinned_mesh(Object *ob);
+
+ void add_instance_controller(Object *ob);
+
+ void export_controllers(Scene *sce);
+
+ void operator()(Object *ob);
+
+private:
+
+ UnitConverter converter;
+
+#if 0
+ std::vector<Object*> written_armatures;
+
+ bool already_written(Object *ob_arm);
+
+ void wrote(Object *ob_arm);
+
+ void find_objects_using_armature(Object *ob_arm, std::vector<Object *>& objects, Scene *sce);
+#endif
+
+ Object *get_assigned_armature(Object *ob);
+
+ std::string get_joint_sid(Bone *bone, Object *ob_arm);
+
+ // parent_mat is armature-space
+ void add_bone_node(Bone *bone, Object *ob_arm);
+
+ void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node);
+
+ std::string get_controller_id(Object *ob_arm, Object *ob);
+
+ // ob should be of type OB_MESH
+ // both args are required
+ void export_controller(Object* ob, Object *ob_arm);
+
+ void add_joints_element(ListBase *defbase,
+ const std::string& joints_source_id, const std::string& inv_bind_mat_source_id);
+
+ void add_bind_shape_mat(Object *ob);
+
+ std::string add_joints_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id);
+
+ std::string add_inv_bind_mats_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id);
+
+ Bone *get_bone_from_defgroup(Object *ob_arm, bDeformGroup* def);
+
+ bool is_bone_defgroup(Object *ob_arm, bDeformGroup* def);
+
+ std::string add_weights_source(Mesh *me, const std::string& controller_id);
+
+ void add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id, Mesh *me,
+ Object *ob_arm, ListBase *defbase);
+};
+
+/*
+struct GeometryFunctor {
+ // f should have
+ // void operator()(Object* ob)
+ template<class Functor>
+ void forEachMeshObjectInScene(Scene *sce, Functor &f)
+ {
+
+ Base *base= (Base*) sce->base.first;
+ while(base) {
+ Object *ob = base->object;
+
+ if (ob->type == OB_MESH && ob->data) {
+ f(ob);
+ }
+ base= base->next;
+
+ }
+ }
+};*/
+
+#endif
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
new file mode 100644
index 00000000000..a8ac6d8b768
--- /dev/null
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -0,0 +1,585 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <algorithm>
+
+#include "COLLADAFWUniqueId.h"
+
+#include "BKE_action.h"
+#include "BKE_depsgraph.h"
+#include "BKE_object.h"
+#include "BLI_string.h"
+#include "ED_armature.h"
+
+#include "ArmatureImporter.h"
+
+// use this for retrieving bone names, since these must be unique
+template<class T>
+static const char *bc_get_joint_name(T *node)
+{
+ const std::string& id = node->getOriginalId();
+ return id.size() ? id.c_str() : node->getName().c_str();
+}
+
+ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce) :
+ TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh), anim_importer(anim) {}
+
+ArmatureImporter::~ArmatureImporter()
+{
+ // free skin controller data if we forget to do this earlier
+ std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
+ for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
+ it->second.free();
+ }
+}
+
+#if 0
+JointData *ArmatureImporter::get_joint_data(COLLADAFW::Node *node);
+{
+ const COLLADAFW::UniqueId& joint_id = node->getUniqueId();
+
+ if (joint_id_to_joint_index_map.find(joint_id) == joint_id_to_joint_index_map.end()) {
+ fprintf(stderr, "Cannot find a joint index by joint id for %s.\n",
+ node->getOriginalId().c_str());
+ return NULL;
+ }
+
+ int joint_index = joint_id_to_joint_index_map[joint_id];
+
+ return &joint_index_to_joint_info_map[joint_index];
+}
+#endif
+
+void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBone *parent, int totchild,
+ float parent_mat[][4], bArmature *arm)
+{
+ float joint_inv_bind_mat[4][4];
+
+ // JointData* jd = get_joint_data(node);
+
+ float mat[4][4];
+
+ if (skin.get_joint_inv_bind_matrix(joint_inv_bind_mat, node)) {
+ // get original world-space matrix
+ invert_m4_m4(mat, joint_inv_bind_mat);
+ }
+ // create a bone even if there's no joint data for it (i.e. it has no influence)
+ else {
+ float obmat[4][4];
+
+ // object-space
+ get_node_mat(obmat, node, NULL, NULL);
+
+ // get world-space
+ if (parent)
+ mul_m4_m4m4(mat, obmat, parent_mat);
+ else
+ copy_m4_m4(mat, obmat);
+ }
+
+ // TODO rename from Node "name" attrs later
+ EditBone *bone = ED_armature_edit_bone_add(arm, (char*)bc_get_joint_name(node));
+ totbone++;
+
+ if (parent) bone->parent = parent;
+
+ // set head
+ copy_v3_v3(bone->head, mat[3]);
+
+ // set tail, don't set it to head because 0-length bones are not allowed
+ float vec[3] = {0.0f, 0.5f, 0.0f};
+ add_v3_v3v3(bone->tail, bone->head, vec);
+
+ // set parent tail
+ if (parent && totchild == 1) {
+ copy_v3_v3(parent->tail, bone->head);
+
+ // not setting BONE_CONNECTED because this would lock child bone location with respect to parent
+ // bone->flag |= BONE_CONNECTED;
+
+ // XXX increase this to prevent "very" small bones?
+ const float epsilon = 0.000001f;
+
+ // derive leaf bone length
+ float length = len_v3v3(parent->head, parent->tail);
+ if ((length < leaf_bone_length || totbone == 0) && length > epsilon) {
+ leaf_bone_length = length;
+ }
+
+ // treat zero-sized bone like a leaf bone
+ if (length <= epsilon) {
+ add_leaf_bone(parent_mat, parent);
+ }
+
+ /*
+#if 0
+ // and which row in mat is bone direction
+ float vec[3];
+ sub_v3_v3v3(vec, parent->tail, parent->head);
+#ifdef COLLADA_DEBUG
+ print_v3("tail - head", vec);
+ print_m4("matrix", parent_mat);
+#endif
+ for (int i = 0; i < 3; i++) {
+#ifdef COLLADA_DEBUG
+ char *axis_names[] = {"X", "Y", "Z"};
+ printf("%s-axis length is %f\n", axis_names[i], len_v3(parent_mat[i]));
+#endif
+ float angle = angle_v2v2(vec, parent_mat[i]);
+ if (angle < min_angle) {
+#ifdef COLLADA_DEBUG
+ print_v3("picking", parent_mat[i]);
+ printf("^ %s axis of %s's matrix\n", axis_names[i], get_dae_name(node));
+#endif
+ bone_direction_row = i;
+ min_angle = angle;
+ }
+ }
+#endif
+ */
+ }
+
+ COLLADAFW::NodePointerArray& children = node->getChildNodes();
+ for (unsigned int i = 0; i < children.getCount(); i++) {
+ create_bone(skin, children[i], bone, children.getCount(), mat, arm);
+ }
+
+ // in second case it's not a leaf bone, but we handle it the same way
+ if (!children.getCount() || children.getCount() > 1) {
+ add_leaf_bone(mat, bone);
+ }
+}
+
+void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone)
+{
+ LeafBone leaf;
+
+ leaf.bone = bone;
+ copy_m4_m4(leaf.mat, mat);
+ BLI_strncpy(leaf.name, bone->name, sizeof(leaf.name));
+
+ leaf_bones.push_back(leaf);
+}
+
+void ArmatureImporter::fix_leaf_bones()
+{
+ // just setting tail for leaf bones here
+
+ std::vector<LeafBone>::iterator it;
+ for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) {
+ LeafBone& leaf = *it;
+
+ // pointing up
+ float vec[3] = {0.0f, 0.0f, 1.0f};
+
+ mul_v3_fl(vec, leaf_bone_length);
+
+ copy_v3_v3(leaf.bone->tail, leaf.bone->head);
+ add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
+ }
+}
+
+void ArmatureImporter::set_leaf_bone_shapes(Object *ob_arm)
+{
+ bPose *pose = ob_arm->pose;
+
+ std::vector<LeafBone>::iterator it;
+ for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) {
+ LeafBone& leaf = *it;
+
+ bPoseChannel *pchan = get_pose_channel(pose, leaf.name);
+ if (pchan) {
+ pchan->custom = get_empty_for_leaves();
+ }
+ else {
+ fprintf(stderr, "Cannot find a pose channel for leaf bone %s\n", leaf.name);
+ }
+ }
+}
+
+#if 0
+void ArmatureImporter::set_euler_rotmode()
+{
+ // just set rotmode = ROT_MODE_EUL on pose channel for each joint
+
+ std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>::iterator it;
+
+ for (it = joint_by_uid.begin(); it != joint_by_uid.end(); it++) {
+
+ COLLADAFW::Node *joint = it->second;
+
+ std::map<COLLADAFW::UniqueId, SkinInfo>::iterator sit;
+
+ for (sit = skin_by_data_uid.begin(); sit != skin_by_data_uid.end(); sit++) {
+ SkinInfo& skin = sit->second;
+
+ if (skin.uses_joint_or_descendant(joint)) {
+ bPoseChannel *pchan = skin.get_pose_channel_from_node(joint);
+
+ if (pchan) {
+ pchan->rotmode = ROT_MODE_EUL;
+ }
+ else {
+ fprintf(stderr, "Cannot find pose channel for %s.\n", get_joint_name(joint));
+ }
+
+ break;
+ }
+ }
+ }
+}
+#endif
+
+Object *ArmatureImporter::get_empty_for_leaves()
+{
+ if (empty) return empty;
+
+ empty = add_object(scene, OB_EMPTY);
+ empty->empty_drawtype = OB_EMPTY_SPHERE;
+
+ return empty;
+}
+
+#if 0
+Object *ArmatureImporter::find_armature(COLLADAFW::Node *node)
+{
+ JointData* jd = get_joint_data(node);
+ if (jd) return jd->ob_arm;
+
+ COLLADAFW::NodePointerArray& children = node->getChildNodes();
+ for (int i = 0; i < children.getCount(); i++) {
+ Object *ob_arm = find_armature(children[i]);
+ if (ob_arm) return ob_arm;
+ }
+
+ return NULL;
+}
+
+ArmatureJoints& ArmatureImporter::get_armature_joints(Object *ob_arm)
+{
+ // try finding it
+ std::vector<ArmatureJoints>::iterator it;
+ for (it = armature_joints.begin(); it != armature_joints.end(); it++) {
+ if ((*it).ob_arm == ob_arm) return *it;
+ }
+
+ // not found, create one
+ ArmatureJoints aj;
+ aj.ob_arm = ob_arm;
+ armature_joints.push_back(aj);
+
+ return armature_joints.back();
+}
+#endif
+
+void ArmatureImporter::create_armature_bones(SkinInfo& skin)
+{
+ // just do like so:
+ // - get armature
+ // - enter editmode
+ // - add edit bones and head/tail properties using matrices and parent-child info
+ // - exit edit mode
+ // - set a sphere shape to leaf bones
+
+ Object *ob_arm = NULL;
+
+ /*
+ * find if there's another skin sharing at least one bone with this skin
+ * if so, use that skin's armature
+ */
+
+ /*
+ Pseudocode:
+
+ find_node_in_tree(node, root_joint)
+
+ skin::find_root_joints(root_joints):
+ std::vector root_joints;
+ for each root in root_joints:
+ for each joint in joints:
+ if find_node_in_tree(joint, root):
+ if (std::find(root_joints.begin(), root_joints.end(), root) == root_joints.end())
+ root_joints.push_back(root);
+
+ for (each skin B with armature) {
+ find all root joints for skin B
+
+ for each joint X in skin A:
+ for each root joint R in skin B:
+ if (find_node_in_tree(X, R)) {
+ shared = 1;
+ goto endloop;
+ }
+ }
+
+ endloop:
+ */
+
+ SkinInfo *a = &skin;
+ Object *shared = NULL;
+ std::vector<COLLADAFW::Node*> skin_root_joints;
+
+ std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
+ for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
+ SkinInfo *b = &it->second;
+ if (b == a || b->get_armature() == NULL)
+ continue;
+
+ skin_root_joints.clear();
+
+ b->find_root_joints(root_joints, joint_by_uid, skin_root_joints);
+
+ std::vector<COLLADAFW::Node*>::iterator ri;
+ for (ri = skin_root_joints.begin(); ri != skin_root_joints.end(); ri++) {
+ if (a->uses_joint_or_descendant(*ri)) {
+ shared = b->get_armature();
+ break;
+ }
+ }
+
+ if (shared != NULL)
+ break;
+ }
+
+ if (shared)
+ ob_arm = skin.set_armature(shared);
+ else
+ ob_arm = skin.create_armature(scene);
+
+ // enter armature edit mode
+ ED_armature_to_edit(ob_arm);
+
+ leaf_bones.clear();
+ totbone = 0;
+ // bone_direction_row = 1; // TODO: don't default to Y but use asset and based on it decide on default row
+ leaf_bone_length = 0.1f;
+ // min_angle = 360.0f; // minimum angle between bone head-tail and a row of bone matrix
+
+ // create bones
+ /*
+ TODO:
+ check if bones have already been created for a given joint
+ */
+
+ std::vector<COLLADAFW::Node*>::iterator ri;
+ for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
+ // for shared armature check if bone tree is already created
+ if (shared && std::find(skin_root_joints.begin(), skin_root_joints.end(), *ri) != skin_root_joints.end())
+ continue;
+
+ // since root_joints may contain joints for multiple controllers, we need to filter
+ if (skin.uses_joint_or_descendant(*ri)) {
+ create_bone(skin, *ri, NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature*)ob_arm->data);
+
+ if (joint_parent_map.find((*ri)->getUniqueId()) != joint_parent_map.end() && !skin.get_parent())
+ skin.set_parent(joint_parent_map[(*ri)->getUniqueId()]);
+ }
+ }
+
+ fix_leaf_bones();
+
+ // exit armature edit mode
+ ED_armature_from_edit(ob_arm);
+ ED_armature_edit_free(ob_arm);
+ DAG_id_flush_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
+
+ set_leaf_bone_shapes(ob_arm);
+
+ // set_euler_rotmode();
+}
+
+
+// root - if this joint is the top joint in hierarchy, if a joint
+// is a child of a node (not joint), root should be true since
+// this is where we build armature bones from
+void ArmatureImporter::add_joint(COLLADAFW::Node *node, bool root, Object *parent)
+{
+ joint_by_uid[node->getUniqueId()] = node;
+ if (root) {
+ root_joints.push_back(node);
+
+ if (parent)
+ joint_parent_map[node->getUniqueId()] = parent;
+ }
+}
+
+#if 0
+void ArmatureImporter::add_root_joint(COLLADAFW::Node *node)
+{
+ // root_joints.push_back(node);
+ Object *ob_arm = find_armature(node);
+ if (ob_arm) {
+ get_armature_joints(ob_arm).root_joints.push_back(node);
+ }
+#ifdef COLLADA_DEBUG
+ else {
+ fprintf(stderr, "%s cannot be added to armature.\n", get_joint_name(node));
+ }
+#endif
+}
+#endif
+
+// here we add bones to armatures, having armatures previously created in write_controller
+void ArmatureImporter::make_armatures(bContext *C)
+{
+ std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
+ for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
+
+ SkinInfo& skin = it->second;
+
+ create_armature_bones(skin);
+
+ // link armature with a mesh object
+ Object *ob = mesh_importer->get_object_by_geom_uid(*get_geometry_uid(skin.get_controller_uid()));
+ if (ob)
+ skin.link_armature(C, ob, joint_by_uid, this);
+ else
+ fprintf(stderr, "Cannot find object to link armature with.\n");
+
+ // set armature parent if any
+ Object *par = skin.get_parent();
+ if (par)
+ bc_set_parent(skin.get_armature(), par, C, false);
+
+ // free memory stolen from SkinControllerData
+ skin.free();
+ }
+}
+
+#if 0
+// link with meshes, create vertex groups, assign weights
+void ArmatureImporter::link_armature(Object *ob_arm, const COLLADAFW::UniqueId& geom_id, const COLLADAFW::UniqueId& controller_data_id)
+{
+ Object *ob = mesh_importer->get_object_by_geom_uid(geom_id);
+
+ if (!ob) {
+ fprintf(stderr, "Cannot find object by geometry UID.\n");
+ return;
+ }
+
+ if (skin_by_data_uid.find(controller_data_id) == skin_by_data_uid.end()) {
+ fprintf(stderr, "Cannot find skin info by controller data UID.\n");
+ return;
+ }
+
+ SkinInfo& skin = skin_by_data_uid[conroller_data_id];
+
+ // create vertex groups
+}
+#endif
+
+bool ArmatureImporter::write_skin_controller_data(const COLLADAFW::SkinControllerData* data)
+{
+ // at this stage we get vertex influence info that should go into me->verts and ob->defbase
+ // there's no info to which object this should be long so we associate it with skin controller data UID
+
+ // don't forget to call defgroup_unique_name before we copy
+
+ // controller data uid -> [armature] -> joint data,
+ // [mesh object]
+ //
+
+ SkinInfo skin(unit_converter);
+ skin.borrow_skin_controller_data(data);
+
+ // store join inv bind matrix to use it later in armature construction
+ const COLLADAFW::Matrix4Array& inv_bind_mats = data->getInverseBindMatrices();
+ for (unsigned int i = 0; i < data->getJointsCount(); i++) {
+ skin.add_joint(inv_bind_mats[i]);
+ }
+
+ skin_by_data_uid[data->getUniqueId()] = skin;
+
+ return true;
+}
+
+bool ArmatureImporter::write_controller(const COLLADAFW::Controller* controller)
+{
+ // - create and store armature object
+
+ const COLLADAFW::UniqueId& skin_id = controller->getUniqueId();
+
+ if (controller->getControllerType() == COLLADAFW::Controller::CONTROLLER_TYPE_SKIN) {
+ COLLADAFW::SkinController *co = (COLLADAFW::SkinController*)controller;
+ // to be able to find geom id by controller id
+ geom_uid_by_controller_uid[skin_id] = co->getSource();
+
+ const COLLADAFW::UniqueId& data_uid = co->getSkinControllerData();
+ if (skin_by_data_uid.find(data_uid) == skin_by_data_uid.end()) {
+ fprintf(stderr, "Cannot find skin by controller data UID.\n");
+ return true;
+ }
+
+ skin_by_data_uid[data_uid].set_controller(co);
+ }
+ // morph controller
+ else {
+ // shape keys? :)
+ fprintf(stderr, "Morph controller is not supported yet.\n");
+ }
+
+ return true;
+}
+
+COLLADAFW::UniqueId *ArmatureImporter::get_geometry_uid(const COLLADAFW::UniqueId& controller_uid)
+{
+ if (geom_uid_by_controller_uid.find(controller_uid) == geom_uid_by_controller_uid.end())
+ return NULL;
+
+ return &geom_uid_by_controller_uid[controller_uid];
+}
+
+Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node)
+{
+ std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
+ for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
+ SkinInfo& skin = it->second;
+
+ if (skin.uses_joint_or_descendant(node))
+ return skin.get_armature();
+ }
+
+ return NULL;
+}
+
+void ArmatureImporter::get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count)
+{
+ BLI_snprintf(joint_path, count, "pose.bones[\"%s\"]", bc_get_joint_name(node));
+}
+
+// gives a world-space mat
+bool ArmatureImporter::get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint)
+{
+ std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
+ bool found = false;
+ for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
+ SkinInfo& skin = it->second;
+ if ((found = skin.get_joint_inv_bind_matrix(m, joint))) {
+ invert_m4(m);
+ break;
+ }
+ }
+
+ return found;
+}
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
new file mode 100644
index 00000000000..a857ab67f12
--- /dev/null
+++ b/source/blender/collada/ArmatureImporter.h
@@ -0,0 +1,160 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BC_ARMATUREIMPORTER_H__
+#define __BC_ARMATUREIMPORTER_H__
+
+#include "COLLADAFWNode.h"
+#include "COLLADAFWUniqueId.h"
+
+extern "C" {
+#include "BKE_context.h"
+
+#include "DNA_armature_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "ED_armature.h"
+}
+
+#include "AnimationImporter.h"
+#include "MeshImporter.h"
+#include "SkinInfo.h"
+#include "TransformReader.h"
+
+#include <map>
+#include <vector>
+
+#include "collada_internal.h"
+#include "collada_utils.h"
+
+class ArmatureImporter : private TransformReader
+{
+private:
+ Scene *scene;
+ UnitConverter *unit_converter;
+
+ // std::map<int, JointData> joint_index_to_joint_info_map;
+ // std::map<COLLADAFW::UniqueId, int> joint_id_to_joint_index_map;
+
+ struct LeafBone {
+ // COLLADAFW::Node *node;
+ EditBone *bone;
+ char name[32];
+ float mat[4][4]; // bone matrix, derived from inv_bind_mat
+ };
+ std::vector<LeafBone> leaf_bones;
+ // int bone_direction_row; // XXX not used
+ float leaf_bone_length;
+ int totbone;
+ // XXX not used
+ // float min_angle; // minimum angle between bone head-tail and a row of bone matrix
+
+#if 0
+ struct ArmatureJoints {
+ Object *ob_arm;
+ std::vector<COLLADAFW::Node*> root_joints;
+ };
+ std::vector<ArmatureJoints> armature_joints;
+#endif
+
+ Object *empty; // empty for leaf bones
+
+ std::map<COLLADAFW::UniqueId, COLLADAFW::UniqueId> geom_uid_by_controller_uid;
+ std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> joint_by_uid; // contains all joints
+ std::vector<COLLADAFW::Node*> root_joints;
+ std::map<COLLADAFW::UniqueId, Object*> joint_parent_map;
+
+ MeshImporterBase *mesh_importer;
+ AnimationImporterBase *anim_importer;
+
+ // This is used to store data passed in write_controller_data.
+ // Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members
+ // so that arrays don't get freed until we free them explicitly.
+
+ std::map<COLLADAFW::UniqueId, SkinInfo> skin_by_data_uid; // data UID = skin controller data UID
+#if 0
+ JointData *get_joint_data(COLLADAFW::Node *node);
+#endif
+
+ void create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBone *parent, int totchild,
+ float parent_mat[][4], bArmature *arm);
+
+ void add_leaf_bone(float mat[][4], EditBone *bone);
+
+ void fix_leaf_bones();
+
+ void set_leaf_bone_shapes(Object *ob_arm);
+
+#if 0
+ void set_euler_rotmode();
+#endif
+
+ Object *get_empty_for_leaves();
+
+#if 0
+ Object *find_armature(COLLADAFW::Node *node);
+
+ ArmatureJoints& get_armature_joints(Object *ob_arm);
+#endif
+
+ void create_armature_bones(SkinInfo& skin);
+
+public:
+
+ ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce);
+ ~ArmatureImporter();
+
+ // root - if this joint is the top joint in hierarchy, if a joint
+ // is a child of a node (not joint), root should be true since
+ // this is where we build armature bones from
+ void add_joint(COLLADAFW::Node *node, bool root, Object *parent);
+
+#if 0
+ void add_root_joint(COLLADAFW::Node *node);
+#endif
+
+ // here we add bones to armatures, having armatures previously created in write_controller
+ void make_armatures(bContext *C);
+
+#if 0
+ // link with meshes, create vertex groups, assign weights
+ void link_armature(Object *ob_arm, const COLLADAFW::UniqueId& geom_id, const COLLADAFW::UniqueId& controller_data_id);
+#endif
+
+ bool write_skin_controller_data(const COLLADAFW::SkinControllerData* data);
+
+ bool write_controller(const COLLADAFW::Controller* controller);
+
+ COLLADAFW::UniqueId *get_geometry_uid(const COLLADAFW::UniqueId& controller_uid);
+
+ Object *get_armature_for_joint(COLLADAFW::Node *node);
+
+ void get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count);
+
+ // gives a world-space mat
+ bool get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint);
+};
+
+#endif
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp
new file mode 100644
index 00000000000..d5e2a7e116c
--- /dev/null
+++ b/source/blender/collada/CameraExporter.cpp
@@ -0,0 +1,86 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string>
+
+#include "COLLADASWCamera.h"
+#include "COLLADASWCameraOptic.h"
+
+#include "DNA_camera_types.h"
+
+#include "CameraExporter.h"
+
+#include "collada_internal.h"
+
+CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryCameras(sw){}
+
+template<class Functor>
+void forEachCameraObjectInScene(Scene *sce, Functor &f)
+{
+ Base *base= (Base*) sce->base.first;
+ while(base) {
+ Object *ob = base->object;
+
+ if (ob->type == OB_CAMERA && ob->data) {
+ f(ob, sce);
+ }
+ base= base->next;
+ }
+}
+
+void CamerasExporter::exportCameras(Scene *sce)
+{
+ openLibrary();
+
+ forEachCameraObjectInScene(sce, *this);
+
+ closeLibrary();
+}
+void CamerasExporter::operator()(Object *ob, Scene *sce)
+{
+ // TODO: shiftx, shifty, YF_dofdist
+ Camera *cam = (Camera*)ob->data;
+ std::string cam_id(get_camera_id(ob));
+ std::string cam_name(id_name(cam));
+
+ if (cam->type == CAM_PERSP) {
+ COLLADASW::PerspectiveOptic persp(mSW);
+ persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI));
+ persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch));
+ persp.setZFar(cam->clipend);
+ persp.setZNear(cam->clipsta);
+ COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
+ addCamera(ccam);
+ }
+ else {
+ COLLADASW::OrthographicOptic ortho(mSW);
+ ortho.setXMag(cam->ortho_scale);
+ ortho.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch));
+ ortho.setZFar(cam->clipend);
+ ortho.setZNear(cam->clipsta);
+ COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
+ addCamera(ccam);
+ }
+}
diff --git a/source/blender/verify/BLO_signer_info.h b/source/blender/collada/CameraExporter.h
index 39059cf94a7..fd20c934c96 100644
--- a/source/blender/verify/BLO_signer_info.h
+++ b/source/blender/collada/CameraExporter.h
@@ -17,29 +17,27 @@
* 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.
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
*
* ***** END GPL LICENSE BLOCK *****
- *
*/
-#include "BLO_sign_verify_Header.h"
+#ifndef __CAMERAEXPORTER_H__
+#define __CAMERAEXPORTER_H__
-/* external struct for signer info */
+#include "COLLADASWStreamWriter.h"
+#include "COLLADASWLibraryCameras.h"
-struct BLO_SignerInfo {
- char name[MAXSIGNERLEN];
- char email[MAXSIGNERLEN];
- char homeUrl[MAXSIGNERLEN];
- /* more to come... */
-};
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
-struct BLO_SignerInfo *BLO_getSignerInfo(void);
-int BLO_isValidSignerInfo(struct BLO_SignerInfo *info);
-void BLO_clrSignerInfo(struct BLO_SignerInfo *info);
+class CamerasExporter: COLLADASW::LibraryCameras
+{
+public:
+ CamerasExporter(COLLADASW::StreamWriter *sw);
+ void exportCameras(Scene *sce);
+ void operator()(Object *ob, Scene *sce);
+};
+#endif
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index d10fa4ca94c..9062bd4ba9f 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -34,8 +34,6 @@ extern "C"
#include "DNA_image_types.h"
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_lamp_types.h"
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
@@ -71,10 +69,11 @@ extern char build_rev[];
#include "BLI_string.h"
#include "BLI_listbase.h"
+#include "RNA_access.h"
+
#include "COLLADASWAsset.h"
#include "COLLADASWLibraryVisualScenes.h"
#include "COLLADASWNode.h"
-#include "COLLADASWLibraryGeometries.h"
#include "COLLADASWSource.h"
#include "COLLADASWInstanceGeometry.h"
#include "COLLADASWInputList.h"
@@ -91,16 +90,12 @@ extern char build_rev[];
#include "COLLADASWSurfaceInitOption.h"
#include "COLLADASWSampler.h"
#include "COLLADASWScene.h"
-//#include "COLLADASWSurface.h"
#include "COLLADASWTechnique.h"
#include "COLLADASWTexture.h"
#include "COLLADASWLibraryMaterials.h"
#include "COLLADASWBindMaterial.h"
-#include "COLLADASWLibraryCameras.h"
-#include "COLLADASWLibraryLights.h"
#include "COLLADASWInstanceCamera.h"
#include "COLLADASWInstanceLight.h"
-#include "COLLADASWCameraOptic.h"
#include "COLLADASWConstants.h"
#include "COLLADASWLibraryControllers.h"
#include "COLLADASWInstanceController.h"
@@ -109,35 +104,22 @@ extern char build_rev[];
#include "collada_internal.h"
#include "DocumentExporter.h"
+// can probably go after refactor is complete
+#include "InstanceWriter.h"
+#include "TransformWriter.h"
+
+#include "ArmatureExporter.h"
+#include "CameraExporter.h"
+#include "EffectExporter.h"
+#include "GeometryExporter.h"
+#include "ImageExporter.h"
+#include "LightExporter.h"
+#include "MaterialExporter.h"
+
#include <vector>
#include <algorithm> // std::find
-// arithb.c now has QuatToAxisAngle too
-#if 0
-// This function assumes that quat is normalized.
-// The following document was used as reference:
-// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
-void quat_to_axis_angle( float *axis, float *angle,float *q)
-{
- // quat to axis angle
- *angle = 2 * acos(q[0]);
- float divisor = sqrt(1 - q[0] * q[0]);
-
- // test to avoid divide by zero, divisor is always positive
- if (divisor < 0.001f ) {
- axis[0] = 1.0f;
- axis[1] = 0.0f;
- axis[2] = 0.0f;
- }
- else {
- axis[0] = q[1] / divisor;
- axis[1] = q[2] / divisor;
- axis[2] = q[3] / divisor;
- }
-}
-#endif
-
-char *CustomData_get_layer_name(const struct CustomData *data, int type, int n)
+char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n)
{
int layer_index = CustomData_get_layer_index(data, type);
if(layer_index < 0) return NULL;
@@ -145,7 +127,7 @@ char *CustomData_get_layer_name(const struct CustomData *data, int type, int n)
return data->layers[layer_index+n].name;
}
-char *CustomData_get_active_layer_name(const CustomData *data, int type)
+char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
{
/* get the layer index of the active layer of type */
int layer_index = CustomData_get_active_layer_index(data, type);
@@ -154,185 +136,12 @@ char *CustomData_get_active_layer_name(const CustomData *data, int type)
return data->layers[layer_index].name;
}
-/**
-Translation map.
-Used to translate every COLLADA id to a valid id, no matter what "wrong" letters may be
-included. Look at the IDREF XSD declaration for more.
-Follows strictly the COLLADA XSD declaration which explicitly allows non-english chars,
-like special chars (e.g. micro sign), umlauts and so on.
-The COLLADA spec also allows additional chars for member access ('.'), these
-must obviously be removed too, otherwise they would be heavily misinterpreted.
-*/
-const unsigned char translate_start_name_map[256] = {
-95, 95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-65, 66, 67, 68, 69, 70, 71, 72,
-73, 74, 75, 76, 77, 78, 79, 80,
-81, 82, 83, 84, 85, 86, 87, 88,
-89, 90, 95, 95, 95, 95, 95, 95,
-97, 98, 99, 100, 101, 102, 103, 104,
-105, 106, 107, 108, 109, 110, 111, 112,
-113, 114, 115, 116, 117, 118, 119, 120,
-121, 122, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 192,
-193, 194, 195, 196, 197, 198, 199, 200,
-201, 202, 203, 204, 205, 206, 207, 208,
-209, 210, 211, 212, 213, 214, 95, 216,
-217, 218, 219, 220, 221, 222, 223, 224,
-225, 226, 227, 228, 229, 230, 231, 232,
-233, 234, 235, 236, 237, 238, 239, 240,
-241, 242, 243, 244, 245, 246, 95, 248,
-249, 250, 251, 252, 253, 254, 255};
-
-const unsigned char translate_name_map[256] = {
-95, 95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 45, 95, 95, 48,
-49, 50, 51, 52, 53, 54, 55, 56,
-57, 95, 95, 95, 95, 95, 95, 95,
-65, 66, 67, 68, 69, 70, 71, 72,
-73, 74, 75, 76, 77, 78, 79, 80,
-81, 82, 83, 84, 85, 86, 87, 88,
-89, 90, 95, 95, 95, 95, 95, 95,
-97, 98, 99, 100, 101, 102, 103, 104,
-105, 106, 107, 108, 109, 110, 111, 112,
-113, 114, 115, 116, 117, 118, 119, 120,
-121, 122, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 95, 95,
-95, 95, 95, 95, 95, 95, 183, 95,
-95, 95, 95, 95, 95, 95, 95, 192,
-193, 194, 195, 196, 197, 198, 199, 200,
-201, 202, 203, 204, 205, 206, 207, 208,
-209, 210, 211, 212, 213, 214, 95, 216,
-217, 218, 219, 220, 221, 222, 223, 224,
-225, 226, 227, 228, 229, 230, 231, 232,
-233, 234, 235, 236, 237, 238, 239, 240,
-241, 242, 243, 244, 245, 246, 95, 248,
-249, 250, 251, 252, 253, 254, 255};
-
-typedef std::map< std::string, std::vector<std::string> > map_string_list;
-map_string_list global_id_map;
-
-/** Look at documentation of translate_map */
-static std::string translate_id(const std::string &id)
-{
- if (id.size() == 0)
- { return id; }
- std::string id_translated = id;
- id_translated[0] = translate_start_name_map[(unsigned int)id_translated[0]];
- for (unsigned int i=1; i < id_translated.size(); i++)
- {
- id_translated[i] = translate_name_map[(unsigned int)id_translated[i]];
- }
- // It's so much workload now, the if() should speed up things.
- if (id_translated != id)
- {
- // Search duplicates
- map_string_list::iterator iter = global_id_map.find(id_translated);
- if (iter != global_id_map.end())
- {
- unsigned int i = 0;
- bool found = false;
- for (i=0; i < iter->second.size(); i++)
- {
- if (id == iter->second[i])
- {
- found = true;
- break;
- }
- }
- bool convert = false;
- if (found)
- {
- if (i > 0)
- { convert = true; }
- }
- else
- {
- convert = true;
- global_id_map[id_translated].push_back(id);
- }
- if (convert)
- {
- std::stringstream out;
- out << ++i;
- id_translated += out.str();
- }
- }
- else { global_id_map[id_translated].push_back(id); }
- }
- return id_translated;
-}
-
-static std::string id_name(void *id)
-{
- return ((ID*)id)->name + 2;
-}
-
-static std::string get_geometry_id(Object *ob)
-{
- return translate_id(id_name(ob)) + "-mesh";
-}
-
-static std::string get_light_id(Object *ob)
-{
- return translate_id(id_name(ob)) + "-light";
-}
-
-static std::string get_camera_id(Object *ob)
-{
- return translate_id(id_name(ob)) + "-camera";
-}
-
-std::string get_joint_id(Bone *bone, Object *ob_arm)
-{
- return translate_id(id_name(ob_arm) + "_" + bone->name);
-}
-
/*
Utilities to avoid code duplication.
Definition can take some time to understand, but they should be useful.
*/
-// f should have
-// void operator()(Object* ob)
-template<class Functor>
-void forEachMeshObjectInScene(Scene *sce, Functor &f)
-{
-
- Base *base= (Base*) sce->base.first;
- while(base) {
- Object *ob = base->object;
-
- if (ob->type == OB_MESH && ob->data) {
- f(ob);
- }
- base= base->next;
-
- }
-}
template<class Functor>
void forEachObjectInScene(Scene *sce, Functor &f)
@@ -347,1076 +156,7 @@ void forEachObjectInScene(Scene *sce, Functor &f)
}
}
-template<class Functor>
-void forEachCameraObjectInScene(Scene *sce, Functor &f)
-{
- Base *base= (Base*) sce->base.first;
- while(base) {
- Object *ob = base->object;
-
- if (ob->type == OB_CAMERA && ob->data) {
- f(ob, sce);
- }
- base= base->next;
- }
-}
-
-template<class Functor>
-void forEachLampObjectInScene(Scene *sce, Functor &f)
-{
- Base *base= (Base*) sce->base.first;
- while(base) {
- Object *ob = base->object;
-
- if (ob->type == OB_LAMP && ob->data) {
- f(ob);
- }
- base= base->next;
- }
-}
-
-// used in forEachMaterialInScene
-template <class MaterialFunctor>
-class ForEachMaterialFunctor
-{
- std::vector<std::string> mMat; // contains list of material names, to avoid duplicate calling of f
- MaterialFunctor *f;
-public:
- ForEachMaterialFunctor(MaterialFunctor *f) : f(f) { }
- void operator ()(Object *ob)
- {
- int a;
- for(a = 0; a < ob->totcol; a++) {
-
- Material *ma = give_current_material(ob, a+1);
-
- if (!ma) continue;
-
- std::string translated_id = translate_id(id_name(ma));
- if (find(mMat.begin(), mMat.end(), translated_id) == mMat.end()) {
- (*this->f)(ma, ob);
-
- mMat.push_back(translated_id);
- }
- }
- }
-};
-
-// calls f for each unique material linked to each object in sce
-// f should have
-// void operator()(Material* ma)
-template<class Functor>
-void forEachMaterialInScene(Scene *sce, Functor &f)
-{
- ForEachMaterialFunctor<Functor> matfunc(&f);
- forEachMeshObjectInScene(sce, matfunc);
-}
-
-// OB_MESH is assumed
-std::string getActiveUVLayerName(Object *ob)
-{
- Mesh *me = (Mesh*)ob->data;
-
- int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
- if (num_layers)
- return std::string(CustomData_get_active_layer_name(&me->fdata, CD_MTFACE));
-
- return "";
-}
-
-// TODO: optimize UV sets by making indexed list with duplicates removed
-class GeometryExporter : COLLADASW::LibraryGeometries
-{
- struct Face
- {
- unsigned int v1, v2, v3, v4;
- };
-
- struct Normal
- {
- float x, y, z;
- };
-
- Scene *mScene;
-
-public:
- GeometryExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryGeometries(sw) {}
-
- void exportGeom(Scene *sce)
- {
- openLibrary();
-
- mScene = sce;
- forEachMeshObjectInScene(sce, *this);
-
- closeLibrary();
- }
-
- void operator()(Object *ob)
- {
- // XXX don't use DerivedMesh, Mesh instead?
-
-#if 0
- DerivedMesh *dm = mesh_get_derived_final(mScene, ob, CD_MASK_BAREMESH);
-#endif
- Mesh *me = (Mesh*)ob->data;
- std::string geom_id = get_geometry_id(ob);
- std::vector<Normal> nor;
- std::vector<Face> norind;
-
- bool has_color = (bool)CustomData_has_layer(&me->fdata, CD_MCOL);
-
- create_normals(nor, norind, me);
-
- // openMesh(geoId, geoName, meshId)
- openMesh(geom_id);
-
- // writes <source> for vertex coords
- createVertsSource(geom_id, me);
-
- // writes <source> for normal coords
- createNormalsSource(geom_id, me, nor);
-
- bool has_uvs = (bool)CustomData_has_layer(&me->fdata, CD_MTFACE);
-
- // writes <source> for uv coords if mesh has uv coords
- if (has_uvs)
- createTexcoordsSource(geom_id, me);
-
- if (has_color)
- createVertexColorSource(geom_id, me);
-
- // <vertices>
- COLLADASW::Vertices verts(mSW);
- verts.setId(getIdBySemantics(geom_id, COLLADASW::VERTEX));
- COLLADASW::InputList &input_list = verts.getInputList();
- COLLADASW::Input input(COLLADASW::POSITION, getUrlBySemantics(geom_id, COLLADASW::POSITION));
- input_list.push_back(input);
- verts.add();
-
- // XXX slow
- if (ob->totcol) {
- for(int a = 0; a < ob->totcol; a++) {
- createPolylist(a, has_uvs, has_color, ob, geom_id, norind);
- }
- }
- else {
- createPolylist(0, has_uvs, has_color, ob, geom_id, norind);
- }
-
- closeMesh();
- closeGeometry();
-
-#if 0
- dm->release(dm);
-#endif
- }
-
- // powerful because it handles both cases when there is material and when there's not
- void createPolylist(int material_index,
- bool has_uvs,
- bool has_color,
- Object *ob,
- std::string& geom_id,
- std::vector<Face>& norind)
- {
- Mesh *me = (Mesh*)ob->data;
- MFace *mfaces = me->mface;
- int totfaces = me->totface;
-
- // <vcount>
- int i;
- int faces_in_polylist = 0;
- std::vector<unsigned long> vcount_list;
-
- // count faces with this material
- for (i = 0; i < totfaces; i++) {
- MFace *f = &mfaces[i];
-
- if (f->mat_nr == material_index) {
- faces_in_polylist++;
- if (f->v4 == 0) {
- vcount_list.push_back(3);
- }
- else {
- vcount_list.push_back(4);
- }
- }
- }
-
- // no faces using this material
- if (faces_in_polylist == 0) {
- fprintf(stderr, "%s: no faces use material %d\n", id_name(ob).c_str(), material_index);
- return;
- }
-
- Material *ma = ob->totcol ? give_current_material(ob, material_index + 1) : NULL;
- COLLADASW::Polylist polylist(mSW);
-
- // sets count attribute in <polylist>
- polylist.setCount(faces_in_polylist);
-
- // sets material name
- if (ma) {
- polylist.setMaterial(translate_id(id_name(ma)));
- }
-
- COLLADASW::InputList &til = polylist.getInputList();
-
- // creates <input> in <polylist> for vertices
- COLLADASW::Input input1(COLLADASW::VERTEX, getUrlBySemantics(geom_id, COLLADASW::VERTEX), 0);
-
- // creates <input> in <polylist> for normals
- COLLADASW::Input input2(COLLADASW::NORMAL, getUrlBySemantics(geom_id, COLLADASW::NORMAL), 1);
-
- til.push_back(input1);
- til.push_back(input2);
-
- // if mesh has uv coords writes <input> for TEXCOORD
- int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
-
- for (i = 0; i < num_layers; i++) {
- // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
- COLLADASW::Input input3(COLLADASW::TEXCOORD,
- makeUrl(makeTexcoordSourceId(geom_id, i)),
- 2, // offset always 2, this is only until we have optimized UV sets
- i // set number equals UV layer index
- );
- til.push_back(input3);
- }
-
- if (has_color) {
- COLLADASW::Input input4(COLLADASW::COLOR, getUrlBySemantics(geom_id, COLLADASW::COLOR), has_uvs ? 3 : 2);
- til.push_back(input4);
- }
-
- // sets <vcount>
- polylist.setVCountList(vcount_list);
-
- // performs the actual writing
- polylist.prepareToAppendValues();
-
- // <p>
- int texindex = 0;
- for (i = 0; i < totfaces; i++) {
- MFace *f = &mfaces[i];
-
- if (f->mat_nr == material_index) {
-
- unsigned int *v = &f->v1;
- unsigned int *n = &norind[i].v1;
- for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) {
- polylist.appendValues(v[j]);
- polylist.appendValues(n[j]);
-
- if (has_uvs)
- polylist.appendValues(texindex + j);
- if (has_color)
- polylist.appendValues(texindex + j);
- }
- }
-
- texindex += 3;
- if (f->v4 != 0)
- texindex++;
- }
-
- polylist.finish();
- }
-
- // creates <source> for positions
- void createVertsSource(std::string geom_id, Mesh *me)
- {
-#if 0
- int totverts = dm->getNumVerts(dm);
- MVert *verts = dm->getVertArray(dm);
-#endif
- int totverts = me->totvert;
- MVert *verts = me->mvert;
-
- COLLADASW::FloatSourceF source(mSW);
- source.setId(getIdBySemantics(geom_id, COLLADASW::POSITION));
- source.setArrayId(getIdBySemantics(geom_id, COLLADASW::POSITION) +
- ARRAY_ID_SUFFIX);
- source.setAccessorCount(totverts);
- source.setAccessorStride(3);
- COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
- param.push_back("X");
- param.push_back("Y");
- param.push_back("Z");
- /*main function, it creates <source id = "">, <float_array id = ""
- count = ""> */
- source.prepareToAppendValues();
- //appends data to <float_array>
- int i = 0;
- for (i = 0; i < totverts; i++) {
- source.appendValues(verts[i].co[0], verts[i].co[1], verts[i].co[2]);
- }
-
- source.finish();
-
- }
-
- void createVertexColorSource(std::string geom_id, Mesh *me)
- {
- if (!CustomData_has_layer(&me->fdata, CD_MCOL))
- return;
-
- MFace *f;
- int totcolor = 0, i, j;
-
- for (i = 0, f = me->mface; i < me->totface; i++, f++)
- totcolor += f->v4 ? 4 : 3;
-
- COLLADASW::FloatSourceF source(mSW);
- source.setId(getIdBySemantics(geom_id, COLLADASW::COLOR));
- source.setArrayId(getIdBySemantics(geom_id, COLLADASW::COLOR) + ARRAY_ID_SUFFIX);
- source.setAccessorCount(totcolor);
- source.setAccessorStride(3);
-
- COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
- param.push_back("R");
- param.push_back("G");
- param.push_back("B");
-
- source.prepareToAppendValues();
-
- int index = CustomData_get_active_layer_index(&me->fdata, CD_MCOL);
-
- MCol *mcol = (MCol*)me->fdata.layers[index].data;
- MCol *c = mcol;
-
- for (i = 0, f = me->mface; i < me->totface; i++, c += 4, f++)
- for (j = 0; j < (f->v4 ? 4 : 3); j++)
- source.appendValues(c[j].b / 255.0f, c[j].g / 255.0f, c[j].r / 255.0f);
-
- source.finish();
- }
-
- std::string makeTexcoordSourceId(std::string& geom_id, int layer_index)
- {
- char suffix[20];
- sprintf(suffix, "-%d", layer_index);
- return getIdBySemantics(geom_id, COLLADASW::TEXCOORD) + suffix;
- }
-
- //creates <source> for texcoords
- void createTexcoordsSource(std::string geom_id, Mesh *me)
- {
-#if 0
- int totfaces = dm->getNumFaces(dm);
- MFace *mfaces = dm->getFaceArray(dm);
-#endif
- int totfaces = me->totface;
- MFace *mfaces = me->mface;
-
- int totuv = 0;
- int i;
-
- // count totuv
- for (i = 0; i < totfaces; i++) {
- MFace *f = &mfaces[i];
- if (f->v4 == 0) {
- totuv+=3;
- }
- else {
- totuv+=4;
- }
- }
-
- int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
-
- // write <source> for each layer
- // each <source> will get id like meshName + "map-channel-1"
- for (int a = 0; a < num_layers; a++) {
- MTFace *tface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
- // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a);
-
- COLLADASW::FloatSourceF source(mSW);
- std::string layer_id = makeTexcoordSourceId(geom_id, a);
- source.setId(layer_id);
- source.setArrayId(layer_id + ARRAY_ID_SUFFIX);
-
- source.setAccessorCount(totuv);
- source.setAccessorStride(2);
- COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
- param.push_back("S");
- param.push_back("T");
-
- source.prepareToAppendValues();
-
- for (i = 0; i < totfaces; i++) {
- MFace *f = &mfaces[i];
-
- for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) {
- source.appendValues(tface[i].uv[j][0],
- tface[i].uv[j][1]);
- }
- }
-
- source.finish();
- }
- }
-
-
- //creates <source> for normals
- void createNormalsSource(std::string geom_id, Mesh *me, std::vector<Normal>& nor)
- {
-#if 0
- int totverts = dm->getNumVerts(dm);
- MVert *verts = dm->getVertArray(dm);
-#endif
-
- COLLADASW::FloatSourceF source(mSW);
- source.setId(getIdBySemantics(geom_id, COLLADASW::NORMAL));
- source.setArrayId(getIdBySemantics(geom_id, COLLADASW::NORMAL) +
- ARRAY_ID_SUFFIX);
- source.setAccessorCount(nor.size());
- source.setAccessorStride(3);
- COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
- param.push_back("X");
- param.push_back("Y");
- param.push_back("Z");
-
- source.prepareToAppendValues();
-
- std::vector<Normal>::iterator it;
- for (it = nor.begin(); it != nor.end(); it++) {
- Normal& n = *it;
- source.appendValues(n.x, n.y, n.z);
- }
-
- source.finish();
- }
-
- void create_normals(std::vector<Normal> &nor, std::vector<Face> &ind, Mesh *me)
- {
- int i, j, v;
- MVert *vert = me->mvert;
- std::map<unsigned int, unsigned int> nshar;
-
- for (i = 0; i < me->totface; i++) {
- MFace *fa = &me->mface[i];
- Face f;
- unsigned int *nn = &f.v1;
- unsigned int *vv = &fa->v1;
-
- memset(&f, 0, sizeof(f));
- v = fa->v4 == 0 ? 3 : 4;
-
- if (!(fa->flag & ME_SMOOTH)) {
- Normal n;
- if (v == 4)
- normal_quad_v3(&n.x, vert[fa->v1].co, vert[fa->v2].co, vert[fa->v3].co, vert[fa->v4].co);
- else
- normal_tri_v3(&n.x, vert[fa->v1].co, vert[fa->v2].co, vert[fa->v3].co);
- nor.push_back(n);
- }
-
- for (j = 0; j < v; j++) {
- if (fa->flag & ME_SMOOTH) {
- if (nshar.find(*vv) != nshar.end())
- *nn = nshar[*vv];
- else {
- Normal n = {
- vert[*vv].no[0]/32767.0,
- vert[*vv].no[1]/32767.0,
- vert[*vv].no[2]/32767.0
- };
- nor.push_back(n);
- *nn = nor.size() - 1;
- nshar[*vv] = *nn;
- }
- vv++;
- }
- else {
- *nn = nor.size() - 1;
- }
- nn++;
- }
-
- ind.push_back(f);
- }
- }
-
- std::string getIdBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix = "") {
- return geom_id + getSuffixBySemantic(type) + other_suffix;
- }
-
-
- COLLADASW::URI getUrlBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix = "") {
-
- std::string id(getIdBySemantics(geom_id, type, other_suffix));
- return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id);
-
- }
-
- COLLADASW::URI makeUrl(std::string id)
- {
- return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id);
- }
-
-
- /* int getTriCount(MFace *faces, int totface) {
- int i;
- int tris = 0;
- for (i = 0; i < totface; i++) {
- // if quad
- if (faces[i].v4 != 0)
- tris += 2;
- else
- tris++;
- }
-
- return tris;
- }*/
-};
-
-class TransformWriter : protected TransformBase
-{
-protected:
- void add_node_transform(COLLADASW::Node& node, float mat[][4], float parent_mat[][4])
- {
- float loc[3], rot[3], scale[3];
- float local[4][4];
-
- if (parent_mat) {
- float invpar[4][4];
- invert_m4_m4(invpar, parent_mat);
- mul_m4_m4m4(local, mat, invpar);
- }
- else {
- copy_m4_m4(local, mat);
- }
-
- TransformBase::decompose(local, loc, rot, NULL, scale);
-
- add_transform(node, loc, rot, scale);
- }
-
- void add_node_transform_ob(COLLADASW::Node& node, Object *ob)
- {
- float rot[3], loc[3], scale[3];
-
- if (ob->parent) {
- float C[4][4], tmat[4][4], imat[4][4], mat[4][4];
-
- // factor out scale from obmat
-
- copy_v3_v3(scale, ob->size);
-
- ob->size[0] = ob->size[1] = ob->size[2] = 1.0f;
- object_to_mat4(ob, C);
- copy_v3_v3(ob->size, scale);
-
- mul_serie_m4(tmat, ob->parent->obmat, ob->parentinv, C, NULL, NULL, NULL, NULL, NULL);
-
- // calculate local mat
-
- invert_m4_m4(imat, ob->parent->obmat);
- mul_m4_m4m4(mat, tmat, imat);
-
- // done
-
- mat4_to_eul(rot, mat);
- copy_v3_v3(loc, mat[3]);
- }
- else {
- copy_v3_v3(loc, ob->loc);
- copy_v3_v3(rot, ob->rot);
- copy_v3_v3(scale, ob->size);
- }
-
- add_transform(node, loc, rot, scale);
- }
-
- void add_node_transform_identity(COLLADASW::Node& node)
- {
- float loc[] = {0.0f, 0.0f, 0.0f}, scale[] = {1.0f, 1.0f, 1.0f}, rot[] = {0.0f, 0.0f, 0.0f};
- add_transform(node, loc, rot, scale);
- }
-
-private:
- void add_transform(COLLADASW::Node& node, float loc[3], float rot[3], float scale[3])
- {
- node.addTranslate("location", loc[0], loc[1], loc[2]);
- node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2]));
- node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1]));
- node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));
- node.addScale("scale", scale[0], scale[1], scale[2]);
- }
-};
-
-class InstanceWriter
-{
-protected:
- void add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob)
- {
- for(int a = 0; a < ob->totcol; a++) {
- Material *ma = give_current_material(ob, a+1);
-
- COLLADASW::InstanceMaterialList& iml = bind_material.getInstanceMaterialList();
-
- if (ma) {
- std::string matid(id_name(ma));
- matid = translate_id(matid);
- COLLADASW::InstanceMaterial im(matid, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
-
- // create <bind_vertex_input> for each uv layer
- Mesh *me = (Mesh*)ob->data;
- int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
-
- for (int b = 0; b < totlayer; b++) {
- char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, b);
- im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", b));
- }
-
- iml.push_back(im);
- }
- }
- }
-};
-
-// XXX exporter writes wrong data for shared armatures. A separate
-// controller should be written for each armature-mesh binding how do
-// we make controller ids then?
-class ArmatureExporter: public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
-{
-private:
- Scene *scene;
-
-public:
- ArmatureExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryControllers(sw) {}
-
- // write bone nodes
- void add_armature_bones(Object *ob_arm, Scene *sce)
- {
- // write bone nodes
- bArmature *arm = (bArmature*)ob_arm->data;
- for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) {
- // start from root bones
- if (!bone->parent)
- add_bone_node(bone, ob_arm);
- }
- }
-
- bool is_skinned_mesh(Object *ob)
- {
- return get_assigned_armature(ob) != NULL;
- }
-
- void add_instance_controller(Object *ob)
- {
- Object *ob_arm = get_assigned_armature(ob);
- bArmature *arm = (bArmature*)ob_arm->data;
-
- const std::string& controller_id = get_controller_id(ob_arm, ob);
-
- COLLADASW::InstanceController ins(mSW);
- ins.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, controller_id));
-
- // write root bone URLs
- Bone *bone;
- for (bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) {
- if (!bone->parent)
- ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm)));
- }
-
- InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob);
-
- ins.add();
- }
-
- void export_controllers(Scene *sce)
- {
- scene = sce;
-
- openLibrary();
-
- forEachMeshObjectInScene(sce, *this);
-
- closeLibrary();
- }
-
- void operator()(Object *ob)
- {
- Object *ob_arm = get_assigned_armature(ob);
-
- if (ob_arm /*&& !already_written(ob_arm)*/)
- export_controller(ob, ob_arm);
- }
-
-private:
-
- UnitConverter converter;
-
-#if 0
- std::vector<Object*> written_armatures;
-
- bool already_written(Object *ob_arm)
- {
- return std::find(written_armatures.begin(), written_armatures.end(), ob_arm) != written_armatures.end();
- }
-
- void wrote(Object *ob_arm)
- {
- written_armatures.push_back(ob_arm);
- }
-
- void find_objects_using_armature(Object *ob_arm, std::vector<Object *>& objects, Scene *sce)
- {
- objects.clear();
-
- Base *base= (Base*) sce->base.first;
- while(base) {
- Object *ob = base->object;
-
- if (ob->type == OB_MESH && get_assigned_armature(ob) == ob_arm) {
- objects.push_back(ob);
- }
-
- base= base->next;
- }
- }
-#endif
-
- Object *get_assigned_armature(Object *ob)
- {
- Object *ob_arm = NULL;
-
- if (ob->parent && ob->partype == PARSKEL && ob->parent->type == OB_ARMATURE) {
- ob_arm = ob->parent;
- }
- else {
- ModifierData *mod = (ModifierData*)ob->modifiers.first;
- while (mod) {
- if (mod->type == eModifierType_Armature) {
- ob_arm = ((ArmatureModifierData*)mod)->object;
- }
-
- mod = mod->next;
- }
- }
-
- return ob_arm;
- }
-
- std::string get_joint_sid(Bone *bone, Object *ob_arm)
- {
- return get_joint_id(bone, ob_arm);
- }
-
- // parent_mat is armature-space
- void add_bone_node(Bone *bone, Object *ob_arm)
- {
- std::string node_id = get_joint_id(bone, ob_arm);
- std::string node_name = std::string(bone->name);
- std::string node_sid = get_joint_sid(bone, ob_arm);
-
- COLLADASW::Node node(mSW);
-
- node.setType(COLLADASW::Node::JOINT);
- node.setNodeId(node_id);
- node.setNodeName(node_name);
- node.setNodeSid(node_sid);
-
- node.start();
-
- add_bone_transform(ob_arm, bone, node);
-
- for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
- add_bone_node(child, ob_arm);
- }
-
- node.end();
- }
-
- void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node)
- {
- bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
-
- float mat[4][4];
-
- if (bone->parent) {
- // get bone-space matrix from armature-space
- bPoseChannel *parchan = get_pose_channel(ob_arm->pose, bone->parent->name);
-
- float invpar[4][4];
- invert_m4_m4(invpar, parchan->pose_mat);
- mul_m4_m4m4(mat, pchan->pose_mat, invpar);
- }
- else {
- // get world-space from armature-space
- mul_m4_m4m4(mat, pchan->pose_mat, ob_arm->obmat);
- }
-
- TransformWriter::add_node_transform(node, mat, NULL);
- }
-
- std::string get_controller_id(Object *ob_arm, Object *ob)
- {
- return translate_id(id_name(ob_arm)) + "_" + translate_id(id_name(ob)) + SKIN_CONTROLLER_ID_SUFFIX;
- }
-
- // ob should be of type OB_MESH
- // both args are required
- void export_controller(Object* ob, Object *ob_arm)
- {
- // joint names
- // joint inverse bind matrices
- // vertex weights
-
- // input:
- // joint names: ob -> vertex group names
- // vertex group weights: me->dvert -> groups -> index, weight
-
- /*
- me->dvert:
-
- typedef struct MDeformVert {
- struct MDeformWeight *dw;
- int totweight;
- int flag; // flag only in use for weightpaint now
- } MDeformVert;
-
- typedef struct MDeformWeight {
- int def_nr;
- float weight;
- } MDeformWeight;
- */
-
- Mesh *me = (Mesh*)ob->data;
- if (!me->dvert) return;
-
- std::string controller_name = id_name(ob_arm);
- std::string controller_id = get_controller_id(ob_arm, ob);
-
- openSkin(controller_id, controller_name,
- COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob)));
-
- add_bind_shape_mat(ob);
-
- std::string joints_source_id = add_joints_source(ob_arm, &ob->defbase, controller_id);
- std::string inv_bind_mat_source_id = add_inv_bind_mats_source(ob_arm, &ob->defbase, controller_id);
- std::string weights_source_id = add_weights_source(me, controller_id);
-
- add_joints_element(&ob->defbase, joints_source_id, inv_bind_mat_source_id);
- add_vertex_weights_element(weights_source_id, joints_source_id, me, ob_arm, &ob->defbase);
-
- closeSkin();
- closeController();
- }
-
- void add_joints_element(ListBase *defbase,
- const std::string& joints_source_id, const std::string& inv_bind_mat_source_id)
- {
- COLLADASW::JointsElement joints(mSW);
- COLLADASW::InputList &input = joints.getInputList();
-
- input.push_back(COLLADASW::Input(COLLADASW::JOINT, // constant declared in COLLADASWInputList.h
- COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id)));
- input.push_back(COLLADASW::Input(COLLADASW::BINDMATRIX,
- COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, inv_bind_mat_source_id)));
- joints.add();
- }
-
- void add_bind_shape_mat(Object *ob)
- {
- double bind_mat[4][4];
-
- converter.mat4_to_dae_double(bind_mat, ob->obmat);
-
- addBindShapeTransform(bind_mat);
- }
-
- std::string add_joints_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id)
- {
- std::string source_id = controller_id + JOINTS_SOURCE_ID_SUFFIX;
-
- int totjoint = 0;
- bDeformGroup *def;
- for (def = (bDeformGroup*)defbase->first; def; def = def->next) {
- if (is_bone_defgroup(ob_arm, def))
- totjoint++;
- }
-
- COLLADASW::NameSource source(mSW);
- source.setId(source_id);
- source.setArrayId(source_id + ARRAY_ID_SUFFIX);
- source.setAccessorCount(totjoint);
- source.setAccessorStride(1);
-
- COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
- param.push_back("JOINT");
-
- source.prepareToAppendValues();
-
- for (def = (bDeformGroup*)defbase->first; def; def = def->next) {
- Bone *bone = get_bone_from_defgroup(ob_arm, def);
- if (bone)
- source.appendValues(get_joint_sid(bone, ob_arm));
- }
-
- source.finish();
-
- return source_id;
- }
-
- std::string add_inv_bind_mats_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id)
- {
- std::string source_id = controller_id + BIND_POSES_SOURCE_ID_SUFFIX;
-
- COLLADASW::FloatSourceF source(mSW);
- source.setId(source_id);
- source.setArrayId(source_id + ARRAY_ID_SUFFIX);
- source.setAccessorCount(BLI_countlist(defbase));
- source.setAccessorStride(16);
-
- source.setParameterTypeName(&COLLADASW::CSWC::CSW_VALUE_TYPE_FLOAT4x4);
- COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
- param.push_back("TRANSFORM");
-
- source.prepareToAppendValues();
-
- bPose *pose = ob_arm->pose;
- bArmature *arm = (bArmature*)ob_arm->data;
-
- int flag = arm->flag;
-
- // put armature in rest position
- if (!(arm->flag & ARM_RESTPOS)) {
- arm->flag |= ARM_RESTPOS;
- where_is_pose(scene, ob_arm);
- }
-
- for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) {
- if (is_bone_defgroup(ob_arm, def)) {
-
- bPoseChannel *pchan = get_pose_channel(pose, def->name);
-
- float mat[4][4];
- float world[4][4];
- float inv_bind_mat[4][4];
-
- // make world-space matrix, pose_mat is armature-space
- mul_m4_m4m4(world, pchan->pose_mat, ob_arm->obmat);
-
- invert_m4_m4(mat, world);
- converter.mat4_to_dae(inv_bind_mat, mat);
-
- source.appendValues(inv_bind_mat);
- }
- }
-
- // back from rest positon
- if (!(flag & ARM_RESTPOS)) {
- arm->flag = flag;
- where_is_pose(scene, ob_arm);
- }
-
- source.finish();
-
- return source_id;
- }
-
- Bone *get_bone_from_defgroup(Object *ob_arm, bDeformGroup* def)
- {
- bPoseChannel *pchan = get_pose_channel(ob_arm->pose, def->name);
- return pchan ? pchan->bone : NULL;
- }
-
- bool is_bone_defgroup(Object *ob_arm, bDeformGroup* def)
- {
- return get_bone_from_defgroup(ob_arm, def) != NULL;
- }
-
- std::string add_weights_source(Mesh *me, const std::string& controller_id)
- {
- std::string source_id = controller_id + WEIGHTS_SOURCE_ID_SUFFIX;
-
- int i;
- int totweight = 0;
-
- for (i = 0; i < me->totvert; i++) {
- totweight += me->dvert[i].totweight;
- }
-
- COLLADASW::FloatSourceF source(mSW);
- source.setId(source_id);
- source.setArrayId(source_id + ARRAY_ID_SUFFIX);
- source.setAccessorCount(totweight);
- source.setAccessorStride(1);
-
- COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
- param.push_back("WEIGHT");
-
- source.prepareToAppendValues();
-
- // NOTE: COLLADA spec says weights should be normalized
-
- for (i = 0; i < me->totvert; i++) {
- MDeformVert *vert = &me->dvert[i];
- for (int j = 0; j < vert->totweight; j++) {
- source.appendValues(vert->dw[j].weight);
- }
- }
-
- source.finish();
-
- return source_id;
- }
-
- void add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id, Mesh *me,
- Object *ob_arm, ListBase *defbase)
- {
- COLLADASW::VertexWeightsElement weights(mSW);
- COLLADASW::InputList &input = weights.getInputList();
-
- int offset = 0;
- input.push_back(COLLADASW::Input(COLLADASW::JOINT, // constant declared in COLLADASWInputList.h
- COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id), offset++));
- input.push_back(COLLADASW::Input(COLLADASW::WEIGHT,
- COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, weights_source_id), offset++));
-
- weights.setCount(me->totvert);
-
- // write number of deformers per vertex
- COLLADASW::PrimitivesBase::VCountList vcount;
- int i;
- for (i = 0; i < me->totvert; i++) {
- vcount.push_back(me->dvert[i].totweight);
- }
-
- weights.prepareToAppendVCountValues();
- weights.appendVertexCount(vcount);
-
- // def group index -> joint index
- std::map<int, int> joint_index_by_def_index;
- bDeformGroup *def;
- int j;
- for (def = (bDeformGroup*)defbase->first, i = 0, j = 0; def; def = def->next, i++) {
- if (is_bone_defgroup(ob_arm, def))
- joint_index_by_def_index[i] = j++;
- else
- joint_index_by_def_index[i] = -1;
- }
-
- weights.CloseVCountAndOpenVElement();
-
- // write deformer index - weight index pairs
- int weight_index = 0;
- for (i = 0; i < me->totvert; i++) {
- MDeformVert *dvert = &me->dvert[i];
- for (int j = 0; j < dvert->totweight; j++) {
- weights.appendValues(joint_index_by_def_index[dvert->dw[j].def_nr]);
- weights.appendValues(weight_index++);
- }
- }
-
- weights.finish();
- }
-};
class SceneExporter: COLLADASW::LibraryVisualScenes, protected TransformWriter, protected InstanceWriter
{
@@ -1550,453 +290,6 @@ public:
}
};
-class ImagesExporter: COLLADASW::LibraryImages
-{
- const char *mfilename;
- std::vector<std::string> mImages; // contains list of written images, to avoid duplicates
-public:
- ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename) : COLLADASW::LibraryImages(sw), mfilename(filename)
- {}
-
- void exportImages(Scene *sce)
- {
- openLibrary();
-
- forEachMaterialInScene(sce, *this);
-
- closeLibrary();
- }
-
- void operator()(Material *ma, Object *ob)
- {
- int a;
- for (a = 0; a < MAX_MTEX; a++) {
- MTex *mtex = ma->mtex[a];
- if (mtex && mtex->tex && mtex->tex->ima) {
-
- Image *image = mtex->tex->ima;
- std::string name(id_name(image));
- name = translate_id(name);
- char rel[FILE_MAX];
- char abs[FILE_MAX];
- char src[FILE_MAX];
- char dir[FILE_MAX];
-
- BLI_split_dirfile(mfilename, dir, NULL);
-
- BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.sce, image->name, dir);
-
- if (abs[0] != '\0') {
-
- // make absolute source path
- BLI_strncpy(src, image->name, sizeof(src));
- BLI_path_abs(src, G.sce);
-
- // make dest directory if it doesn't exist
- BLI_make_existing_file(abs);
-
- if (BLI_copy_fileops(src, abs) != 0) {
- fprintf(stderr, "Cannot copy image to file's directory. \n");
- }
- }
-
- if (find(mImages.begin(), mImages.end(), name) == mImages.end()) {
- COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(rel)), name);
- img.add(mSW);
-
- mImages.push_back(name);
- }
- }
- }
- }
-};
-
-class EffectsExporter: COLLADASW::LibraryEffects
-{
-public:
- EffectsExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryEffects(sw){}
- void exportEffects(Scene *sce)
- {
- openLibrary();
-
- forEachMaterialInScene(sce, *this);
-
- closeLibrary();
- }
-
- void operator()(Material *ma, Object *ob)
- {
- // create a list of indices to textures of type TEX_IMAGE
- std::vector<int> tex_indices;
- createTextureIndices(ma, tex_indices);
-
- openEffect(translate_id(id_name(ma)) + "-effect");
-
- COLLADASW::EffectProfile ep(mSW);
- ep.setProfileType(COLLADASW::EffectProfile::COMMON);
- ep.openProfile();
- // set shader type - one of three blinn, phong or lambert
- if (ma->spec_shader == MA_SPEC_BLINN) {
- ep.setShaderType(COLLADASW::EffectProfile::BLINN);
- // shininess
- ep.setShininess(ma->har);
- }
- else if (ma->spec_shader == MA_SPEC_PHONG) {
- ep.setShaderType(COLLADASW::EffectProfile::PHONG);
- // shininess
- ep.setShininess(ma->har);
- }
- else {
- // XXX write warning "Current shader type is not supported"
- ep.setShaderType(COLLADASW::EffectProfile::LAMBERT);
- }
- // index of refraction
- if (ma->mode & MA_RAYTRANSP) {
- ep.setIndexOfRefraction(ma->ang);
- }
- else {
- ep.setIndexOfRefraction(1.0f);
- }
-
- COLLADASW::ColorOrTexture cot;
-
- // transparency
- if (ma->mode & MA_TRANSP) {
- // Tod: because we are in A_ONE mode transparency is calculated like this:
- ep.setTransparency(ma->alpha);
- // cot = getcol(1.0f, 1.0f, 1.0f, 1.0f);
- // ep.setTransparent(cot);
- }
-
- // emission
- cot=getcol(ma->emit, ma->emit, ma->emit, 1.0f);
- ep.setEmission(cot);
-
- // diffuse multiplied by diffuse intensity
- cot = getcol(ma->r * ma->ref, ma->g * ma->ref, ma->b * ma->ref, 1.0f);
- ep.setDiffuse(cot);
-
- // ambient
- cot = getcol(ma->ambr, ma->ambg, ma->ambb, 1.0f);
- ep.setAmbient(cot);
-
- // reflective, reflectivity
- if (ma->mode & MA_RAYMIRROR) {
- cot = getcol(ma->mirr, ma->mirg, ma->mirb, 1.0f);
- ep.setReflective(cot);
- ep.setReflectivity(ma->ray_mirror);
- }
- // else {
- // cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
- // ep.setReflective(cot);
- // ep.setReflectivity(ma->spec);
- // }
-
- // specular
- if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) {
- cot = getcol(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f);
- ep.setSpecular(cot);
- }
-
- // XXX make this more readable if possible
-
- // create <sampler> and <surface> for each image
- COLLADASW::Sampler samplers[MAX_MTEX];
- //COLLADASW::Surface surfaces[MAX_MTEX];
- //void *samp_surf[MAX_MTEX][2];
- void *samp_surf[MAX_MTEX][1];
-
- // image to index to samp_surf map
- // samp_surf[index] stores 2 pointers, sampler and surface
- std::map<std::string, int> im_samp_map;
-
- unsigned int a, b;
- for (a = 0, b = 0; a < tex_indices.size(); a++) {
- MTex *t = ma->mtex[tex_indices[a]];
- Image *ima = t->tex->ima;
-
- // Image not set for texture
- if(!ima) continue;
-
- std::string key(id_name(ima));
- key = translate_id(key);
-
- // create only one <sampler>/<surface> pair for each unique image
- if (im_samp_map.find(key) == im_samp_map.end()) {
- // //<newparam> <surface> <init_from>
- // COLLADASW::Surface surface(COLLADASW::Surface::SURFACE_TYPE_2D,
- // key + COLLADASW::Surface::SURFACE_SID_SUFFIX);
- // COLLADASW::SurfaceInitOption sio(COLLADASW::SurfaceInitOption::INIT_FROM);
- // sio.setImageReference(key);
- // surface.setInitOption(sio);
-
- // COLLADASW::NewParamSurface surface(mSW);
- // surface->setParamType(COLLADASW::CSW_SURFACE_TYPE_2D);
-
- //<newparam> <sampler> <source>
- COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D,
- key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX,
- key + COLLADASW::Sampler::SURFACE_SID_SUFFIX);
- sampler.setImageId(key);
- // copy values to arrays since they will live longer
- samplers[a] = sampler;
- //surfaces[a] = surface;
-
- // store pointers so they can be used later when we create <texture>s
- samp_surf[b][0] = &samplers[a];
- //samp_surf[b][1] = &surfaces[a];
-
- im_samp_map[key] = b;
- b++;
- }
- }
-
- // used as fallback when MTex->uvname is "" (this is pretty common)
- // it is indeed the correct value to use in that case
- std::string active_uv(getActiveUVLayerName(ob));
-
- // write textures
- // XXX very slow
- for (a = 0; a < tex_indices.size(); a++) {
- MTex *t = ma->mtex[tex_indices[a]];
- Image *ima = t->tex->ima;
-
- // Image not set for texture
- if(!ima) continue;
-
- // we assume map input is always TEXCO_UV
-
- std::string key(id_name(ima));
- key = translate_id(key);
- int i = im_samp_map[key];
- COLLADASW::Sampler *sampler = (COLLADASW::Sampler*)samp_surf[i][0];
- //COLLADASW::Surface *surface = (COLLADASW::Surface*)samp_surf[i][1];
-
- std::string uvname = strlen(t->uvname) ? t->uvname : active_uv;
-
- // color
- if (t->mapto & MAP_COL) {
- ep.setDiffuse(createTexture(ima, uvname, sampler));
- }
- // ambient
- if (t->mapto & MAP_AMB) {
- ep.setAmbient(createTexture(ima, uvname, sampler));
- }
- // specular
- if (t->mapto & MAP_SPEC) {
- ep.setSpecular(createTexture(ima, uvname, sampler));
- }
- // emission
- if (t->mapto & MAP_EMIT) {
- ep.setEmission(createTexture(ima, uvname, sampler));
- }
- // reflective
- if (t->mapto & MAP_REF) {
- ep.setReflective(createTexture(ima, uvname, sampler));
- }
- // alpha
- if (t->mapto & MAP_ALPHA) {
- ep.setTransparent(createTexture(ima, uvname, sampler));
- }
- // extension:
- // Normal map --> Must be stored with <extra> tag as different technique,
- // since COLLADA doesn't support normal maps, even in current COLLADA 1.5.
- if (t->mapto & MAP_NORM) {
- COLLADASW::Texture texture(key);
- texture.setTexcoord(uvname);
- texture.setSampler(*sampler);
- // technique FCOLLADA, with the <bump> tag, is most likely the best understood,
- // most widespread de-facto standard.
- texture.setProfileName("FCOLLADA");
- texture.setChildElementName("bump");
- ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
- }
- }
- // performs the actual writing
- ep.addProfileElements();
- bool twoSided = false;
- if (ob->type == OB_MESH && ob->data) {
- Mesh *me = (Mesh*)ob->data;
- if (me->flag & ME_TWOSIDED)
- twoSided = true;
- }
- if (twoSided)
- ep.addExtraTechniqueParameter("GOOGLEEARTH", "show_double_sided", 1);
- ep.addExtraTechniques(mSW);
-
- ep.closeProfile();
- if (twoSided)
- mSW->appendTextBlock("<extra><technique profile=\"MAX3D\"><double_sided>1</double_sided></technique></extra>");
- closeEffect();
- }
-
- COLLADASW::ColorOrTexture createTexture(Image *ima,
- std::string& uv_layer_name,
- COLLADASW::Sampler *sampler
- /*COLLADASW::Surface *surface*/)
- {
-
- COLLADASW::Texture texture(translate_id(id_name(ima)));
- texture.setTexcoord(uv_layer_name);
- //texture.setSurface(*surface);
- texture.setSampler(*sampler);
-
- COLLADASW::ColorOrTexture cot(texture);
- return cot;
- }
-
- COLLADASW::ColorOrTexture getcol(float r, float g, float b, float a)
- {
- COLLADASW::Color color(r,g,b,a);
- COLLADASW::ColorOrTexture cot(color);
- return cot;
- }
-
- //returns the array of mtex indices which have image
- //need this for exporting textures
- void createTextureIndices(Material *ma, std::vector<int> &indices)
- {
- indices.clear();
-
- 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);
- }
- }
- }
-};
-
-class MaterialsExporter: COLLADASW::LibraryMaterials
-{
-public:
- MaterialsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryMaterials(sw){}
- void exportMaterials(Scene *sce)
- {
- openLibrary();
-
- forEachMaterialInScene(sce, *this);
-
- closeLibrary();
- }
-
- void operator()(Material *ma, Object *ob)
- {
- std::string name(id_name(ma));
-
- openMaterial(translate_id(name), name);
-
- std::string efid = translate_id(name) + "-effect";
- addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid));
-
- closeMaterial();
- }
-};
-
-class CamerasExporter: COLLADASW::LibraryCameras
-{
-public:
- CamerasExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryCameras(sw){}
- void exportCameras(Scene *sce)
- {
- openLibrary();
-
- forEachCameraObjectInScene(sce, *this);
-
- closeLibrary();
- }
- void operator()(Object *ob, Scene *sce)
- {
- // TODO: shiftx, shifty, YF_dofdist
- Camera *cam = (Camera*)ob->data;
- std::string cam_id(get_camera_id(ob));
- std::string cam_name(id_name(cam));
-
- if (cam->type == CAM_PERSP) {
- COLLADASW::PerspectiveOptic persp(mSW);
- persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI));
- persp.setAspectRatio(1.0);
- persp.setZFar(cam->clipend);
- persp.setZNear(cam->clipsta);
- COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
- addCamera(ccam);
- }
- else {
- COLLADASW::OrthographicOptic ortho(mSW);
- ortho.setXMag(cam->ortho_scale);
- ortho.setAspectRatio(1.0);
- ortho.setZFar(cam->clipend);
- ortho.setZNear(cam->clipsta);
- COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
- addCamera(ccam);
- }
- }
-};
-
-class LightsExporter: COLLADASW::LibraryLights
-{
-public:
- LightsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryLights(sw){}
- void exportLights(Scene *sce)
- {
- openLibrary();
-
- forEachLampObjectInScene(sce, *this);
-
- closeLibrary();
- }
- void operator()(Object *ob)
- {
- Lamp *la = (Lamp*)ob->data;
- std::string la_id(get_light_id(ob));
- std::string la_name(id_name(la));
- COLLADASW::Color col(la->r, la->g, la->b);
- float e = la->energy;
-
- // sun
- if (la->type == LA_SUN) {
- COLLADASW::DirectionalLight cla(mSW, la_id, la_name, e);
- cla.setColor(col);
- addLight(cla);
- }
- // hemi
- else if (la->type == LA_HEMI) {
- COLLADASW::AmbientLight cla(mSW, la_id, la_name, e);
- cla.setColor(col);
- addLight(cla);
- }
- // spot
- else if (la->type == LA_SPOT) {
- COLLADASW::SpotLight cla(mSW, la_id, la_name, e);
- cla.setColor(col);
- cla.setFallOffAngle(la->spotsize);
- cla.setFallOffExponent(la->spotblend);
- cla.setLinearAttenuation(la->att1);
- cla.setQuadraticAttenuation(la->att2);
- addLight(cla);
- }
- // lamp
- else if (la->type == LA_LOCAL) {
- COLLADASW::PointLight cla(mSW, la_id, la_name, e);
- cla.setColor(col);
- cla.setLinearAttenuation(la->att1);
- cla.setQuadraticAttenuation(la->att2);
- addLight(cla);
- }
- // area lamp is not supported
- // it will be exported as a local lamp
- else {
- COLLADASW::PointLight cla(mSW, la_id, la_name, e);
- cla.setColor(col);
- cla.setLinearAttenuation(la->att1);
- cla.setQuadraticAttenuation(la->att2);
- addLight(cla);
- }
- }
-};
-
// TODO: it would be better to instantiate animations rather than create a new one per object
// COLLADA allows this through multiple <channel>s in <animation>.
// For this to work, we need to know objects that use a certain action.
@@ -2580,8 +873,8 @@ protected:
find_frames(ob, fra, prefix, "rotation_euler");
else if (rotmode == ROT_MODE_QUAT)
find_frames(ob, fra, prefix, "rotation_quaternion");
- else if (rotmode == ROT_MODE_AXISANGLE)
- ;
+ /*else if (rotmode == ROT_MODE_AXISANGLE)
+ ;*/
}
// enable fcurves driving a specific bone, disable all the rest
@@ -2610,19 +903,66 @@ protected:
void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename)
{
- global_id_map.clear();
+ PointerRNA sceneptr, unit_settings;
+ PropertyRNA *system, *scale;
+ clear_global_id_map();
+
COLLADABU::NativeString native_filename =
COLLADABU::NativeString(std::string(filename));
COLLADASW::StreamWriter sw(native_filename);
- // open <Collada>
+ // open <collada>
sw.startDocument();
// <asset>
COLLADASW::Asset asset(&sw);
- // XXX ask blender devs about this?
- asset.setUnit("decimetre", 0.1);
+
+ RNA_id_pointer_create(&(sce->id), &sceneptr);
+ unit_settings = RNA_pointer_get(&sceneptr, "unit_settings");
+ system = RNA_struct_find_property(&unit_settings, "system");
+ //scale = RNA_struct_find_property(&unit_settings, "scale_length");
+
+ std::string unitname = "meter";
+ float linearmeasure = 1.0f;
+
+ linearmeasure = RNA_float_get(&unit_settings, "scale_length");
+
+ switch(RNA_property_enum_get(&unit_settings, system)) {
+ case USER_UNIT_NONE:
+ case USER_UNIT_METRIC:
+ if(linearmeasure == 0.001f) {
+ unitname = "millimeter";
+ }
+ else if(linearmeasure == 0.01f) {
+ unitname = "centimeter";
+ }
+ else if(linearmeasure == 0.1f) {
+ unitname = "decimeter";
+ }
+ else if(linearmeasure == 1.0f) {
+ unitname = "meter";
+ }
+ else if(linearmeasure == 1000.0f) {
+ unitname = "kilometer";
+ }
+ break;
+ case USER_UNIT_IMPERIAL:
+ if(linearmeasure == 0.0254f) {
+ unitname = "inch";
+ }
+ else if(linearmeasure == 0.3048f) {
+ unitname = "foot";
+ }
+ else if(linearmeasure == 0.9144f) {
+ unitname = "yard";
+ }
+ break;
+ default:
+ break;
+ }
+
+ asset.setUnit(unitname, linearmeasure);
asset.setUpAxisType(COLLADASW::Asset::Z_UP);
// TODO: need an Author field in userpref
if(strlen(U.author) > 0) {
diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h
index bb6d400fdf1..4aac393b1ab 100644
--- a/source/blender/collada/DocumentExporter.h
+++ b/source/blender/collada/DocumentExporter.h
@@ -21,6 +21,10 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+#ifndef __DOCUMENTEXPORTER_H__
+#define __DOCUMENTEXPORTER_H__
+
struct Scene;
class DocumentExporter
@@ -29,3 +33,5 @@ class DocumentExporter
void exportCurrentScene(Scene *sce, const char* filename);
void exportScenes(const char* filename);
};
+
+#endif
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 0b50326ad6c..bc5653c8c45 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -25,3210 +25,74 @@
// * name imported objects
// * import object rotation as euler
+#include <string>
+#include <map>
+#include <algorithm> // sort()
+
#include "COLLADAFWRoot.h"
#include "COLLADAFWIWriter.h"
#include "COLLADAFWStableHeaders.h"
-#include "COLLADAFWAnimationCurve.h"
-#include "COLLADAFWAnimationList.h"
#include "COLLADAFWCamera.h"
#include "COLLADAFWColorOrTexture.h"
#include "COLLADAFWEffect.h"
-#include "COLLADAFWFloatOrDoubleArray.h"
-#include "COLLADAFWGeometry.h"
#include "COLLADAFWImage.h"
#include "COLLADAFWIndexList.h"
#include "COLLADAFWInstanceGeometry.h"
#include "COLLADAFWLight.h"
#include "COLLADAFWMaterial.h"
-#include "COLLADAFWMesh.h"
#include "COLLADAFWMeshPrimitiveWithFaceVertexCount.h"
-#include "COLLADAFWNode.h"
#include "COLLADAFWPolygons.h"
#include "COLLADAFWSampler.h"
-#include "COLLADAFWSkinController.h"
-#include "COLLADAFWSkinControllerData.h"
-#include "COLLADAFWTransformation.h"
-#include "COLLADAFWTranslate.h"
-#include "COLLADAFWRotate.h"
-#include "COLLADAFWScale.h"
-#include "COLLADAFWMatrix.h"
#include "COLLADAFWTypes.h"
#include "COLLADAFWVisualScene.h"
-#include "COLLADAFWFileInfo.h"
#include "COLLADAFWArrayPrimitiveType.h"
#include "COLLADAFWLibraryNodes.h"
#include "COLLADASaxFWLLoader.h"
-// TODO move "extern C" into header files
-extern "C"
-{
-#include "ED_keyframing.h"
-#include "ED_armature.h"
-#include "ED_mesh.h" // ED_vgroup_vert_add, ...
-#include "ED_anim_api.h"
-#include "ED_object.h"
-
-#include "WM_types.h"
-#include "WM_api.h"
-
#include "BKE_main.h"
-#include "BKE_customdata.h"
#include "BKE_library.h"
#include "BKE_texture.h"
#include "BKE_fcurve.h"
#include "BKE_depsgraph.h"
#include "BLI_path_util.h"
-#include "BKE_displist.h"
-#include "BLI_math.h"
#include "BKE_scene.h"
-}
-#include "BKE_armature.h"
-#include "BKE_mesh.h"
#include "BKE_global.h"
-#include "BKE_context.h"
#include "BKE_object.h"
-#include "BKE_image.h"
#include "BKE_material.h"
#include "BKE_utildefines.h"
-#include "BKE_action.h"
+#include "BKE_image.h"
-#include "BLI_math.h"
#include "BLI_listbase.h"
+#include "BLI_math.h"
#include "BLI_string.h"
-#include "DNA_lamp_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_anim_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_texture_types.h"
#include "DNA_camera_types.h"
-#include "DNA_object_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_material_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_modifier_types.h"
+#include "DNA_lamp_types.h"
+
+#include "RNA_access.h"
#include "MEM_guardedalloc.h"
#include "DocumentImporter.h"
#include "collada_internal.h"
-#include <string>
-#include <map>
-#include <algorithm> // sort()
-
-#include <math.h>
-#include <float.h>
-
-// #define COLLADA_DEBUG
-
-// creates empties for each imported bone on layer 2, for debugging
-// #define ARMATURE_TEST
-
-char *CustomData_get_layer_name(const struct CustomData *data, int type, int n);
-
-static const char *primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type)
-{
- using namespace COLLADAFW;
-
- switch (type) {
- case MeshPrimitive::LINES:
- return "LINES";
- case MeshPrimitive::LINE_STRIPS:
- return "LINESTRIPS";
- case MeshPrimitive::POLYGONS:
- return "POLYGONS";
- case MeshPrimitive::POLYLIST:
- return "POLYLIST";
- case MeshPrimitive::TRIANGLES:
- return "TRIANGLES";
- case MeshPrimitive::TRIANGLE_FANS:
- return "TRIANGLE_FANS";
- case MeshPrimitive::TRIANGLE_STRIPS:
- return "TRIANGLE_FANS";
- case MeshPrimitive::POINTS:
- return "POINTS";
- case MeshPrimitive::UNDEFINED_PRIMITIVE_TYPE:
- return "UNDEFINED_PRIMITIVE_TYPE";
- }
- return "UNKNOWN";
-}
-
-static const char *geomTypeToStr(COLLADAFW::Geometry::GeometryType type)
-{
- switch (type) {
- case COLLADAFW::Geometry::GEO_TYPE_MESH:
- return "MESH";
- case COLLADAFW::Geometry::GEO_TYPE_SPLINE:
- return "SPLINE";
- case COLLADAFW::Geometry::GEO_TYPE_CONVEX_MESH:
- return "CONVEX_MESH";
- case COLLADAFW::Geometry::GEO_TYPE_UNKNOWN:
- default:
- return "UNKNOWN";
- }
-}
-
-// works for COLLADAFW::Node, COLLADAFW::Geometry
-template<class T>
-static const char *get_dae_name(T *node)
-{
- const std::string& name = node->getName();
- return name.size() ? name.c_str() : node->getOriginalId().c_str();
-}
-
-// use this for retrieving bone names, since these must be unique
-template<class T>
-static const char *get_joint_name(T *node)
-{
- const std::string& id = node->getOriginalId();
- return id.size() ? id.c_str() : node->getName().c_str();
-}
-
-static float get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index)
-{
- if (index >= array.getValuesCount())
- return 0.0f;
-
- if (array.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT)
- return array.getFloatValues()->getData()[index];
- else
- return array.getDoubleValues()->getData()[index];
-}
-
-// copied from /editors/object/object_relations.c
-static int test_parent_loop(Object *par, Object *ob)
-{
- /* test if 'ob' is a parent somewhere in par's parents */
-
- if(par == NULL) return 0;
- if(ob == par) return 1;
-
- return test_parent_loop(par->parent, ob);
-}
-
-// a shortened version of parent_set_exec()
-// if is_parent_space is true then ob->obmat will be multiplied by par->obmat before parenting
-static int set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space=true)
-{
- if (!par || test_parent_loop(par, ob))
- return false;
-
- Object workob;
- Main *bmain = CTX_data_main(C);
- Scene *sce = CTX_data_scene(C);
-
- ob->parent = par;
- ob->partype = PAROBJECT;
-
- ob->parsubstr[0] = 0;
-
- if (is_parent_space) {
- // calc par->obmat
- where_is_object(sce, par);
-
- // move child obmat into world space
- float mat[4][4];
- mul_m4_m4m4(mat, ob->obmat, par->obmat);
- copy_m4_m4(ob->obmat, mat);
- }
-
- // apply child obmat (i.e. decompose it into rot/loc/size)
- object_apply_mat4(ob, ob->obmat);
-
- // compute parentinv
- what_does_parent(sce, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
-
- ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
- par->recalc |= OB_RECALC_OB;
-
- DAG_scene_sort(bmain, sce);
- DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
-
- return true;
-}
-
-typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex*> > TexIndexTextureArrayMap;
-
-class TransformReader : public TransformBase
-{
-protected:
-
- UnitConverter *unit_converter;
-
- struct Animation {
- Object *ob;
- COLLADAFW::Node *node;
- COLLADAFW::Transformation *tm; // which transform is animated by an AnimationList->id
- };
-
-public:
-
- TransformReader(UnitConverter* conv) : unit_converter(conv) {}
-
- void get_node_mat(float mat[][4], COLLADAFW::Node *node, std::map<COLLADAFW::UniqueId, Animation> *animation_map,
- Object *ob)
- {
- float cur[4][4];
- float copy[4][4];
-
- unit_m4(mat);
-
- for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) {
-
- COLLADAFW::Transformation *tm = node->getTransformations()[i];
- COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
-
- switch(type) {
- case COLLADAFW::Transformation::TRANSLATE:
- dae_translate_to_mat4(tm, cur);
- break;
- case COLLADAFW::Transformation::ROTATE:
- dae_rotate_to_mat4(tm, cur);
- break;
- case COLLADAFW::Transformation::SCALE:
- dae_scale_to_mat4(tm, cur);
- break;
- case COLLADAFW::Transformation::MATRIX:
- dae_matrix_to_mat4(tm, cur);
- break;
- case COLLADAFW::Transformation::LOOKAT:
- case COLLADAFW::Transformation::SKEW:
- fprintf(stderr, "LOOKAT and SKEW transformations are not supported yet.\n");
- break;
- }
-
- copy_m4_m4(copy, mat);
- mul_m4_m4m4(mat, cur, copy);
-
- if (animation_map) {
- // AnimationList that drives this Transformation
- const COLLADAFW::UniqueId& anim_list_id = tm->getAnimationList();
-
- // store this so later we can link animation data with ob
- Animation anim = {ob, node, tm};
- (*animation_map)[anim_list_id] = anim;
- }
- }
- }
-
- void dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[][4])
- {
- COLLADAFW::Rotate *ro = (COLLADAFW::Rotate*)tm;
- COLLADABU::Math::Vector3& axis = ro->getRotationAxis();
- float angle = (float)(ro->getRotationAngle() * M_PI / 180.0f);
- float ax[] = {axis[0], axis[1], axis[2]};
- // float quat[4];
- // axis_angle_to_quat(quat, axis, angle);
- // quat_to_mat4(m, quat);
- axis_angle_to_mat4(m, ax, angle);
- }
-
- void dae_translate_to_mat4(COLLADAFW::Transformation *tm, float m[][4])
- {
- COLLADAFW::Translate *tra = (COLLADAFW::Translate*)tm;
- COLLADABU::Math::Vector3& t = tra->getTranslation();
-
- unit_m4(m);
-
- m[3][0] = (float)t[0];
- m[3][1] = (float)t[1];
- m[3][2] = (float)t[2];
- }
-
- void dae_scale_to_mat4(COLLADAFW::Transformation *tm, float m[][4])
- {
- COLLADABU::Math::Vector3& s = ((COLLADAFW::Scale*)tm)->getScale();
- float size[3] = {(float)s[0], (float)s[1], (float)s[2]};
- size_to_mat4(m, size);
- }
-
- void dae_matrix_to_mat4(COLLADAFW::Transformation *tm, float m[][4])
- {
- unit_converter->dae_matrix_to_mat4(m, ((COLLADAFW::Matrix*)tm)->getMatrix());
- }
-
- void dae_translate_to_v3(COLLADAFW::Transformation *tm, float v[3])
- {
- dae_vector3_to_v3(((COLLADAFW::Translate*)tm)->getTranslation(), v);
- }
-
- void dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3])
- {
- dae_vector3_to_v3(((COLLADAFW::Scale*)tm)->getScale(), v);
- }
-
- void dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3])
- {
- v[0] = v3.x;
- v[1] = v3.y;
- v[2] = v3.z;
- }
-};
-
-// only for ArmatureImporter to "see" MeshImporter::get_object_by_geom_uid
-class MeshImporterBase
-{
-public:
- virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) = 0;
-};
-
-// ditto as above
-class AnimationImporterBase
-{
-public:
- // virtual void change_eul_to_quat(Object *ob, bAction *act) = 0;
-};
-
-class ArmatureImporter : private TransformReader
-{
-private:
- Scene *scene;
- UnitConverter *unit_converter;
-
- // std::map<int, JointData> joint_index_to_joint_info_map;
- // std::map<COLLADAFW::UniqueId, int> joint_id_to_joint_index_map;
-
- struct LeafBone {
- // COLLADAFW::Node *node;
- EditBone *bone;
- char name[32];
- float mat[4][4]; // bone matrix, derived from inv_bind_mat
- };
- std::vector<LeafBone> leaf_bones;
- // int bone_direction_row; // XXX not used
- float leaf_bone_length;
- int totbone;
- // XXX not used
- // float min_angle; // minimum angle between bone head-tail and a row of bone matrix
-
-#if 0
- struct ArmatureJoints {
- Object *ob_arm;
- std::vector<COLLADAFW::Node*> root_joints;
- };
- std::vector<ArmatureJoints> armature_joints;
-#endif
-
- Object *empty; // empty for leaf bones
-
- std::map<COLLADAFW::UniqueId, COLLADAFW::UniqueId> geom_uid_by_controller_uid;
- std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> joint_by_uid; // contains all joints
- std::vector<COLLADAFW::Node*> root_joints;
- std::map<COLLADAFW::UniqueId, Object*> joint_parent_map;
-
- MeshImporterBase *mesh_importer;
- AnimationImporterBase *anim_importer;
-
- // This is used to store data passed in write_controller_data.
- // Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members
- // so that arrays don't get freed until we free them explicitly.
- class SkinInfo
- {
- private:
- // to build armature bones from inverse bind matrices
- struct JointData {
- float inv_bind_mat[4][4]; // joint inverse bind matrix
- COLLADAFW::UniqueId joint_uid; // joint node UID
- // Object *ob_arm; // armature object
- };
-
- float bind_shape_matrix[4][4];
-
- // data from COLLADAFW::SkinControllerData, each array should be freed
- COLLADAFW::UIntValuesArray joints_per_vertex;
- COLLADAFW::UIntValuesArray weight_indices;
- COLLADAFW::IntValuesArray joint_indices;
- // COLLADAFW::FloatOrDoubleArray weights;
- std::vector<float> weights;
-
- std::vector<JointData> joint_data; // index to this vector is joint index
-
- UnitConverter *unit_converter;
-
- Object *ob_arm;
- COLLADAFW::UniqueId controller_uid;
- Object *parent;
-
- public:
-
- SkinInfo() {}
-
- SkinInfo(const SkinInfo& skin) : weights(skin.weights),
- joint_data(skin.joint_data),
- unit_converter(skin.unit_converter),
- ob_arm(skin.ob_arm),
- controller_uid(skin.controller_uid),
- parent(skin.parent)
- {
- copy_m4_m4(bind_shape_matrix, (float (*)[4])skin.bind_shape_matrix);
-
- transfer_uint_array_data_const(skin.joints_per_vertex, joints_per_vertex);
- transfer_uint_array_data_const(skin.weight_indices, weight_indices);
- transfer_int_array_data_const(skin.joint_indices, joint_indices);
- }
-
- SkinInfo(UnitConverter *conv) : unit_converter(conv), ob_arm(NULL), parent(NULL) {}
-
- // nobody owns the data after this, so it should be freed manually with releaseMemory
- template <class T>
- void transfer_array_data(T& src, T& dest)
- {
- dest.setData(src.getData(), src.getCount());
- src.yieldOwnerShip();
- dest.yieldOwnerShip();
- }
-
- // when src is const we cannot src.yieldOwnerShip, this is used by copy constructor
- void transfer_int_array_data_const(const COLLADAFW::IntValuesArray& src, COLLADAFW::IntValuesArray& dest)
- {
- dest.setData((int*)src.getData(), src.getCount());
- dest.yieldOwnerShip();
- }
-
- void transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray& src, COLLADAFW::UIntValuesArray& dest)
- {
- dest.setData((unsigned int*)src.getData(), src.getCount());
- dest.yieldOwnerShip();
- }
-
- void borrow_skin_controller_data(const COLLADAFW::SkinControllerData* skin)
- {
- transfer_array_data((COLLADAFW::UIntValuesArray&)skin->getJointsPerVertex(), joints_per_vertex);
- transfer_array_data((COLLADAFW::UIntValuesArray&)skin->getWeightIndices(), weight_indices);
- transfer_array_data((COLLADAFW::IntValuesArray&)skin->getJointIndices(), joint_indices);
- // transfer_array_data(skin->getWeights(), weights);
-
- // cannot transfer data for FloatOrDoubleArray, copy values manually
- const COLLADAFW::FloatOrDoubleArray& weight = skin->getWeights();
- for (unsigned int i = 0; i < weight.getValuesCount(); i++)
- weights.push_back(get_float_value(weight, i));
-
- unit_converter->dae_matrix_to_mat4(bind_shape_matrix, skin->getBindShapeMatrix());
- }
-
- void free()
- {
- joints_per_vertex.releaseMemory();
- weight_indices.releaseMemory();
- joint_indices.releaseMemory();
- // weights.releaseMemory();
- }
-
- // using inverse bind matrices to construct armature
- // it is safe to invert them to get the original matrices
- // because if they are inverse matrices, they can be inverted
- void add_joint(const COLLADABU::Math::Matrix4& matrix)
- {
- JointData jd;
- unit_converter->dae_matrix_to_mat4(jd.inv_bind_mat, matrix);
- joint_data.push_back(jd);
- }
-
- void set_controller(const COLLADAFW::SkinController* co)
- {
- controller_uid = co->getUniqueId();
-
- // fill in joint UIDs
- const COLLADAFW::UniqueIdArray& joint_uids = co->getJoints();
- for (unsigned int i = 0; i < joint_uids.getCount(); i++) {
- joint_data[i].joint_uid = joint_uids[i];
-
- // // store armature pointer
- // JointData& jd = joint_index_to_joint_info_map[i];
- // jd.ob_arm = ob_arm;
-
- // now we'll be able to get inv bind matrix from joint id
- // joint_id_to_joint_index_map[joint_ids[i]] = i;
- }
- }
-
- // called from write_controller
- Object *create_armature(Scene *scene)
- {
- ob_arm = add_object(scene, OB_ARMATURE);
- return ob_arm;
- }
-
- Object* set_armature(Object *ob_arm)
- {
- if (this->ob_arm)
- return this->ob_arm;
-
- this->ob_arm = ob_arm;
- return ob_arm;
- }
-
- bool get_joint_inv_bind_matrix(float inv_bind_mat[][4], COLLADAFW::Node *node)
- {
- const COLLADAFW::UniqueId& uid = node->getUniqueId();
- std::vector<JointData>::iterator it;
- for (it = joint_data.begin(); it != joint_data.end(); it++) {
- if ((*it).joint_uid == uid) {
- copy_m4_m4(inv_bind_mat, (*it).inv_bind_mat);
- return true;
- }
- }
-
- return false;
- }
-
- Object *get_armature()
- {
- return ob_arm;
- }
-
- const COLLADAFW::UniqueId& get_controller_uid()
- {
- return controller_uid;
- }
-
- // check if this skin controller references a joint or any descendant of it
- //
- // some nodes may not be referenced by SkinController,
- // in this case to determine if the node belongs to this armature,
- // we need to search down the tree
- bool uses_joint_or_descendant(COLLADAFW::Node *node)
- {
- const COLLADAFW::UniqueId& uid = node->getUniqueId();
- std::vector<JointData>::iterator it;
- for (it = joint_data.begin(); it != joint_data.end(); it++) {
- if ((*it).joint_uid == uid)
- return true;
- }
-
- COLLADAFW::NodePointerArray& children = node->getChildNodes();
- for (unsigned int i = 0; i < children.getCount(); i++) {
- if (uses_joint_or_descendant(children[i]))
- return true;
- }
-
- return false;
- }
-
- void link_armature(bContext *C, Object *ob, std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid,
- TransformReader *tm)
- {
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
-
- ModifierData *md = ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Armature);
- ((ArmatureModifierData *)md)->object = ob_arm;
-
- copy_m4_m4(ob->obmat, bind_shape_matrix);
- object_apply_mat4(ob, ob->obmat);
-#if 1
- ::set_parent(ob, ob_arm, C);
-#else
- Object workob;
- ob->parent = ob_arm;
- ob->partype = PAROBJECT;
-
- what_does_parent(scene, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
-
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
-
- DAG_scene_sort(bmain, scene);
- DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
-#endif
-
- ((bArmature*)ob_arm->data)->deformflag = ARM_DEF_VGROUP;
-
- // create all vertex groups
- std::vector<JointData>::iterator it;
- int joint_index;
- for (it = joint_data.begin(), joint_index = 0; it != joint_data.end(); it++, joint_index++) {
- const char *name = "Group";
-
- // name group by joint node name
- if (joint_by_uid.find((*it).joint_uid) != joint_by_uid.end()) {
- name = get_joint_name(joint_by_uid[(*it).joint_uid]);
- }
-
- ED_vgroup_add_name(ob, (char*)name);
- }
-
- // <vcount> - number of joints per vertex - joints_per_vertex
- // <v> - [[bone index, weight index] * joints per vertex] * vertices - weight indices
- // ^ bone index can be -1 meaning weight toward bind shape, how to express this in Blender?
-
- // for each vertex in weight indices
- // for each bone index in vertex
- // add vertex to group at group index
- // treat group index -1 specially
-
- // get def group by index with BLI_findlink
-
- for (unsigned int vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) {
-
- unsigned int limit = weight + joints_per_vertex[vertex];
- for ( ; weight < limit; weight++) {
- int joint = joint_indices[weight], joint_weight = weight_indices[weight];
-
- // -1 means "weight towards the bind shape", we just don't assign it to any group
- if (joint != -1) {
- bDeformGroup *def = (bDeformGroup*)BLI_findlink(&ob->defbase, joint);
-
- ED_vgroup_vert_add(ob, def, vertex, weights[joint_weight], WEIGHT_REPLACE);
- }
- }
- }
- }
-
- bPoseChannel *get_pose_channel_from_node(COLLADAFW::Node *node)
- {
- return get_pose_channel(ob_arm->pose, get_joint_name(node));
- }
-
- void set_parent(Object *_parent)
- {
- parent = _parent;
- }
-
- Object* get_parent()
- {
- return parent;
- }
-
- void find_root_joints(const std::vector<COLLADAFW::Node*> &root_joints,
- std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid,
- std::vector<COLLADAFW::Node*>& result)
- {
- std::vector<COLLADAFW::Node*>::const_iterator it;
- for (it = root_joints.begin(); it != root_joints.end(); it++) {
- COLLADAFW::Node *root = *it;
- std::vector<JointData>::iterator ji;
- for (ji = joint_data.begin(); ji != joint_data.end(); ji++) {
- COLLADAFW::Node *joint = joint_by_uid[(*ji).joint_uid];
- if (find_node_in_tree(joint, root)) {
- if (std::find(result.begin(), result.end(), root) == result.end())
- result.push_back(root);
- }
- }
- }
- }
-
- bool find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root)
- {
- if (node == tree_root)
- return true;
-
- COLLADAFW::NodePointerArray& children = tree_root->getChildNodes();
- for (unsigned int i = 0; i < children.getCount(); i++) {
- if (find_node_in_tree(node, children[i]))
- return true;
- }
-
- return false;
- }
-
- };
-
- std::map<COLLADAFW::UniqueId, SkinInfo> skin_by_data_uid; // data UID = skin controller data UID
-#if 0
- JointData *get_joint_data(COLLADAFW::Node *node)
- {
- const COLLADAFW::UniqueId& joint_id = node->getUniqueId();
-
- if (joint_id_to_joint_index_map.find(joint_id) == joint_id_to_joint_index_map.end()) {
- fprintf(stderr, "Cannot find a joint index by joint id for %s.\n",
- node->getOriginalId().c_str());
- return NULL;
- }
-
- int joint_index = joint_id_to_joint_index_map[joint_id];
-
- return &joint_index_to_joint_info_map[joint_index];
- }
-#endif
-
- void create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBone *parent, int totchild,
- float parent_mat[][4], bArmature *arm)
- {
- float joint_inv_bind_mat[4][4];
-
- // JointData* jd = get_joint_data(node);
-
- float mat[4][4];
-
- if (skin.get_joint_inv_bind_matrix(joint_inv_bind_mat, node)) {
- // get original world-space matrix
- invert_m4_m4(mat, joint_inv_bind_mat);
- }
- // create a bone even if there's no joint data for it (i.e. it has no influence)
- else {
- float obmat[4][4];
-
- // object-space
- get_node_mat(obmat, node, NULL, NULL);
-
- // get world-space
- if (parent)
- mul_m4_m4m4(mat, obmat, parent_mat);
- else
- copy_m4_m4(mat, obmat);
- }
-
- // TODO rename from Node "name" attrs later
- EditBone *bone = ED_armature_edit_bone_add(arm, (char*)get_joint_name(node));
- totbone++;
-
- if (parent) bone->parent = parent;
-
- // set head
- copy_v3_v3(bone->head, mat[3]);
-
- // set tail, don't set it to head because 0-length bones are not allowed
- float vec[3] = {0.0f, 0.5f, 0.0f};
- add_v3_v3v3(bone->tail, bone->head, vec);
-
- // set parent tail
- if (parent && totchild == 1) {
- copy_v3_v3(parent->tail, bone->head);
-
- // not setting BONE_CONNECTED because this would lock child bone location with respect to parent
- // bone->flag |= BONE_CONNECTED;
-
- // XXX increase this to prevent "very" small bones?
- const float epsilon = 0.000001f;
-
- // derive leaf bone length
- float length = len_v3v3(parent->head, parent->tail);
- if ((length < leaf_bone_length || totbone == 0) && length > epsilon) {
- leaf_bone_length = length;
- }
-
- // treat zero-sized bone like a leaf bone
- if (length <= epsilon) {
- add_leaf_bone(parent_mat, parent);
- }
-
- /*
-#if 0
- // and which row in mat is bone direction
- float vec[3];
- sub_v3_v3v3(vec, parent->tail, parent->head);
-#ifdef COLLADA_DEBUG
- print_v3("tail - head", vec);
- print_m4("matrix", parent_mat);
-#endif
- for (int i = 0; i < 3; i++) {
-#ifdef COLLADA_DEBUG
- char *axis_names[] = {"X", "Y", "Z"};
- printf("%s-axis length is %f\n", axis_names[i], len_v3(parent_mat[i]));
-#endif
- float angle = angle_v2v2(vec, parent_mat[i]);
- if (angle < min_angle) {
-#ifdef COLLADA_DEBUG
- print_v3("picking", parent_mat[i]);
- printf("^ %s axis of %s's matrix\n", axis_names[i], get_dae_name(node));
-#endif
- bone_direction_row = i;
- min_angle = angle;
- }
- }
-#endif
- */
- }
-
- COLLADAFW::NodePointerArray& children = node->getChildNodes();
- for (unsigned int i = 0; i < children.getCount(); i++) {
- create_bone(skin, children[i], bone, children.getCount(), mat, arm);
- }
-
- // in second case it's not a leaf bone, but we handle it the same way
- if (!children.getCount() || children.getCount() > 1) {
- add_leaf_bone(mat, bone);
- }
- }
-
- void add_leaf_bone(float mat[][4], EditBone *bone)
- {
- LeafBone leaf;
-
- leaf.bone = bone;
- copy_m4_m4(leaf.mat, mat);
- BLI_strncpy(leaf.name, bone->name, sizeof(leaf.name));
-
- leaf_bones.push_back(leaf);
- }
-
- void fix_leaf_bones()
- {
- // just setting tail for leaf bones here
-
- std::vector<LeafBone>::iterator it;
- for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) {
- LeafBone& leaf = *it;
-
- // pointing up
- float vec[3] = {0.0f, 0.0f, 1.0f};
-
- mul_v3_fl(vec, leaf_bone_length);
-
- copy_v3_v3(leaf.bone->tail, leaf.bone->head);
- add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
- }
- }
-
- void set_leaf_bone_shapes(Object *ob_arm)
- {
- bPose *pose = ob_arm->pose;
-
- std::vector<LeafBone>::iterator it;
- for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) {
- LeafBone& leaf = *it;
-
- bPoseChannel *pchan = get_pose_channel(pose, leaf.name);
- if (pchan) {
- pchan->custom = get_empty_for_leaves();
- }
- else {
- fprintf(stderr, "Cannot find a pose channel for leaf bone %s\n", leaf.name);
- }
- }
- }
-
-#if 0
- void set_euler_rotmode()
- {
- // just set rotmode = ROT_MODE_EUL on pose channel for each joint
-
- std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>::iterator it;
-
- for (it = joint_by_uid.begin(); it != joint_by_uid.end(); it++) {
-
- COLLADAFW::Node *joint = it->second;
-
- std::map<COLLADAFW::UniqueId, SkinInfo>::iterator sit;
-
- for (sit = skin_by_data_uid.begin(); sit != skin_by_data_uid.end(); sit++) {
- SkinInfo& skin = sit->second;
-
- if (skin.uses_joint_or_descendant(joint)) {
- bPoseChannel *pchan = skin.get_pose_channel_from_node(joint);
-
- if (pchan) {
- pchan->rotmode = ROT_MODE_EUL;
- }
- else {
- fprintf(stderr, "Cannot find pose channel for %s.\n", get_joint_name(joint));
- }
-
- break;
- }
- }
- }
- }
-#endif
-
- Object *get_empty_for_leaves()
- {
- if (empty) return empty;
-
- empty = add_object(scene, OB_EMPTY);
- empty->empty_drawtype = OB_EMPTY_SPHERE;
-
- return empty;
- }
-
-#if 0
- Object *find_armature(COLLADAFW::Node *node)
- {
- JointData* jd = get_joint_data(node);
- if (jd) return jd->ob_arm;
-
- COLLADAFW::NodePointerArray& children = node->getChildNodes();
- for (int i = 0; i < children.getCount(); i++) {
- Object *ob_arm = find_armature(children[i]);
- if (ob_arm) return ob_arm;
- }
-
- return NULL;
- }
-
- ArmatureJoints& get_armature_joints(Object *ob_arm)
- {
- // try finding it
- std::vector<ArmatureJoints>::iterator it;
- for (it = armature_joints.begin(); it != armature_joints.end(); it++) {
- if ((*it).ob_arm == ob_arm) return *it;
- }
-
- // not found, create one
- ArmatureJoints aj;
- aj.ob_arm = ob_arm;
- armature_joints.push_back(aj);
-
- return armature_joints.back();
- }
-#endif
-
- void create_armature_bones(SkinInfo& skin)
- {
- // just do like so:
- // - get armature
- // - enter editmode
- // - add edit bones and head/tail properties using matrices and parent-child info
- // - exit edit mode
- // - set a sphere shape to leaf bones
-
- Object *ob_arm = NULL;
-
- /*
- * find if there's another skin sharing at least one bone with this skin
- * if so, use that skin's armature
- */
-
- /*
- Pseudocode:
-
- find_node_in_tree(node, root_joint)
-
- skin::find_root_joints(root_joints):
- std::vector root_joints;
- for each root in root_joints:
- for each joint in joints:
- if find_node_in_tree(joint, root):
- if (std::find(root_joints.begin(), root_joints.end(), root) == root_joints.end())
- root_joints.push_back(root);
-
- for (each skin B with armature) {
- find all root joints for skin B
-
- for each joint X in skin A:
- for each root joint R in skin B:
- if (find_node_in_tree(X, R)) {
- shared = 1;
- goto endloop;
- }
- }
-
- endloop:
- */
-
- SkinInfo *a = &skin;
- Object *shared = NULL;
- std::vector<COLLADAFW::Node*> skin_root_joints;
-
- std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
- for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
- SkinInfo *b = &it->second;
- if (b == a || b->get_armature() == NULL)
- continue;
-
- skin_root_joints.clear();
-
- b->find_root_joints(root_joints, joint_by_uid, skin_root_joints);
-
- std::vector<COLLADAFW::Node*>::iterator ri;
- for (ri = skin_root_joints.begin(); ri != skin_root_joints.end(); ri++) {
- if (a->uses_joint_or_descendant(*ri)) {
- shared = b->get_armature();
- break;
- }
- }
-
- if (shared != NULL)
- break;
- }
-
- if (shared)
- ob_arm = skin.set_armature(shared);
- else
- ob_arm = skin.create_armature(scene);
-
- // enter armature edit mode
- ED_armature_to_edit(ob_arm);
-
- leaf_bones.clear();
- totbone = 0;
- // bone_direction_row = 1; // TODO: don't default to Y but use asset and based on it decide on default row
- leaf_bone_length = 0.1f;
- // min_angle = 360.0f; // minimum angle between bone head-tail and a row of bone matrix
-
- // create bones
- /*
- TODO:
- check if bones have already been created for a given joint
- */
-
- std::vector<COLLADAFW::Node*>::iterator ri;
- for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
- // for shared armature check if bone tree is already created
- if (shared && std::find(skin_root_joints.begin(), skin_root_joints.end(), *ri) != skin_root_joints.end())
- continue;
-
- // since root_joints may contain joints for multiple controllers, we need to filter
- if (skin.uses_joint_or_descendant(*ri)) {
- create_bone(skin, *ri, NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature*)ob_arm->data);
-
- if (joint_parent_map.find((*ri)->getUniqueId()) != joint_parent_map.end() && !skin.get_parent())
- skin.set_parent(joint_parent_map[(*ri)->getUniqueId()]);
- }
- }
-
- fix_leaf_bones();
-
- // exit armature edit mode
- ED_armature_from_edit(ob_arm);
- ED_armature_edit_free(ob_arm);
- DAG_id_flush_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
-
- set_leaf_bone_shapes(ob_arm);
-
- // set_euler_rotmode();
- }
-
-
-public:
-
- ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce) :
- TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh), anim_importer(anim) {}
-
- ~ArmatureImporter()
- {
- // free skin controller data if we forget to do this earlier
- std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
- for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
- it->second.free();
- }
- }
-
- // root - if this joint is the top joint in hierarchy, if a joint
- // is a child of a node (not joint), root should be true since
- // this is where we build armature bones from
- void add_joint(COLLADAFW::Node *node, bool root, Object *parent)
- {
- joint_by_uid[node->getUniqueId()] = node;
- if (root) {
- root_joints.push_back(node);
-
- if (parent)
- joint_parent_map[node->getUniqueId()] = parent;
- }
- }
-
-#if 0
- void add_root_joint(COLLADAFW::Node *node)
- {
- // root_joints.push_back(node);
- Object *ob_arm = find_armature(node);
- if (ob_arm) {
- get_armature_joints(ob_arm).root_joints.push_back(node);
- }
-#ifdef COLLADA_DEBUG
- else {
- fprintf(stderr, "%s cannot be added to armature.\n", get_joint_name(node));
- }
-#endif
- }
-#endif
-
- // here we add bones to armatures, having armatures previously created in write_controller
- void make_armatures(bContext *C)
- {
- std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
- for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
-
- SkinInfo& skin = it->second;
-
- create_armature_bones(skin);
-
- // link armature with a mesh object
- Object *ob = mesh_importer->get_object_by_geom_uid(*get_geometry_uid(skin.get_controller_uid()));
- if (ob)
- skin.link_armature(C, ob, joint_by_uid, this);
- else
- fprintf(stderr, "Cannot find object to link armature with.\n");
-
- // set armature parent if any
- Object *par = skin.get_parent();
- if (par)
- set_parent(skin.get_armature(), par, C, false);
-
- // free memory stolen from SkinControllerData
- skin.free();
- }
- }
-
-#if 0
- // link with meshes, create vertex groups, assign weights
- void link_armature(Object *ob_arm, const COLLADAFW::UniqueId& geom_id, const COLLADAFW::UniqueId& controller_data_id)
- {
- Object *ob = mesh_importer->get_object_by_geom_uid(geom_id);
-
- if (!ob) {
- fprintf(stderr, "Cannot find object by geometry UID.\n");
- return;
- }
-
- if (skin_by_data_uid.find(controller_data_id) == skin_by_data_uid.end()) {
- fprintf(stderr, "Cannot find skin info by controller data UID.\n");
- return;
- }
-
- SkinInfo& skin = skin_by_data_uid[conroller_data_id];
-
- // create vertex groups
- }
-#endif
-
- bool write_skin_controller_data(const COLLADAFW::SkinControllerData* data)
- {
- // at this stage we get vertex influence info that should go into me->verts and ob->defbase
- // there's no info to which object this should be long so we associate it with skin controller data UID
-
- // don't forget to call defgroup_unique_name before we copy
-
- // controller data uid -> [armature] -> joint data,
- // [mesh object]
- //
-
- SkinInfo skin(unit_converter);
- skin.borrow_skin_controller_data(data);
-
- // store join inv bind matrix to use it later in armature construction
- const COLLADAFW::Matrix4Array& inv_bind_mats = data->getInverseBindMatrices();
- for (unsigned int i = 0; i < data->getJointsCount(); i++) {
- skin.add_joint(inv_bind_mats[i]);
- }
-
- skin_by_data_uid[data->getUniqueId()] = skin;
-
- return true;
- }
-
- bool write_controller(const COLLADAFW::Controller* controller)
- {
- // - create and store armature object
-
- const COLLADAFW::UniqueId& skin_id = controller->getUniqueId();
-
- if (controller->getControllerType() == COLLADAFW::Controller::CONTROLLER_TYPE_SKIN) {
- COLLADAFW::SkinController *co = (COLLADAFW::SkinController*)controller;
- // to be able to find geom id by controller id
- geom_uid_by_controller_uid[skin_id] = co->getSource();
-
- const COLLADAFW::UniqueId& data_uid = co->getSkinControllerData();
- if (skin_by_data_uid.find(data_uid) == skin_by_data_uid.end()) {
- fprintf(stderr, "Cannot find skin by controller data UID.\n");
- return true;
- }
-
- skin_by_data_uid[data_uid].set_controller(co);
- }
- // morph controller
- else {
- // shape keys? :)
- fprintf(stderr, "Morph controller is not supported yet.\n");
- }
-
- return true;
- }
-
- COLLADAFW::UniqueId *get_geometry_uid(const COLLADAFW::UniqueId& controller_uid)
- {
- if (geom_uid_by_controller_uid.find(controller_uid) == geom_uid_by_controller_uid.end())
- return NULL;
-
- return &geom_uid_by_controller_uid[controller_uid];
- }
-
- Object *get_armature_for_joint(COLLADAFW::Node *node)
- {
- std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
- for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
- SkinInfo& skin = it->second;
-
- if (skin.uses_joint_or_descendant(node))
- return skin.get_armature();
- }
-
- return NULL;
- }
-
- void get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count)
- {
- BLI_snprintf(joint_path, count, "pose.bones[\"%s\"]", get_joint_name(node));
- }
-
- // gives a world-space mat
- bool get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint)
- {
- std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
- bool found = false;
- for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
- SkinInfo& skin = it->second;
- if ((found = skin.get_joint_inv_bind_matrix(m, joint))) {
- invert_m4(m);
- break;
- }
- }
-
- return found;
- }
-};
-
-class MeshImporter : public MeshImporterBase
-{
-private:
-
- Scene *scene;
- ArmatureImporter *armature_importer;
-
- std::map<COLLADAFW::UniqueId, Mesh*> uid_mesh_map; // geometry unique id-to-mesh map
- std::map<COLLADAFW::UniqueId, Object*> uid_object_map; // geom uid-to-object
- // this structure is used to assign material indices to faces
- // it holds a portion of Mesh faces and corresponds to a DAE primitive list (<triangles>, <polylist>, etc.)
- struct Primitive {
- MFace *mface;
- unsigned int totface;
- };
- typedef std::map<COLLADAFW::MaterialId, std::vector<Primitive> > MaterialIdPrimitiveArrayMap;
- std::map<COLLADAFW::UniqueId, MaterialIdPrimitiveArrayMap> geom_uid_mat_mapping_map; // crazy name!
-
- class UVDataWrapper
- {
- COLLADAFW::MeshVertexData *mVData;
- public:
- UVDataWrapper(COLLADAFW::MeshVertexData& vdata) : mVData(&vdata)
- {}
-
-#ifdef COLLADA_DEBUG
- void print()
- {
- fprintf(stderr, "UVs:\n");
- switch(mVData->getType()) {
- case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
- {
- COLLADAFW::ArrayPrimitiveType<float>* values = mVData->getFloatValues();
- if (values->getCount()) {
- for (int i = 0; i < values->getCount(); i += 2) {
- fprintf(stderr, "%.1f, %.1f\n", (*values)[i], (*values)[i+1]);
- }
- }
- }
- break;
- case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
- {
- COLLADAFW::ArrayPrimitiveType<double>* values = mVData->getDoubleValues();
- if (values->getCount()) {
- for (int i = 0; i < values->getCount(); i += 2) {
- fprintf(stderr, "%.1f, %.1f\n", (float)(*values)[i], (float)(*values)[i+1]);
- }
- }
- }
- break;
- }
- fprintf(stderr, "\n");
- }
-#endif
-
- void getUV(int uv_index[2], float *uv)
- {
- switch(mVData->getType()) {
- case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
- {
- COLLADAFW::ArrayPrimitiveType<float>* values = mVData->getFloatValues();
- if (values->empty()) return;
- uv[0] = (*values)[uv_index[0]];
- uv[1] = (*values)[uv_index[1]];
-
- }
- break;
- case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
- {
- COLLADAFW::ArrayPrimitiveType<double>* values = mVData->getDoubleValues();
- if (values->empty()) return;
- uv[0] = (float)(*values)[uv_index[0]];
- uv[1] = (float)(*values)[uv_index[1]];
-
- }
- break;
- case COLLADAFW::MeshVertexData::DATA_TYPE_UNKNOWN:
- default:
- fprintf(stderr, "MeshImporter.getUV(): unknown data type\n");
- }
- }
- };
-
- void set_face_indices(MFace *mface, unsigned int *indices, bool quad)
- {
- mface->v1 = indices[0];
- mface->v2 = indices[1];
- mface->v3 = indices[2];
- if (quad) mface->v4 = indices[3];
- else mface->v4 = 0;
-#ifdef COLLADA_DEBUG
- // fprintf(stderr, "%u, %u, %u \n", indices[0], indices[1], indices[2]);
-#endif
- }
-
- // not used anymore, test_index_face from blenkernel is better
-#if 0
- // change face indices order so that v4 is not 0
- void rotate_face_indices(MFace *mface) {
- mface->v4 = mface->v1;
- mface->v1 = mface->v2;
- mface->v2 = mface->v3;
- mface->v3 = 0;
- }
-#endif
-
- void set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
- COLLADAFW::IndexList& index_list, unsigned int *tris_indices)
- {
- int uv_indices[4][2];
-
- // per face vertex indices, this means for quad we have 4 indices, not 8
- COLLADAFW::UIntValuesArray& indices = index_list.getIndices();
-
- // make indices into FloatOrDoubleArray
- for (int i = 0; i < 3; i++) {
- int uv_index = indices[tris_indices[i]];
- uv_indices[i][0] = uv_index * 2;
- uv_indices[i][1] = uv_index * 2 + 1;
- }
-
- uvs.getUV(uv_indices[0], mtface->uv[0]);
- uvs.getUV(uv_indices[1], mtface->uv[1]);
- uvs.getUV(uv_indices[2], mtface->uv[2]);
- }
-
- void set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
- COLLADAFW::IndexList& index_list, int index, bool quad)
- {
- int uv_indices[4][2];
-
- // per face vertex indices, this means for quad we have 4 indices, not 8
- COLLADAFW::UIntValuesArray& indices = index_list.getIndices();
-
- // make indices into FloatOrDoubleArray
- for (int i = 0; i < (quad ? 4 : 3); i++) {
- int uv_index = indices[index + i];
- uv_indices[i][0] = uv_index * 2;
- uv_indices[i][1] = uv_index * 2 + 1;
- }
-
- uvs.getUV(uv_indices[0], mtface->uv[0]);
- uvs.getUV(uv_indices[1], mtface->uv[1]);
- uvs.getUV(uv_indices[2], mtface->uv[2]);
-
- if (quad) uvs.getUV(uv_indices[3], mtface->uv[3]);
-
-#ifdef COLLADA_DEBUG
- /*if (quad) {
- fprintf(stderr, "face uv:\n"
- "((%d, %d), (%d, %d), (%d, %d), (%d, %d))\n"
- "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
-
- uv_indices[0][0], uv_indices[0][1],
- uv_indices[1][0], uv_indices[1][1],
- uv_indices[2][0], uv_indices[2][1],
- uv_indices[3][0], uv_indices[3][1],
-
- mtface->uv[0][0], mtface->uv[0][1],
- mtface->uv[1][0], mtface->uv[1][1],
- mtface->uv[2][0], mtface->uv[2][1],
- mtface->uv[3][0], mtface->uv[3][1]);
- }
- else {
- fprintf(stderr, "face uv:\n"
- "((%d, %d), (%d, %d), (%d, %d))\n"
- "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
-
- uv_indices[0][0], uv_indices[0][1],
- uv_indices[1][0], uv_indices[1][1],
- uv_indices[2][0], uv_indices[2][1],
-
- mtface->uv[0][0], mtface->uv[0][1],
- mtface->uv[1][0], mtface->uv[1][1],
- mtface->uv[2][0], mtface->uv[2][1]);
- }*/
-#endif
- }
-
-#ifdef COLLADA_DEBUG
- void print_index_list(COLLADAFW::IndexList& index_list)
- {
- fprintf(stderr, "Index list for \"%s\":\n", index_list.getName().c_str());
- for (int i = 0; i < index_list.getIndicesCount(); i += 2) {
- fprintf(stderr, "%u, %u\n", index_list.getIndex(i), index_list.getIndex(i + 1));
- }
- fprintf(stderr, "\n");
- }
-#endif
-
- bool is_nice_mesh(COLLADAFW::Mesh *mesh)
- {
- COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
-
- const char *name = get_dae_name(mesh);
-
- for (unsigned i = 0; i < prim_arr.getCount(); i++) {
-
- COLLADAFW::MeshPrimitive *mp = prim_arr[i];
- COLLADAFW::MeshPrimitive::PrimitiveType type = mp->getPrimitiveType();
-
- const char *type_str = primTypeToStr(type);
-
- // OpenCollada passes POLYGONS type for <polylist>
- if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) {
-
- COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
- COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray();
-
- for(unsigned int j = 0; j < vca.getCount(); j++){
- int count = vca[j];
- if (count < 3) {
- fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n",
- type_str, name);
- return false;
- }
- }
-
- }
- else if(type != COLLADAFW::MeshPrimitive::TRIANGLES) {
- fprintf(stderr, "Primitive type %s is not supported.\n", type_str);
- return false;
- }
- }
-
- if (mesh->getPositions().empty()) {
- fprintf(stderr, "Mesh %s has no vertices.\n", name);
- return false;
- }
-
- return true;
- }
-
- void read_vertices(COLLADAFW::Mesh *mesh, Mesh *me)
- {
- // vertices
- me->totvert = mesh->getPositions().getFloatValues()->getCount() / 3;
- me->mvert = (MVert*)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
-
- COLLADAFW::MeshVertexData& pos = mesh->getPositions();
- MVert *mvert;
- int i;
-
- for (i = 0, mvert = me->mvert; i < me->totvert; i++, mvert++)
- get_vector(mvert->co, pos, i);
- }
-
- int triangulate_poly(unsigned int *indices, int totvert, MVert *verts, std::vector<unsigned int>& tri)
- {
- ListBase dispbase;
- DispList *dl;
- float *vert;
- int i = 0;
-
- dispbase.first = dispbase.last = NULL;
-
- dl = (DispList*)MEM_callocN(sizeof(DispList), "poly disp");
- dl->nr = totvert;
- dl->type = DL_POLY;
- dl->parts = 1;
- dl->verts = vert = (float*)MEM_callocN(totvert * 3 * sizeof(float), "poly verts");
- dl->index = (int*)MEM_callocN(sizeof(int) * 3 * totvert, "dl index");
-
- BLI_addtail(&dispbase, dl);
-
- for (i = 0; i < totvert; i++) {
- copy_v3_v3(vert, verts[indices[i]].co);
- vert += 3;
- }
-
- filldisplist(&dispbase, &dispbase, 0);
-
- int tottri = 0;
- dl= (DispList*)dispbase.first;
-
- if (dl->type == DL_INDEX3) {
- tottri = dl->parts;
-
- int *index = dl->index;
- for (i= 0; i < tottri; i++) {
- int t[3]= {*index, *(index + 1), *(index + 2)};
-
- std::sort(t, t + 3);
-
- tri.push_back(t[0]);
- tri.push_back(t[1]);
- tri.push_back(t[2]);
-
- index += 3;
- }
- }
-
- freedisplist(&dispbase);
-
- return tottri;
- }
-
- int count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me)
- {
- COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
- unsigned int i;
- int tottri = 0;
-
- for (i = 0; i < prim_arr.getCount(); i++) {
-
- COLLADAFW::MeshPrimitive *mp = prim_arr[i];
- int type = mp->getPrimitiveType();
- size_t prim_totface = mp->getFaceCount();
- unsigned int *indices = mp->getPositionIndices().getData();
-
- if (type == COLLADAFW::MeshPrimitive::POLYLIST ||
- type == COLLADAFW::MeshPrimitive::POLYGONS) {
-
- COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
- COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray();
-
- for (unsigned int j = 0; j < prim_totface; j++) {
- int vcount = vcounta[j];
-
- if (vcount > 4) {
- std::vector<unsigned int> tri;
-
- // tottri += triangulate_poly(indices, vcount, me->mvert, tri) - 1; // XXX why - 1?!
- tottri += triangulate_poly(indices, vcount, me->mvert, tri);
- }
-
- indices += vcount;
- }
- }
- }
- return tottri;
- }
-
- // TODO: import uv set names
- void read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris)
- {
- unsigned int i;
-
- // allocate faces
- me->totface = mesh->getFacesCount() + new_tris;
- me->mface = (MFace*)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
-
- // allocate UV layers
- unsigned int totuvset = mesh->getUVCoords().getInputInfosArray().getCount();
-
- for (i = 0; i < totuvset; i++) {
- if (mesh->getUVCoords().getLength(i) == 0) {
- totuvset = 0;
- break;
- }
- }
-
- for (i = 0; i < totuvset; i++) {
- COLLADAFW::MeshVertexData::InputInfos *info = mesh->getUVCoords().getInputInfosArray()[i];
- CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface, info->mName.c_str());
- //this->set_layername_map[i] = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
- }
-
- // activate the first uv layer
- if (totuvset) me->mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, 0);
-
- UVDataWrapper uvs(mesh->getUVCoords());
-
-#ifdef COLLADA_DEBUG
- // uvs.print();
-#endif
-
- MFace *mface = me->mface;
-
- MaterialIdPrimitiveArrayMap mat_prim_map;
-
- int face_index = 0;
-
- COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
-
- bool has_normals = mesh->hasNormals();
- COLLADAFW::MeshVertexData& nor = mesh->getNormals();
+#include "TransformReader.h"
+#include "AnimationImporter.h"
+#include "ArmatureImporter.h"
+#include "MeshImporter.h"
+#include "collada_utils.h"
- for (i = 0; i < prim_arr.getCount(); i++) {
-
- COLLADAFW::MeshPrimitive *mp = prim_arr[i];
-
- // faces
- size_t prim_totface = mp->getFaceCount();
- unsigned int *indices = mp->getPositionIndices().getData();
- unsigned int *nind = mp->getNormalIndices().getData();
- unsigned int j, k;
- int type = mp->getPrimitiveType();
- int index = 0;
-
- // since we cannot set mface->mat_nr here, we store a portion of me->mface in Primitive
- Primitive prim = {mface, 0};
- COLLADAFW::IndexListArray& index_list_array = mp->getUVCoordIndicesArray();
-
-#ifdef COLLADA_DEBUG
- /*
- fprintf(stderr, "Primitive %d:\n", i);
- for (int j = 0; j < totuvset; j++) {
- print_index_list(*index_list_array[j]);
- }
- */
-#endif
-
- if (type == COLLADAFW::MeshPrimitive::TRIANGLES) {
- for (j = 0; j < prim_totface; j++){
-
- set_face_indices(mface, indices, false);
- indices += 3;
-
-#if 0
- for (k = 0; k < totuvset; k++) {
- if (!index_list_array.empty() && index_list_array[k]) {
- // get mtface by face index and uv set index
- MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
- set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, false);
- }
- }
-#else
- for (k = 0; k < index_list_array.getCount(); k++) {
- int uvset_index = index_list_array[k]->getSetIndex();
-
- // get mtface by face index and uv set index
- MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index);
- set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, false);
- }
-#endif
-
- test_index_face(mface, &me->fdata, face_index, 3);
-
- if (has_normals) {
- if (!flat_face(nind, nor, 3))
- mface->flag |= ME_SMOOTH;
-
- nind += 3;
- }
-
- index += 3;
- mface++;
- face_index++;
- prim.totface++;
- }
- }
- else if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) {
- COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
- COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray();
-
- for (j = 0; j < prim_totface; j++) {
-
- // face
- int vcount = vcounta[j];
- if (vcount == 3 || vcount == 4) {
-
- set_face_indices(mface, indices, vcount == 4);
-
- // set mtface for each uv set
- // it is assumed that all primitives have equal number of UV sets
-
-#if 0
- for (k = 0; k < totuvset; k++) {
- if (!index_list_array.empty() && index_list_array[k]) {
- // get mtface by face index and uv set index
- MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
- set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, mface->v4 != 0);
- }
- }
-#else
- for (k = 0; k < index_list_array.getCount(); k++) {
- int uvset_index = index_list_array[k]->getSetIndex();
-
- // get mtface by face index and uv set index
- MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index);
- set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, mface->v4 != 0);
- }
-#endif
-
- test_index_face(mface, &me->fdata, face_index, vcount);
-
- if (has_normals) {
- if (!flat_face(nind, nor, vcount))
- mface->flag |= ME_SMOOTH;
-
- nind += vcount;
- }
-
- mface++;
- face_index++;
- prim.totface++;
-
- }
- else {
- std::vector<unsigned int> tri;
-
- triangulate_poly(indices, vcount, me->mvert, tri);
-
- for (k = 0; k < tri.size() / 3; k++) {
- int v = k * 3;
- unsigned int uv_indices[3] = {
- index + tri[v],
- index + tri[v + 1],
- index + tri[v + 2]
- };
- unsigned int tri_indices[3] = {
- indices[tri[v]],
- indices[tri[v + 1]],
- indices[tri[v + 2]]
- };
-
- set_face_indices(mface, tri_indices, false);
-
-#if 0
- for (unsigned int l = 0; l < totuvset; l++) {
- if (!index_list_array.empty() && index_list_array[l]) {
- // get mtface by face index and uv set index
- MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, l);
- set_face_uv(&mtface[face_index], uvs, l, *index_list_array[l], uv_indices);
- }
- }
-#else
- for (unsigned int l = 0; l < index_list_array.getCount(); l++) {
- int uvset_index = index_list_array[l]->getSetIndex();
-
- // get mtface by face index and uv set index
- MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index);
- set_face_uv(&mtface[face_index], uvs, *index_list_array[l], uv_indices);
- }
-#endif
-
-
- test_index_face(mface, &me->fdata, face_index, 3);
-
- if (has_normals) {
- unsigned int ntri[3] = {nind[tri[v]], nind[tri[v + 1]], nind[tri[v + 2]]};
-
- if (!flat_face(ntri, nor, 3))
- mface->flag |= ME_SMOOTH;
- }
-
- mface++;
- face_index++;
- prim.totface++;
- }
-
- if (has_normals)
- nind += vcount;
- }
-
- index += vcount;
- indices += vcount;
- }
- }
-
- mat_prim_map[mp->getMaterialId()].push_back(prim);
- }
-
- geom_uid_mat_mapping_map[mesh->getUniqueId()] = mat_prim_map;
- }
-
- void get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i)
- {
- i *= 3;
-
- switch(arr.getType()) {
- case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
- {
- COLLADAFW::ArrayPrimitiveType<float>* values = arr.getFloatValues();
- if (values->empty()) return;
-
- v[0] = (*values)[i++];
- v[1] = (*values)[i++];
- v[2] = (*values)[i];
- }
- break;
- case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
- {
- COLLADAFW::ArrayPrimitiveType<double>* values = arr.getDoubleValues();
- if (values->empty()) return;
-
- v[0] = (float)(*values)[i++];
- v[1] = (float)(*values)[i++];
- v[2] = (float)(*values)[i];
- }
- break;
- default:
- break;
- }
- }
-
- bool flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, int count)
- {
- float a[3], b[3];
-
- get_vector(a, nor, *nind);
- normalize_v3(a);
-
- nind++;
-
- for (int i = 1; i < count; i++, nind++) {
- get_vector(b, nor, *nind);
- normalize_v3(b);
-
- float dp = dot_v3v3(a, b);
-
- if (dp < 0.99999f || dp > 1.00001f)
- return false;
- }
-
- return true;
- }
-
-public:
-
- MeshImporter(ArmatureImporter *arm, Scene *sce) : scene(sce), armature_importer(arm) {}
-
- virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid)
- {
- if (uid_object_map.find(geom_uid) != uid_object_map.end())
- return uid_object_map[geom_uid];
- return NULL;
- }
-
- MTex *assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture,
- Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map,
- MTex *color_texture)
- {
- const COLLADAFW::TextureMapId texture_index = ctexture.getTextureMapId();
- const size_t setindex = ctexture.getSetIndex();
- std::string uvname = ctexture.getName();
-
- const CustomData *data = &me->fdata;
- int layer_index = CustomData_get_layer_index(data, CD_MTFACE);
- CustomDataLayer *cdl = &data->layers[layer_index+setindex];
-
- /* set uvname to bind_vertex_input semantic */
- BLI_strncpy(cdl->name, uvname.c_str(), sizeof(cdl->name));
-
- if (texindex_texarray_map.find(texture_index) == texindex_texarray_map.end()) {
-
- fprintf(stderr, "Cannot find texture array by texture index.\n");
- return color_texture;
- }
-
- std::vector<MTex*> textures = texindex_texarray_map[texture_index];
-
- std::vector<MTex*>::iterator it;
-
- for (it = textures.begin(); it != textures.end(); it++) {
-
- MTex *texture = *it;
-
- if (texture) {
- BLI_strncpy(texture->uvname, uvname.c_str(), sizeof(texture->uvname));
- if (texture->mapto == MAP_COL) color_texture = texture;
- }
- }
- return color_texture;
- }
-
- MTFace *assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial,
- std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
- Object *ob, const COLLADAFW::UniqueId *geom_uid,
- MTex **color_texture, char *layername, MTFace *texture_face,
- std::map<Material*, TexIndexTextureArrayMap>& material_texture_mapping_map, int mat_index)
- {
- Mesh *me = (Mesh*)ob->data;
- const COLLADAFW::UniqueId& ma_uid = cmaterial.getReferencedMaterial();
-
- // do we know this material?
- if (uid_material_map.find(ma_uid) == uid_material_map.end()) {
-
- fprintf(stderr, "Cannot find material by UID.\n");
- return NULL;
- }
-
- Material *ma = uid_material_map[ma_uid];
- assign_material(ob, ma, ob->totcol + 1);
-
- COLLADAFW::TextureCoordinateBindingArray& tex_array =
- cmaterial.getTextureCoordinateBindingArray();
- TexIndexTextureArrayMap texindex_texarray_map = material_texture_mapping_map[ma];
- unsigned int i;
- // loop through <bind_vertex_inputs>
- for (i = 0; i < tex_array.getCount(); i++) {
-
- *color_texture = assign_textures_to_uvlayer(tex_array[i], me, texindex_texarray_map,
- *color_texture);
- }
-
- // set texture face
- if (*color_texture &&
- strlen((*color_texture)->uvname) &&
- strcmp(layername, (*color_texture)->uvname) != 0) {
-
- texture_face = (MTFace*)CustomData_get_layer_named(&me->fdata, CD_MTFACE,
- (*color_texture)->uvname);
- strcpy(layername, (*color_texture)->uvname);
- }
-
- MaterialIdPrimitiveArrayMap& mat_prim_map = geom_uid_mat_mapping_map[*geom_uid];
- COLLADAFW::MaterialId mat_id = cmaterial.getMaterialId();
-
- // assign material indices to mesh faces
- if (mat_prim_map.find(mat_id) != mat_prim_map.end()) {
-
- std::vector<Primitive>& prims = mat_prim_map[mat_id];
-
- std::vector<Primitive>::iterator it;
-
- for (it = prims.begin(); it != prims.end(); it++) {
- Primitive& prim = *it;
- i = 0;
- while (i++ < prim.totface) {
- prim.mface->mat_nr = mat_index;
- prim.mface++;
- // bind texture images to faces
- if (texture_face && (*color_texture)) {
- texture_face->mode = TF_TEX;
- texture_face->tpage = (Image*)(*color_texture)->tex->ima;
- texture_face++;
- }
- }
- }
- }
-
- return texture_face;
- }
-
-
- Object *create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom,
- bool isController,
- std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
- std::map<Material*, TexIndexTextureArrayMap>& material_texture_mapping_map)
- {
- const COLLADAFW::UniqueId *geom_uid = &geom->getInstanciatedObjectId();
-
- // check if node instanciates controller or geometry
- if (isController) {
-
- geom_uid = armature_importer->get_geometry_uid(*geom_uid);
-
- if (!geom_uid) {
- fprintf(stderr, "Couldn't find a mesh UID by controller's UID.\n");
- return NULL;
- }
- }
- else {
-
- if (uid_mesh_map.find(*geom_uid) == uid_mesh_map.end()) {
- // this could happen if a mesh was not created
- // (e.g. if it contains unsupported geometry)
- fprintf(stderr, "Couldn't find a mesh by UID.\n");
- return NULL;
- }
- }
- if (!uid_mesh_map[*geom_uid]) return NULL;
-
- Object *ob = add_object(scene, OB_MESH);
-
- // store object pointer for ArmatureImporter
- uid_object_map[*geom_uid] = ob;
-
- // name Object
- const std::string& id = node->getOriginalId();
- if (id.length())
- rename_id(&ob->id, (char*)id.c_str());
-
- // replace ob->data freeing the old one
- Mesh *old_mesh = (Mesh*)ob->data;
-
- set_mesh(ob, uid_mesh_map[*geom_uid]);
-
- if (old_mesh->id.us == 0) free_libblock(&G.main->mesh, old_mesh);
-
- char layername[100];
- MTFace *texture_face = NULL;
- MTex *color_texture = NULL;
-
- COLLADAFW::MaterialBindingArray& mat_array =
- geom->getMaterialBindings();
-
- // loop through geom's materials
- for (unsigned int i = 0; i < mat_array.getCount(); i++) {
-
- texture_face = assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid,
- &color_texture, layername, texture_face,
- material_texture_mapping_map, i);
- }
-
- return ob;
- }
-
- // create a mesh storing a pointer in a map so it can be retrieved later by geometry UID
- bool write_geometry(const COLLADAFW::Geometry* geom)
- {
- // TODO: import also uvs, normals
- // XXX what to do with normal indices?
- // XXX num_normals may be != num verts, then what to do?
-
- // check geometry->getType() first
- if (geom->getType() != COLLADAFW::Geometry::GEO_TYPE_MESH) {
- // TODO: report warning
- fprintf(stderr, "Mesh type %s is not supported\n", geomTypeToStr(geom->getType()));
- return true;
- }
-
- COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh*)geom;
-
- if (!is_nice_mesh(mesh)) {
- fprintf(stderr, "Ignoring mesh %s\n", get_dae_name(mesh));
- return true;
- }
-
- const std::string& str_geom_id = mesh->getOriginalId();
- Mesh *me = add_mesh((char*)str_geom_id.c_str());
-
- // store the Mesh pointer to link it later with an Object
- this->uid_mesh_map[mesh->getUniqueId()] = me;
-
- int new_tris = 0;
-
- read_vertices(mesh, me);
-
- new_tris = count_new_tris(mesh, me);
-
- read_faces(mesh, me, new_tris);
-
- make_edges(me, 0);
-
- mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
-
- return true;
- }
-
-};
-
-class AnimationImporter : private TransformReader, public AnimationImporterBase
-{
-private:
-
- ArmatureImporter *armature_importer;
- Scene *scene;
-
- std::map<COLLADAFW::UniqueId, std::vector<FCurve*> > curve_map;
- std::map<COLLADAFW::UniqueId, TransformReader::Animation> uid_animated_map;
- // std::map<bActionGroup*, std::vector<FCurve*> > fcurves_actionGroup_map;
- std::map<COLLADAFW::UniqueId, const COLLADAFW::AnimationList*> animlist_map;
- std::vector<FCurve*> unused_curves;
- std::map<COLLADAFW::UniqueId, Object*> joint_objects;
-
- FCurve *create_fcurve(int array_index, const char *rna_path)
- {
- FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve");
-
- fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
- fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
- fcu->array_index = array_index;
- return fcu;
- }
-
- void create_bezt(FCurve *fcu, float frame, float output)
- {
- BezTriple bez;
- memset(&bez, 0, sizeof(BezTriple));
- bez.vec[1][0] = frame;
- bez.vec[1][1] = output;
- bez.ipo = U.ipo_new; /* use default interpolation mode here... */
- bez.f1 = bez.f2 = bez.f3 = SELECT;
- bez.h1 = bez.h2 = HD_AUTO;
- insert_bezt_fcurve(fcu, &bez, 0);
- calchandles_fcurve(fcu);
- }
-
- // create one or several fcurves depending on the number of parameters being animated
- void animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
- {
- COLLADAFW::FloatOrDoubleArray& input = curve->getInputValues();
- COLLADAFW::FloatOrDoubleArray& output = curve->getOutputValues();
- // COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues();
- // COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues();
- float fps = (float)FPS;
- size_t dim = curve->getOutDimension();
- unsigned int i;
-
- std::vector<FCurve*>& fcurves = curve_map[curve->getUniqueId()];
-
- switch (dim) {
- case 1: // X, Y, Z or angle
- case 3: // XYZ
- case 16: // matrix
- {
- for (i = 0; i < dim; i++ ) {
- FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve");
-
- fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
- // fcu->rna_path = BLI_strdupn(path, strlen(path));
- fcu->array_index = 0;
- //fcu->totvert = curve->getKeyCount();
-
- // create beztriple for each key
- for (unsigned int j = 0; j < curve->getKeyCount(); j++) {
- BezTriple bez;
- memset(&bez, 0, sizeof(BezTriple));
-
- // intangent
- // bez.vec[0][0] = get_float_value(intan, j * 6 + i + i) * fps;
- // bez.vec[0][1] = get_float_value(intan, j * 6 + i + i + 1);
-
- // input, output
- bez.vec[1][0] = get_float_value(input, j) * fps;
- bez.vec[1][1] = get_float_value(output, j * dim + i);
-
- // outtangent
- // bez.vec[2][0] = get_float_value(outtan, j * 6 + i + i) * fps;
- // bez.vec[2][1] = get_float_value(outtan, j * 6 + i + i + 1);
-
- bez.ipo = U.ipo_new; /* use default interpolation mode here... */
- bez.f1 = bez.f2 = bez.f3 = SELECT;
- bez.h1 = bez.h2 = HD_AUTO;
- insert_bezt_fcurve(fcu, &bez, 0);
- }
-
- calchandles_fcurve(fcu);
-
- fcurves.push_back(fcu);
- }
- }
- break;
- default:
- fprintf(stderr, "Output dimension of %d is not yet supported (animation id = %s)\n", dim, curve->getOriginalId().c_str());
- }
-
- for (std::vector<FCurve*>::iterator it = fcurves.begin(); it != fcurves.end(); it++)
- unused_curves.push_back(*it);
- }
-
- void fcurve_deg_to_rad(FCurve *cu)
- {
- for (unsigned int i = 0; i < cu->totvert; i++) {
- // TODO convert handles too
- cu->bezt[i].vec[1][1] *= M_PI / 180.0f;
- }
- }
-
- void add_fcurves_to_object(Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated)
- {
- bAction *act;
-
- if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID*)&ob->id, 1);
- else act = ob->adt->action;
-
- std::vector<FCurve*>::iterator it;
- int i;
-
-#if 0
- char *p = strstr(rna_path, "rotation_euler");
- bool is_rotation = p && *(p + strlen("rotation_euler")) == '\0';
-
- // convert degrees to radians for rotation
- if (is_rotation)
- fcurve_deg_to_rad(fcu);
-#endif
-
- for (it = curves.begin(), i = 0; it != curves.end(); it++, i++) {
- FCurve *fcu = *it;
- fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
-
- if (array_index == -1) fcu->array_index = i;
- else fcu->array_index = array_index;
-
- if (ob->type == OB_ARMATURE) {
- bActionGroup *grp = NULL;
- const char *bone_name = get_joint_name(animated->node);
-
- if (bone_name) {
- /* try to find group */
- grp = action_groups_find_named(act, bone_name);
-
- /* no matching groups, so add one */
- if (grp == NULL) {
- /* Add a new group, and make it active */
- grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
-
- grp->flag = AGRP_SELECTED;
- BLI_strncpy(grp->name, bone_name, sizeof(grp->name));
-
- BLI_addtail(&act->groups, grp);
- BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64);
- }
-
- /* add F-Curve to group */
- action_groups_add_channel(act, grp, fcu);
-
- }
-#if 0
- if (is_rotation) {
- fcurves_actionGroup_map[grp].push_back(fcu);
- }
-#endif
- }
- else {
- BLI_addtail(&act->curves, fcu);
- }
-
- // curve is used, so remove it from unused_curves
- unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end());
- }
- }
-public:
-
- AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene) :
- TransformReader(conv), armature_importer(arm), scene(scene) { }
-
- ~AnimationImporter()
- {
- // free unused FCurves
- for (std::vector<FCurve*>::iterator it = unused_curves.begin(); it != unused_curves.end(); it++)
- free_fcurve(*it);
-
- if (unused_curves.size())
- fprintf(stderr, "removed %u unused curves\n", unused_curves.size());
- }
-
- bool write_animation(const COLLADAFW::Animation* anim)
- {
- if (anim->getAnimationType() == COLLADAFW::Animation::ANIMATION_CURVE) {
- COLLADAFW::AnimationCurve *curve = (COLLADAFW::AnimationCurve*)anim;
-
- // XXX Don't know if it's necessary
- // Should we check outPhysicalDimension?
- if (curve->getInPhysicalDimension() != COLLADAFW::PHYSICAL_DIMENSION_TIME) {
- fprintf(stderr, "Inputs physical dimension is not time. \n");
- return true;
- }
-
- // a curve can have mixed interpolation type,
- // in this case curve->getInterpolationTypes returns a list of interpolation types per key
- COLLADAFW::AnimationCurve::InterpolationType interp = curve->getInterpolationType();
-
- if (interp != COLLADAFW::AnimationCurve::INTERPOLATION_MIXED) {
- switch (interp) {
- case COLLADAFW::AnimationCurve::INTERPOLATION_LINEAR:
- case COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER:
- animation_to_fcurves(curve);
- break;
- default:
- // TODO there're also CARDINAL, HERMITE, BSPLINE and STEP types
- fprintf(stderr, "CARDINAL, HERMITE, BSPLINE and STEP anim interpolation types not supported yet.\n");
- break;
- }
- }
- else {
- // not supported yet
- fprintf(stderr, "MIXED anim interpolation type is not supported yet.\n");
- }
- }
- else {
- fprintf(stderr, "FORMULA animation type is not supported yet.\n");
- }
-
- return true;
- }
-
- // called on post-process stage after writeVisualScenes
- bool write_animation_list(const COLLADAFW::AnimationList* animlist)
- {
- const COLLADAFW::UniqueId& animlist_id = animlist->getUniqueId();
-
- animlist_map[animlist_id] = animlist;
-
-#if 0
- // should not happen
- if (uid_animated_map.find(animlist_id) == uid_animated_map.end()) {
- return true;
- }
-
- // for bones rna_path is like: pose.bones["bone-name"].rotation
-
- // what does this AnimationList animate?
- Animation& animated = uid_animated_map[animlist_id];
- Object *ob = animated.ob;
-
- char rna_path[100];
- char joint_path[100];
- bool is_joint = false;
-
- // if ob is NULL, it should be a JOINT
- if (!ob) {
- ob = armature_importer->get_armature_for_joint(animated.node);
-
- if (!ob) {
- fprintf(stderr, "Cannot find armature for node %s\n", get_joint_name(animated.node));
- return true;
- }
-
- armature_importer->get_rna_path_for_joint(animated.node, joint_path, sizeof(joint_path));
-
- is_joint = true;
- }
-
- const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
-
- switch (animated.tm->getTransformationType()) {
- case COLLADAFW::Transformation::TRANSLATE:
- case COLLADAFW::Transformation::SCALE:
- {
- bool loc = animated.tm->getTransformationType() == COLLADAFW::Transformation::TRANSLATE;
- if (is_joint)
- BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, loc ? "location" : "scale");
- else
- BLI_strncpy(rna_path, loc ? "location" : "scale", sizeof(rna_path));
-
- for (int i = 0; i < bindings.getCount(); i++) {
- const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i];
- COLLADAFW::UniqueId anim_uid = binding.animation;
-
- if (curve_map.find(anim_uid) == curve_map.end()) {
- fprintf(stderr, "Cannot find FCurve by animation UID.\n");
- continue;
- }
-
- std::vector<FCurve*>& fcurves = curve_map[anim_uid];
-
- switch (binding.animationClass) {
- case COLLADAFW::AnimationList::POSITION_X:
- add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated);
- break;
- case COLLADAFW::AnimationList::POSITION_Y:
- add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated);
- break;
- case COLLADAFW::AnimationList::POSITION_Z:
- add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated);
- break;
- case COLLADAFW::AnimationList::POSITION_XYZ:
- add_fcurves_to_object(ob, fcurves, rna_path, -1, &animated);
- break;
- default:
- fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
- binding.animationClass, loc ? "TRANSLATE" : "SCALE");
- }
- }
- }
- break;
- case COLLADAFW::Transformation::ROTATE:
- {
- if (is_joint)
- BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_euler", joint_path);
- else
- BLI_strncpy(rna_path, "rotation_euler", sizeof(rna_path));
-
- COLLADAFW::Rotate* rot = (COLLADAFW::Rotate*)animated.tm;
- COLLADABU::Math::Vector3& axis = rot->getRotationAxis();
-
- for (int i = 0; i < bindings.getCount(); i++) {
- const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i];
- COLLADAFW::UniqueId anim_uid = binding.animation;
-
- if (curve_map.find(anim_uid) == curve_map.end()) {
- fprintf(stderr, "Cannot find FCurve by animation UID.\n");
- continue;
- }
-
- std::vector<FCurve*>& fcurves = curve_map[anim_uid];
-
- switch (binding.animationClass) {
- case COLLADAFW::AnimationList::ANGLE:
- if (COLLADABU::Math::Vector3::UNIT_X == axis) {
- add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated);
- }
- else if (COLLADABU::Math::Vector3::UNIT_Y == axis) {
- add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated);
- }
- else if (COLLADABU::Math::Vector3::UNIT_Z == axis) {
- add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated);
- }
- break;
- case COLLADAFW::AnimationList::AXISANGLE:
- // TODO convert axis-angle to quat? or XYZ?
- default:
- fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n",
- binding.animationClass);
- }
- }
- }
- break;
- case COLLADAFW::Transformation::MATRIX:
- case COLLADAFW::Transformation::SKEW:
- case COLLADAFW::Transformation::LOOKAT:
- fprintf(stderr, "Animation of MATRIX, SKEW and LOOKAT transformations is not supported yet.\n");
- break;
- }
-#endif
-
- return true;
- }
-
- void read_node_transform(COLLADAFW::Node *node, Object *ob)
- {
- float mat[4][4];
- TransformReader::get_node_mat(mat, node, &uid_animated_map, ob);
- if (ob) {
- copy_m4_m4(ob->obmat, mat);
- object_apply_mat4(ob, ob->obmat);
- }
- }
-
-#if 0
- virtual void change_eul_to_quat(Object *ob, bAction *act)
- {
- bActionGroup *grp;
- int i;
-
- for (grp = (bActionGroup*)act->groups.first; grp; grp = grp->next) {
-
- FCurve *eulcu[3] = {NULL, NULL, NULL};
-
- if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end())
- continue;
-
- std::vector<FCurve*> &rot_fcurves = fcurves_actionGroup_map[grp];
-
- if (rot_fcurves.size() > 3) continue;
-
- for (i = 0; i < rot_fcurves.size(); i++)
- eulcu[rot_fcurves[i]->array_index] = rot_fcurves[i];
-
- char joint_path[100];
- char rna_path[100];
-
- BLI_snprintf(joint_path, sizeof(joint_path), "pose.bones[\"%s\"]", grp->name);
- BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_quaternion", joint_path);
-
- FCurve *quatcu[4] = {
- create_fcurve(0, rna_path),
- create_fcurve(1, rna_path),
- create_fcurve(2, rna_path),
- create_fcurve(3, rna_path)
- };
-
- bPoseChannel *chan = get_pose_channel(ob->pose, grp->name);
-
- float m4[4][4], irest[3][3];
- invert_m4_m4(m4, chan->bone->arm_mat);
- copy_m3_m4(irest, m4);
-
- for (i = 0; i < 3; i++) {
-
- FCurve *cu = eulcu[i];
-
- if (!cu) continue;
-
- for (int j = 0; j < cu->totvert; j++) {
- float frame = cu->bezt[j].vec[1][0];
-
- float eul[3] = {
- eulcu[0] ? evaluate_fcurve(eulcu[0], frame) : 0.0f,
- eulcu[1] ? evaluate_fcurve(eulcu[1], frame) : 0.0f,
- eulcu[2] ? evaluate_fcurve(eulcu[2], frame) : 0.0f
- };
-
- // make eul relative to bone rest pose
- float rot[3][3], rel[3][3], quat[4];
-
- /*eul_to_mat3(rot, eul);
-
- mul_m3_m3m3(rel, irest, rot);
-
- mat3_to_quat(quat, rel);
- */
-
- eul_to_quat(quat, eul);
-
- for (int k = 0; k < 4; k++)
- create_bezt(quatcu[k], frame, quat[k]);
- }
- }
-
- // now replace old Euler curves
-
- for (i = 0; i < 3; i++) {
- if (!eulcu[i]) continue;
-
- action_groups_remove_channel(act, eulcu[i]);
- free_fcurve(eulcu[i]);
- }
-
- chan->rotmode = ROT_MODE_QUAT;
-
- for (i = 0; i < 4; i++)
- action_groups_add_channel(act, grp, quatcu[i]);
- }
-
- bPoseChannel *pchan;
- for (pchan = (bPoseChannel*)ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- pchan->rotmode = ROT_MODE_QUAT;
- }
- }
-#endif
-
- // prerequisites:
- // animlist_map - map animlist id -> animlist
- // curve_map - map anim id -> curve(s)
- Object *translate_animation(COLLADAFW::Node *node,
- std::map<COLLADAFW::UniqueId, Object*>& object_map,
- std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
- COLLADAFW::Transformation::TransformationType tm_type,
- Object *par_job = NULL)
- {
- bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE;
- bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX;
- bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
-
- COLLADAFW::Node *root = root_map.find(node->getUniqueId()) == root_map.end() ? node : root_map[node->getUniqueId()];
- Object *ob = is_joint ? armature_importer->get_armature_for_joint(node) : object_map[node->getUniqueId()];
- const char *bone_name = is_joint ? get_joint_name(node) : NULL;
-
- if (!ob) {
- fprintf(stderr, "cannot find Object for Node with id=\"%s\"\n", node->getOriginalId().c_str());
- return NULL;
- }
-
- // frames at which to sample
- std::vector<float> frames;
-
- // for each <rotate>, <translate>, etc. there is a separate Transformation
- const COLLADAFW::TransformationPointerArray& tms = node->getTransformations();
-
- unsigned int i;
-
- // find frames at which to sample plus convert all rotation keys to radians
- for (i = 0; i < tms.getCount(); i++) {
- COLLADAFW::Transformation *tm = tms[i];
- COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
-
- if (type == tm_type) {
- const COLLADAFW::UniqueId& listid = tm->getAnimationList();
-
- if (animlist_map.find(listid) != animlist_map.end()) {
- const COLLADAFW::AnimationList *animlist = animlist_map[listid];
- const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
-
- if (bindings.getCount()) {
- for (unsigned int j = 0; j < bindings.getCount(); j++) {
- std::vector<FCurve*>& curves = curve_map[bindings[j].animation];
- bool xyz = ((type == COLLADAFW::Transformation::TRANSLATE || type == COLLADAFW::Transformation::SCALE) && bindings[j].animationClass == COLLADAFW::AnimationList::POSITION_XYZ);
-
- if ((!xyz && curves.size() == 1) || (xyz && curves.size() == 3) || is_matrix) {
- std::vector<FCurve*>::iterator iter;
-
- for (iter = curves.begin(); iter != curves.end(); iter++) {
- FCurve *fcu = *iter;
-
- if (is_rotation)
- fcurve_deg_to_rad(fcu);
-
- for (unsigned int k = 0; k < fcu->totvert; k++) {
- float fra = fcu->bezt[k].vec[1][0];
- if (std::find(frames.begin(), frames.end(), fra) == frames.end())
- frames.push_back(fra);
- }
- }
- }
- else {
- fprintf(stderr, "expected %d curves, got %u\n", xyz ? 3 : 1, curves.size());
- }
- }
- }
- }
- }
- }
-
- float irest_dae[4][4];
- float rest[4][4], irest[4][4];
-
- if (is_joint) {
- get_joint_rest_mat(irest_dae, root, node);
- invert_m4(irest_dae);
-
- Bone *bone = get_named_bone((bArmature*)ob->data, bone_name);
- if (!bone) {
- fprintf(stderr, "cannot find bone \"%s\"\n", bone_name);
- return NULL;
- }
-
- unit_m4(rest);
- copy_m4_m4(rest, bone->arm_mat);
- invert_m4_m4(irest, rest);
- }
-
- Object *job = NULL;
-
-#ifdef ARMATURE_TEST
- FCurve *job_curves[10];
- job = get_joint_object(root, node, par_job);
-#endif
-
- if (frames.size() == 0)
- return job;
-
- std::sort(frames.begin(), frames.end());
-
- const char *tm_str = NULL;
- switch (tm_type) {
- case COLLADAFW::Transformation::ROTATE:
- tm_str = "rotation_quaternion";
- break;
- case COLLADAFW::Transformation::SCALE:
- tm_str = "scale";
- break;
- case COLLADAFW::Transformation::TRANSLATE:
- tm_str = "location";
- break;
- case COLLADAFW::Transformation::MATRIX:
- break;
- default:
- return job;
- }
-
- char rna_path[200];
- char joint_path[200];
-
- if (is_joint)
- armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path));
-
- // new curves
- FCurve *newcu[10]; // if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale
- unsigned int totcu = is_matrix ? 10 : (is_rotation ? 4 : 3);
-
- for (i = 0; i < totcu; i++) {
-
- int axis = i;
-
- if (is_matrix) {
- if (i < 4) {
- tm_str = "rotation_quaternion";
- axis = i;
- }
- else if (i < 7) {
- tm_str = "location";
- axis = i - 4;
- }
- else {
- tm_str = "scale";
- axis = i - 7;
- }
- }
-
- if (is_joint)
- BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str);
- else
- strcpy(rna_path, tm_str);
-
- newcu[i] = create_fcurve(axis, rna_path);
-
-#ifdef ARMATURE_TEST
- if (is_joint)
- job_curves[i] = create_fcurve(axis, tm_str);
-#endif
- }
-
- std::vector<float>::iterator it;
-
- // sample values at each frame
- for (it = frames.begin(); it != frames.end(); it++) {
- float fra = *it;
-
- float mat[4][4];
- float matfra[4][4];
-
- unit_m4(matfra);
-
- // calc object-space mat
- evaluate_transform_at_frame(matfra, node, fra);
-
- // for joints, we need a special matrix
- if (is_joint) {
- // special matrix: iR * M * iR_dae * R
- // where R, iR are bone rest and inverse rest mats in world space (Blender bones),
- // iR_dae is joint inverse rest matrix (DAE) and M is an evaluated joint world-space matrix (DAE)
- float temp[4][4], par[4][4];
-
- // calc M
- calc_joint_parent_mat_rest(par, NULL, root, node);
- mul_m4_m4m4(temp, matfra, par);
-
- // evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra);
-
- // calc special matrix
- mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
- }
- else {
- copy_m4_m4(mat, matfra);
- }
-
- float val[4], rot[4], loc[3], scale[3];
-
- switch (tm_type) {
- case COLLADAFW::Transformation::ROTATE:
- mat4_to_quat(val, mat);
- break;
- case COLLADAFW::Transformation::SCALE:
- mat4_to_size(val, mat);
- break;
- case COLLADAFW::Transformation::TRANSLATE:
- copy_v3_v3(val, mat[3]);
- break;
- case COLLADAFW::Transformation::MATRIX:
- mat4_to_quat(rot, mat);
- copy_v3_v3(loc, mat[3]);
- mat4_to_size(scale, mat);
- break;
- default:
- break;
- }
-
- // add keys
- for (i = 0; i < totcu; i++) {
- if (is_matrix) {
- if (i < 4)
- add_bezt(newcu[i], fra, rot[i]);
- else if (i < 7)
- add_bezt(newcu[i], fra, loc[i - 4]);
- else
- add_bezt(newcu[i], fra, scale[i - 7]);
- }
- else {
- add_bezt(newcu[i], fra, val[i]);
- }
- }
-
-#ifdef ARMATURE_TEST
- if (is_joint) {
- switch (tm_type) {
- case COLLADAFW::Transformation::ROTATE:
- mat4_to_quat(val, matfra);
- break;
- case COLLADAFW::Transformation::SCALE:
- mat4_to_size(val, matfra);
- break;
- case COLLADAFW::Transformation::TRANSLATE:
- copy_v3_v3(val, matfra[3]);
- break;
- case MATRIX:
- mat4_to_quat(rot, matfra);
- copy_v3_v3(loc, matfra[3]);
- mat4_to_size(scale, matfra);
- break;
- default:
- break;
- }
-
- for (i = 0; i < totcu; i++) {
- if (is_matrix) {
- if (i < 4)
- add_bezt(job_curves[i], fra, rot[i]);
- else if (i < 7)
- add_bezt(job_curves[i], fra, loc[i - 4]);
- else
- add_bezt(job_curves[i], fra, scale[i - 7]);
- }
- else {
- add_bezt(job_curves[i], fra, val[i]);
- }
- }
- }
-#endif
- }
-
- verify_adt_action((ID*)&ob->id, 1);
-
- ListBase *curves = &ob->adt->action->curves;
-
- // add curves
- for (i = 0; i < totcu; i++) {
- if (is_joint)
- add_bone_fcurve(ob, node, newcu[i]);
- else
- BLI_addtail(curves, newcu[i]);
-
-#ifdef ARMATURE_TEST
- if (is_joint)
- BLI_addtail(&job->adt->action->curves, job_curves[i]);
-#endif
- }
-
- if (is_rotation || is_matrix) {
- if (is_joint) {
- bPoseChannel *chan = get_pose_channel(ob->pose, bone_name);
- chan->rotmode = ROT_MODE_QUAT;
- }
- else {
- ob->rotmode = ROT_MODE_QUAT;
- }
- }
-
- return job;
- }
-
- // internal, better make it private
- // warning: evaluates only rotation
- // prerequisites: animlist_map, curve_map
- void evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra)
- {
- const COLLADAFW::TransformationPointerArray& tms = node->getTransformations();
-
- unit_m4(mat);
-
- for (unsigned int i = 0; i < tms.getCount(); i++) {
- COLLADAFW::Transformation *tm = tms[i];
- COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
- float m[4][4];
-
- unit_m4(m);
-
- if (!evaluate_animation(tm, m, fra, node->getOriginalId().c_str())) {
- switch (type) {
- case COLLADAFW::Transformation::ROTATE:
- dae_rotate_to_mat4(tm, m);
- break;
- case COLLADAFW::Transformation::TRANSLATE:
- dae_translate_to_mat4(tm, m);
- break;
- case COLLADAFW::Transformation::SCALE:
- dae_scale_to_mat4(tm, m);
- break;
- case COLLADAFW::Transformation::MATRIX:
- dae_matrix_to_mat4(tm, m);
- break;
- default:
- fprintf(stderr, "unsupported transformation type %d\n", type);
- }
- }
-
- float temp[4][4];
- copy_m4_m4(temp, mat);
-
- mul_m4_m4m4(mat, m, temp);
- }
- }
-
- // return true to indicate that mat contains a sane value
- bool evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id)
- {
- const COLLADAFW::UniqueId& listid = tm->getAnimationList();
- COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
-
- if (type != COLLADAFW::Transformation::ROTATE &&
- type != COLLADAFW::Transformation::SCALE &&
- type != COLLADAFW::Transformation::TRANSLATE &&
- type != COLLADAFW::Transformation::MATRIX) {
- fprintf(stderr, "animation of transformation %d is not supported yet\n", type);
- return false;
- }
-
- if (animlist_map.find(listid) == animlist_map.end())
- return false;
-
- const COLLADAFW::AnimationList *animlist = animlist_map[listid];
- const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
-
- if (bindings.getCount()) {
- float vec[3];
-
- bool is_scale = (type == COLLADAFW::Transformation::SCALE);
- bool is_translate = (type == COLLADAFW::Transformation::TRANSLATE);
-
- if (type == COLLADAFW::Transformation::SCALE)
- dae_scale_to_v3(tm, vec);
- else if (type == COLLADAFW::Transformation::TRANSLATE)
- dae_translate_to_v3(tm, vec);
-
- for (unsigned int j = 0; j < bindings.getCount(); j++) {
- const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[j];
- std::vector<FCurve*>& curves = curve_map[binding.animation];
- COLLADAFW::AnimationList::AnimationClass animclass = binding.animationClass;
- char path[100];
-
- switch (type) {
- case COLLADAFW::Transformation::ROTATE:
- BLI_snprintf(path, sizeof(path), "%s.rotate (binding %u)", node_id, j);
- break;
- case COLLADAFW::Transformation::SCALE:
- BLI_snprintf(path, sizeof(path), "%s.scale (binding %u)", node_id, j);
- break;
- case COLLADAFW::Transformation::TRANSLATE:
- BLI_snprintf(path, sizeof(path), "%s.translate (binding %u)", node_id, j);
- break;
- case COLLADAFW::Transformation::MATRIX:
- BLI_snprintf(path, sizeof(path), "%s.matrix (binding %u)", node_id, j);
- break;
- default:
- break;
- }
-
- if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
- fprintf(stderr, "%s: UNKNOWN animation class\n", path);
- continue;
- }
-
- if (type == COLLADAFW::Transformation::ROTATE) {
- if (curves.size() != 1) {
- fprintf(stderr, "expected 1 curve, got %u\n", curves.size());
- return false;
- }
-
- // TODO support other animclasses
- if (animclass != COLLADAFW::AnimationList::ANGLE) {
- fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
- return false;
- }
-
- COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis();
- float ax[3] = {axis[0], axis[1], axis[2]};
- float angle = evaluate_fcurve(curves[0], fra);
- axis_angle_to_mat4(mat, ax, angle);
-
- return true;
- }
- else if (is_scale || is_translate) {
- bool is_xyz = animclass == COLLADAFW::AnimationList::POSITION_XYZ;
-
- if ((!is_xyz && curves.size() != 1) || (is_xyz && curves.size() != 3)) {
- if (is_xyz)
- fprintf(stderr, "%s: expected 3 curves, got %u\n", path, curves.size());
- else
- fprintf(stderr, "%s: expected 1 curve, got %u\n", path, curves.size());
- return false;
- }
-
- switch (animclass) {
- case COLLADAFW::AnimationList::POSITION_X:
- vec[0] = evaluate_fcurve(curves[0], fra);
- break;
- case COLLADAFW::AnimationList::POSITION_Y:
- vec[1] = evaluate_fcurve(curves[0], fra);
- break;
- case COLLADAFW::AnimationList::POSITION_Z:
- vec[2] = evaluate_fcurve(curves[0], fra);
- break;
- case COLLADAFW::AnimationList::POSITION_XYZ:
- vec[0] = evaluate_fcurve(curves[0], fra);
- vec[1] = evaluate_fcurve(curves[1], fra);
- vec[2] = evaluate_fcurve(curves[2], fra);
- break;
- default:
- fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
- break;
- }
- }
- else if (type == COLLADAFW::Transformation::MATRIX) {
- // for now, of matrix animation, support only the case when all values are packed into one animation
- if (curves.size() != 16) {
- fprintf(stderr, "%s: expected 16 curves, got %u\n", path, curves.size());
- return false;
- }
-
- COLLADABU::Math::Matrix4 matrix;
- int i = 0, j = 0;
-
- for (std::vector<FCurve*>::iterator it = curves.begin(); it != curves.end(); it++) {
- matrix.setElement(i, j, evaluate_fcurve(*it, fra));
- j++;
- if (j == 4) {
- i++;
- j = 0;
- }
- }
-
- COLLADAFW::Matrix tm(matrix);
- dae_matrix_to_mat4(&tm, mat);
-
- return true;
- }
- }
-
- if (is_scale)
- size_to_mat4(mat, vec);
- else
- copy_v3_v3(mat[3], vec);
-
- return is_scale || is_translate;
- }
-
- return false;
- }
-
- // gives a world-space mat of joint at rest position
- void get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node)
- {
- // if bind mat is not available,
- // use "current" node transform, i.e. all those tms listed inside <node>
- if (!armature_importer->get_joint_bind_mat(mat, node)) {
- float par[4][4], m[4][4];
-
- calc_joint_parent_mat_rest(par, NULL, root, node);
- get_node_mat(m, node, NULL, NULL);
- mul_m4_m4m4(mat, m, par);
- }
- }
-
- // gives a world-space mat, end's mat not included
- bool calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end)
- {
- float m[4][4];
-
- if (node == end) {
- par ? copy_m4_m4(mat, par) : unit_m4(mat);
- return true;
- }
-
- // use bind matrix if available or calc "current" world mat
- if (!armature_importer->get_joint_bind_mat(m, node)) {
- if (par) {
- float temp[4][4];
- get_node_mat(temp, node, NULL, NULL);
- mul_m4_m4m4(m, temp, par);
- }
- else {
- get_node_mat(m, node, NULL, NULL);
- }
- }
-
- COLLADAFW::NodePointerArray& children = node->getChildNodes();
- for (unsigned int i = 0; i < children.getCount(); i++) {
- if (calc_joint_parent_mat_rest(mat, m, children[i], end))
- return true;
- }
-
- return false;
- }
-
-#ifdef ARMATURE_TEST
- Object *get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job)
- {
- if (joint_objects.find(node->getUniqueId()) == joint_objects.end()) {
- Object *job = add_object(scene, OB_EMPTY);
-
- rename_id((ID*)&job->id, (char*)get_joint_name(node));
-
- job->lay = object_in_scene(job, scene)->lay = 2;
-
- mul_v3_fl(job->size, 0.5f);
- job->recalc |= OB_RECALC_OB;
-
- verify_adt_action((ID*)&job->id, 1);
-
- job->rotmode = ROT_MODE_QUAT;
-
- float mat[4][4];
- get_joint_rest_mat(mat, root, node);
-
- if (par_job) {
- float temp[4][4], ipar[4][4];
- invert_m4_m4(ipar, par_job->obmat);
- copy_m4_m4(temp, mat);
- mul_m4_m4m4(mat, temp, ipar);
- }
-
- TransformBase::decompose(mat, job->loc, NULL, job->quat, job->size);
-
- if (par_job) {
- job->parent = par_job;
-
- par_job->recalc |= OB_RECALC_OB;
- job->parsubstr[0] = 0;
- }
-
- where_is_object(scene, job);
-
- // after parenting and layer change
- DAG_scene_sort(CTX_data_main(C), scene);
-
- joint_objects[node->getUniqueId()] = job;
- }
-
- return joint_objects[node->getUniqueId()];
- }
-#endif
-
-#if 0
- // recursively evaluates joint tree until end is found, mat then is world-space matrix of end
- // mat must be identity on enter, node must be root
- bool evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra)
- {
- float m[4][4];
- if (par) {
- float temp[4][4];
- evaluate_transform_at_frame(temp, node, node == end ? fra : 0.0f);
- mul_m4_m4m4(m, temp, par);
- }
- else {
- evaluate_transform_at_frame(m, node, node == end ? fra : 0.0f);
- }
-
- if (node == end) {
- copy_m4_m4(mat, m);
- return true;
- }
- else {
- COLLADAFW::NodePointerArray& children = node->getChildNodes();
- for (int i = 0; i < children.getCount(); i++) {
- if (evaluate_joint_world_transform_at_frame(mat, m, children[i], end, fra))
- return true;
- }
- }
-
- return false;
- }
-#endif
-
- void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu)
- {
- const char *bone_name = get_joint_name(node);
- bAction *act = ob->adt->action;
-
- /* try to find group */
- bActionGroup *grp = action_groups_find_named(act, bone_name);
-
- /* no matching groups, so add one */
- if (grp == NULL) {
- /* Add a new group, and make it active */
- grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
-
- grp->flag = AGRP_SELECTED;
- BLI_strncpy(grp->name, bone_name, sizeof(grp->name));
-
- BLI_addtail(&act->groups, grp);
- BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64);
- }
-
- /* add F-Curve to group */
- action_groups_add_channel(act, grp, fcu);
- }
-
- void add_bezt(FCurve *fcu, float fra, float value)
- {
- BezTriple bez;
- memset(&bez, 0, sizeof(BezTriple));
- bez.vec[1][0] = fra;
- bez.vec[1][1] = value;
- bez.ipo = U.ipo_new; /* use default interpolation mode here... */
- bez.f1 = bez.f2 = bez.f3 = SELECT;
- bez.h1 = bez.h2 = HD_AUTO;
- insert_bezt_fcurve(fcu, &bez, 0);
- calchandles_fcurve(fcu);
- }
-};
/*
-
COLLADA Importer limitations:
-
- no multiple scene import, all objects are added to active scene
-
*/
+
+// #define COLLADA_DEBUG
+// creates empties for each imported bone on layer 2, for debugging
+// #define ARMATURE_TEST
+
/** Class that needs to be implemented by a writer.
IMPORTANT: The write functions are called in arbitrary order.*/
class Writer: public COLLADAFW::IWriter
@@ -3266,7 +130,7 @@ public:
/** Constructor. */
Writer(bContext *C, const char *filename) : mFilename(filename), mContext(C),
armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)),
- mesh_importer(&armature_importer, CTX_data_scene(C)),
+ mesh_importer(&unit_converter, &armature_importer, CTX_data_scene(C)),
anim_importer(&unit_converter, &armature_importer, CTX_data_scene(C)) {}
/** Destructor. */
@@ -3308,8 +172,30 @@ public:
{
std::vector<const COLLADAFW::VisualScene*>::iterator it;
for (it = vscenes.begin(); it != vscenes.end(); it++) {
+ PointerRNA sceneptr, unit_settings;
+ PropertyRNA *system, *scale;
// TODO: create a new scene except the selected <visual_scene> - use current blender scene for it
Scene *sce = CTX_data_scene(mContext);
+
+ // for scene unit settings: system, scale_length
+ RNA_id_pointer_create(&sce->id, &sceneptr);
+ unit_settings = RNA_pointer_get(&sceneptr, "unit_settings");
+ system = RNA_struct_find_property(&unit_settings, "system");
+ scale = RNA_struct_find_property(&unit_settings, "scale_length");
+
+ switch(unit_converter.isMetricSystem()) {
+ case UnitConverter::Metric:
+ RNA_property_enum_set(&unit_settings, system, USER_UNIT_METRIC);
+ break;
+ case UnitConverter::Imperial:
+ RNA_property_enum_set(&unit_settings, system, USER_UNIT_IMPERIAL);
+ break;
+ default:
+ RNA_property_enum_set(&unit_settings, system, USER_UNIT_NONE);
+ break;
+ }
+ RNA_property_float_set(&unit_settings, scale, unit_converter.getLinearMeter());
+
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++) {
@@ -3389,9 +275,6 @@ public:
@return The writer should return true, if writing succeeded, false otherwise.*/
virtual bool writeGlobalAsset ( const COLLADAFW::FileInfo* asset )
{
- // XXX take up_axis, unit into account
- // COLLADAFW::FileInfo::Unit unit = asset->getUnit();
- // COLLADAFW::FileInfo::UpAxisType upAxis = asset->getUpAxisType();
unit_converter.read_asset(asset);
return true;
@@ -3468,7 +351,7 @@ public:
else {
new_child = create_instance_node(object_map[child_id], child_node, NULL, sce, is_library_node);
}
- set_parent(new_child, obn, mContext, true);
+ bc_set_parent(new_child, obn, mContext, true);
if (is_library_node)
libnode_ob.push_back(new_child);
@@ -3547,7 +430,7 @@ public:
if (!is_joint) {
// if par was given make this object child of the previous
if (par && ob)
- set_parent(ob, par, mContext);
+ bc_set_parent(ob, par, mContext);
}
// if node has child nodes write them
@@ -3650,8 +533,7 @@ public:
// phong
else if (shader == COLLADAFW::EffectCommon::SHADER_PHONG) {
ma->spec_shader = MA_SPEC_PHONG;
- // XXX setting specular hardness instead of specularity intensity
- ma->har = ef->getShininess().getFloatValue() * 4;
+ ma->har = ef->getShininess().getFloatValue();
}
// lambert
else if (shader == COLLADAFW::EffectCommon::SHADER_LAMBERT) {
@@ -3925,7 +807,7 @@ public:
BLI_split_dirfile(filename, dir, NULL);
BLI_join_dirfile(full_path, dir, filepath.c_str());
- Image *ima = BKE_add_image_file(full_path, 0);
+ Image *ima = BKE_add_image_file(full_path);
if (!ima) {
fprintf(stderr, "Cannot create image. \n");
return true;
@@ -3957,6 +839,38 @@ public:
lamp->g = col.getGreen();
lamp->b = col.getBlue();
}
+ float constatt = light->getConstantAttenuation().getValue();
+ float linatt = light->getLinearAttenuation().getValue();
+ float quadatt = light->getQuadraticAttenuation().getValue();
+ float d = 25.0f;
+ float att1 = 0.0f;
+ float att2 = 0.0f;
+
+ float e = 1.0f/constatt;
+
+ /* NOTE: We assume for now that inv square is used for quadratic light
+ * and inv linear for linear light. Exported blender lin/quad weighted
+ * most likely will result in wrong import. */
+ /* quadratic light */
+ if(IS_EQ(linatt, 0.0f) && quadatt > 0.0f) {
+ //quadatt = att2/(d*d*(e*2));
+ float invquadatt = 1.0f/quadatt;
+ float d2 = invquadatt / (2 * e);
+ d = sqrtf(d2);
+ }
+ // linear light
+ else if(IS_EQ(quadatt, 0.0f) && linatt > 0.0f) {
+ //linatt = att1/(d*e);
+ float invlinatt = 1.0f/linatt;
+ d = invlinatt / e;
+ } else {
+ printf("no linear nor quad light, using defaults for attenuation, import will be incorrect: Lamp %s\n", lamp->id.name);
+ att2 = 1.0f;
+ }
+
+ lamp->dist = d;
+ lamp->energy = e;
+
COLLADAFW::Light::LightType type = light->getLightType();
switch(type) {
case COLLADAFW::Light::AMBIENT_LIGHT:
@@ -3967,9 +881,9 @@ public:
case COLLADAFW::Light::SPOT_LIGHT:
{
lamp->type = LA_SPOT;
- lamp->falloff_type = LA_FALLOFF_SLIDERS;
- lamp->att1 = light->getLinearAttenuation().getValue();
- lamp->att2 = light->getQuadraticAttenuation().getValue();
+ lamp->falloff_type = LA_FALLOFF_INVSQUARE;
+ lamp->att1 = att1;
+ lamp->att2 = att2;
lamp->spotsize = light->getFallOffAngle().getValue();
lamp->spotblend = light->getFallOffExponent().getValue();
}
@@ -3982,8 +896,9 @@ public:
case COLLADAFW::Light::POINT_LIGHT:
{
lamp->type = LA_LOCAL;
- lamp->att1 = light->getLinearAttenuation().getValue();
- lamp->att2 = light->getQuadraticAttenuation().getValue();
+ lamp->falloff_type = LA_FALLOFF_INVSQUARE;
+ lamp->att1 = att1;
+ lamp->att2 = att2;
}
break;
case COLLADAFW::Light::UNDEFINED:
diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h
index babf8f65d7f..6a6f1dcb3bc 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -21,6 +21,9 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+#ifndef __DOCUMENTIMPORTER_H__
+#define __DOCUMENTIMPORTER_H__
struct Main;
struct bContext;
@@ -29,3 +32,5 @@ class DocumentImporter
public:
void import(bContext *C, const char *filename);
};
+
+#endif
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
new file mode 100644
index 00000000000..45b6450e444
--- /dev/null
+++ b/source/blender/collada/EffectExporter.cpp
@@ -0,0 +1,306 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <map>
+
+#include "COLLADASWEffectProfile.h"
+
+#include "EffectExporter.h"
+#include "MaterialExporter.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_texture_types.h"
+
+#include "BKE_customdata.h"
+
+#include "collada_internal.h"
+#include "collada_utils.h"
+
+// OB_MESH is assumed
+static std::string getActiveUVLayerName(Object *ob)
+{
+ Mesh *me = (Mesh*)ob->data;
+
+ int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
+ if (num_layers)
+ return std::string(bc_CustomData_get_active_layer_name(&me->fdata, CD_MTFACE));
+
+ return "";
+}
+
+
+EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryEffects(sw){}
+void EffectsExporter::exportEffects(Scene *sce)
+{
+ openLibrary();
+ MaterialFunctor mf;
+ mf.forEachMaterialInScene<EffectsExporter>(sce, *this);
+
+ closeLibrary();
+}
+
+void EffectsExporter::operator()(Material *ma, Object *ob)
+{
+ // create a list of indices to textures of type TEX_IMAGE
+ std::vector<int> tex_indices;
+ createTextureIndices(ma, tex_indices);
+
+ openEffect(translate_id(id_name(ma)) + "-effect");
+
+ COLLADASW::EffectProfile ep(mSW);
+ ep.setProfileType(COLLADASW::EffectProfile::COMMON);
+ ep.openProfile();
+ // set shader type - one of three blinn, phong or lambert
+ if (ma->spec_shader == MA_SPEC_BLINN) {
+ ep.setShaderType(COLLADASW::EffectProfile::BLINN);
+ // shininess
+ ep.setShininess(ma->har);
+ }
+ else if (ma->spec_shader == MA_SPEC_PHONG) {
+ ep.setShaderType(COLLADASW::EffectProfile::PHONG);
+ // shininess
+ ep.setShininess(ma->har);
+ }
+ else {
+ // XXX write warning "Current shader type is not supported"
+ ep.setShaderType(COLLADASW::EffectProfile::LAMBERT);
+ }
+ // index of refraction
+ if (ma->mode & MA_RAYTRANSP) {
+ ep.setIndexOfRefraction(ma->ang);
+ }
+ else {
+ ep.setIndexOfRefraction(1.0f);
+ }
+
+ COLLADASW::ColorOrTexture cot;
+
+ // transparency
+ if (ma->mode & MA_TRANSP) {
+ // Tod: because we are in A_ONE mode transparency is calculated like this:
+ ep.setTransparency(ma->alpha);
+ // cot = getcol(1.0f, 1.0f, 1.0f, 1.0f);
+ // ep.setTransparent(cot);
+ }
+
+ // emission
+ cot=getcol(ma->emit, ma->emit, ma->emit, 1.0f);
+ ep.setEmission(cot);
+
+ // diffuse multiplied by diffuse intensity
+ cot = getcol(ma->r * ma->ref, ma->g * ma->ref, ma->b * ma->ref, 1.0f);
+ ep.setDiffuse(cot);
+
+ // ambient
+ cot = getcol(ma->ambr, ma->ambg, ma->ambb, 1.0f);
+ ep.setAmbient(cot);
+
+ // reflective, reflectivity
+ if (ma->mode & MA_RAYMIRROR) {
+ cot = getcol(ma->mirr, ma->mirg, ma->mirb, 1.0f);
+ ep.setReflective(cot);
+ ep.setReflectivity(ma->ray_mirror);
+ }
+ // else {
+ // cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
+ // ep.setReflective(cot);
+ // ep.setReflectivity(ma->spec);
+ // }
+
+ // specular
+ if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) {
+ cot = getcol(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f);
+ ep.setSpecular(cot);
+ }
+
+ // XXX make this more readable if possible
+
+ // create <sampler> and <surface> for each image
+ COLLADASW::Sampler samplers[MAX_MTEX];
+ //COLLADASW::Surface surfaces[MAX_MTEX];
+ //void *samp_surf[MAX_MTEX][2];
+ void *samp_surf[MAX_MTEX][1];
+
+ // image to index to samp_surf map
+ // samp_surf[index] stores 2 pointers, sampler and surface
+ std::map<std::string, int> im_samp_map;
+
+ unsigned int a, b;
+ for (a = 0, b = 0; a < tex_indices.size(); a++) {
+ MTex *t = ma->mtex[tex_indices[a]];
+ Image *ima = t->tex->ima;
+
+ // Image not set for texture
+ if(!ima) continue;
+
+ std::string key(id_name(ima));
+ key = translate_id(key);
+
+ // create only one <sampler>/<surface> pair for each unique image
+ if (im_samp_map.find(key) == im_samp_map.end()) {
+ // //<newparam> <surface> <init_from>
+ // COLLADASW::Surface surface(COLLADASW::Surface::SURFACE_TYPE_2D,
+ // key + COLLADASW::Surface::SURFACE_SID_SUFFIX);
+ // COLLADASW::SurfaceInitOption sio(COLLADASW::SurfaceInitOption::INIT_FROM);
+ // sio.setImageReference(key);
+ // surface.setInitOption(sio);
+
+ // COLLADASW::NewParamSurface surface(mSW);
+ // surface->setParamType(COLLADASW::CSW_SURFACE_TYPE_2D);
+
+ //<newparam> <sampler> <source>
+ COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D,
+ key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX,
+ key + COLLADASW::Sampler::SURFACE_SID_SUFFIX);
+ sampler.setImageId(key);
+ // copy values to arrays since they will live longer
+ samplers[a] = sampler;
+ //surfaces[a] = surface;
+
+ // store pointers so they can be used later when we create <texture>s
+ samp_surf[b][0] = &samplers[a];
+ //samp_surf[b][1] = &surfaces[a];
+
+ im_samp_map[key] = b;
+ b++;
+ }
+ }
+
+ // used as fallback when MTex->uvname is "" (this is pretty common)
+ // it is indeed the correct value to use in that case
+ std::string active_uv(getActiveUVLayerName(ob));
+
+ // write textures
+ // XXX very slow
+ for (a = 0; a < tex_indices.size(); a++) {
+ MTex *t = ma->mtex[tex_indices[a]];
+ Image *ima = t->tex->ima;
+
+ // Image not set for texture
+ if(!ima) continue;
+
+ // we assume map input is always TEXCO_UV
+
+ std::string key(id_name(ima));
+ key = translate_id(key);
+ int i = im_samp_map[key];
+ COLLADASW::Sampler *sampler = (COLLADASW::Sampler*)samp_surf[i][0];
+ //COLLADASW::Surface *surface = (COLLADASW::Surface*)samp_surf[i][1];
+
+ std::string uvname = strlen(t->uvname) ? t->uvname : active_uv;
+
+ // color
+ if (t->mapto & MAP_COL) {
+ ep.setDiffuse(createTexture(ima, uvname, sampler));
+ }
+ // ambient
+ if (t->mapto & MAP_AMB) {
+ ep.setAmbient(createTexture(ima, uvname, sampler));
+ }
+ // specular
+ if (t->mapto & MAP_SPEC) {
+ ep.setSpecular(createTexture(ima, uvname, sampler));
+ }
+ // emission
+ if (t->mapto & MAP_EMIT) {
+ ep.setEmission(createTexture(ima, uvname, sampler));
+ }
+ // reflective
+ if (t->mapto & MAP_REF) {
+ ep.setReflective(createTexture(ima, uvname, sampler));
+ }
+ // alpha
+ if (t->mapto & MAP_ALPHA) {
+ ep.setTransparent(createTexture(ima, uvname, sampler));
+ }
+ // extension:
+ // Normal map --> Must be stored with <extra> tag as different technique,
+ // since COLLADA doesn't support normal maps, even in current COLLADA 1.5.
+ if (t->mapto & MAP_NORM) {
+ COLLADASW::Texture texture(key);
+ texture.setTexcoord(uvname);
+ texture.setSampler(*sampler);
+ // technique FCOLLADA, with the <bump> tag, is most likely the best understood,
+ // most widespread de-facto standard.
+ texture.setProfileName("FCOLLADA");
+ texture.setChildElementName("bump");
+ ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
+ }
+ }
+ // performs the actual writing
+ ep.addProfileElements();
+ bool twoSided = false;
+ if (ob->type == OB_MESH && ob->data) {
+ Mesh *me = (Mesh*)ob->data;
+ if (me->flag & ME_TWOSIDED)
+ twoSided = true;
+ }
+ if (twoSided)
+ ep.addExtraTechniqueParameter("GOOGLEEARTH", "show_double_sided", 1);
+ ep.addExtraTechniques(mSW);
+
+ ep.closeProfile();
+ if (twoSided)
+ mSW->appendTextBlock("<extra><technique profile=\"MAX3D\"><double_sided>1</double_sided></technique></extra>");
+ closeEffect();
+}
+
+COLLADASW::ColorOrTexture EffectsExporter::createTexture(Image *ima,
+ std::string& uv_layer_name,
+ COLLADASW::Sampler *sampler
+ /*COLLADASW::Surface *surface*/)
+{
+
+ COLLADASW::Texture texture(translate_id(id_name(ima)));
+ texture.setTexcoord(uv_layer_name);
+ //texture.setSurface(*surface);
+ texture.setSampler(*sampler);
+
+ COLLADASW::ColorOrTexture cot(texture);
+ return cot;
+}
+
+COLLADASW::ColorOrTexture EffectsExporter::getcol(float r, float g, float b, float a)
+{
+ COLLADASW::Color color(r,g,b,a);
+ COLLADASW::ColorOrTexture cot(color);
+ return cot;
+}
+
+//returns the array of mtex indices which have image
+//need this for exporting textures
+void EffectsExporter::createTextureIndices(Material *ma, std::vector<int> &indices)
+{
+ indices.clear();
+
+ 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);
+ }
+ }
+}
diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h
new file mode 100644
index 00000000000..e8f8754b20a
--- /dev/null
+++ b/source/blender/collada/EffectExporter.h
@@ -0,0 +1,62 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __EFFECTEXPORTER_H__
+#define __EFFECTEXPORTER_H__
+
+#include <string>
+#include <vector>
+
+#include "COLLADASWColorOrTexture.h"
+#include "COLLADASWStreamWriter.h"
+#include "COLLADASWSampler.h"
+#include "COLLADASWLibraryEffects.h"
+
+#include "DNA_image_types.h"
+#include "DNA_material_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+class EffectsExporter: COLLADASW::LibraryEffects
+{
+public:
+ EffectsExporter(COLLADASW::StreamWriter *sw);
+ void exportEffects(Scene *sce);
+
+ void operator()(Material *ma, Object *ob);
+
+ COLLADASW::ColorOrTexture createTexture(Image *ima,
+ std::string& uv_layer_name,
+ COLLADASW::Sampler *sampler
+ /*COLLADASW::Surface *surface*/);
+
+ COLLADASW::ColorOrTexture getcol(float r, float g, float b, float a);
+
+ //returns the array of mtex indices which have image
+ //need this for exporting textures
+ void createTextureIndices(Material *ma, std::vector<int> &indices);
+};
+
+#endif
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
new file mode 100644
index 00000000000..1aef6e6489a
--- /dev/null
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -0,0 +1,472 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "COLLADASWPrimitves.h"
+#include "COLLADASWSource.h"
+#include "COLLADASWVertices.h"
+#include "COLLADABUUtils.h"
+
+#include "GeometryExporter.h"
+
+#include "DNA_meshdata_types.h"
+#include "BKE_customdata.h"
+#include "BKE_material.h"
+
+#include "collada_internal.h"
+
+// TODO: optimize UV sets by making indexed list with duplicates removed
+GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryGeometries(sw) {}
+
+
+void GeometryExporter::exportGeom(Scene *sce)
+{
+ openLibrary();
+
+ mScene = sce;
+ GeometryFunctor gf;
+ gf.forEachMeshObjectInScene<GeometryExporter>(sce, *this);
+
+ closeLibrary();
+}
+
+void GeometryExporter::operator()(Object *ob)
+{
+ // XXX don't use DerivedMesh, Mesh instead?
+
+#if 0
+ DerivedMesh *dm = mesh_get_derived_final(mScene, ob, CD_MASK_BAREMESH);
+#endif
+ Mesh *me = (Mesh*)ob->data;
+ std::string geom_id = get_geometry_id(ob);
+ std::vector<Normal> nor;
+ std::vector<Face> norind;
+
+ bool has_color = (bool)CustomData_has_layer(&me->fdata, CD_MCOL);
+
+ create_normals(nor, norind, me);
+
+ // openMesh(geoId, geoName, meshId)
+ openMesh(geom_id);
+
+ // writes <source> for vertex coords
+ createVertsSource(geom_id, me);
+
+ // writes <source> for normal coords
+ createNormalsSource(geom_id, me, nor);
+
+ bool has_uvs = (bool)CustomData_has_layer(&me->fdata, CD_MTFACE);
+
+ // writes <source> for uv coords if mesh has uv coords
+ if (has_uvs)
+ createTexcoordsSource(geom_id, me);
+
+ if (has_color)
+ createVertexColorSource(geom_id, me);
+
+ // <vertices>
+ COLLADASW::Vertices verts(mSW);
+ verts.setId(getIdBySemantics(geom_id, COLLADASW::VERTEX));
+ COLLADASW::InputList &input_list = verts.getInputList();
+ COLLADASW::Input input(COLLADASW::POSITION, getUrlBySemantics(geom_id, COLLADASW::POSITION));
+ input_list.push_back(input);
+ verts.add();
+
+ // XXX slow
+ if (ob->totcol) {
+ for(int a = 0; a < ob->totcol; a++) {
+ createPolylist(a, has_uvs, has_color, ob, geom_id, norind);
+ }
+ }
+ else {
+ createPolylist(0, has_uvs, has_color, ob, geom_id, norind);
+ }
+
+ closeMesh();
+ closeGeometry();
+
+#if 0
+ dm->release(dm);
+#endif
+}
+
+// powerful because it handles both cases when there is material and when there's not
+void GeometryExporter::createPolylist(int material_index,
+ bool has_uvs,
+ bool has_color,
+ Object *ob,
+ std::string& geom_id,
+ std::vector<Face>& norind)
+{
+ Mesh *me = (Mesh*)ob->data;
+ MFace *mfaces = me->mface;
+ int totfaces = me->totface;
+
+ // <vcount>
+ int i;
+ int faces_in_polylist = 0;
+ std::vector<unsigned long> vcount_list;
+
+ // count faces with this material
+ for (i = 0; i < totfaces; i++) {
+ MFace *f = &mfaces[i];
+
+ if (f->mat_nr == material_index) {
+ faces_in_polylist++;
+ if (f->v4 == 0) {
+ vcount_list.push_back(3);
+ }
+ else {
+ vcount_list.push_back(4);
+ }
+ }
+ }
+
+ // no faces using this material
+ if (faces_in_polylist == 0) {
+ fprintf(stderr, "%s: no faces use material %d\n", id_name(ob).c_str(), material_index);
+ return;
+ }
+
+ Material *ma = ob->totcol ? give_current_material(ob, material_index + 1) : NULL;
+ COLLADASW::Polylist polylist(mSW);
+
+ // sets count attribute in <polylist>
+ polylist.setCount(faces_in_polylist);
+
+ // sets material name
+ if (ma) {
+ polylist.setMaterial(translate_id(id_name(ma)));
+ }
+
+ COLLADASW::InputList &til = polylist.getInputList();
+
+ // creates <input> in <polylist> for vertices
+ COLLADASW::Input input1(COLLADASW::VERTEX, getUrlBySemantics(geom_id, COLLADASW::VERTEX), 0);
+
+ // creates <input> in <polylist> for normals
+ COLLADASW::Input input2(COLLADASW::NORMAL, getUrlBySemantics(geom_id, COLLADASW::NORMAL), 1);
+
+ til.push_back(input1);
+ til.push_back(input2);
+
+ // if mesh has uv coords writes <input> for TEXCOORD
+ int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
+
+ for (i = 0; i < num_layers; i++) {
+ // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
+ COLLADASW::Input input3(COLLADASW::TEXCOORD,
+ makeUrl(makeTexcoordSourceId(geom_id, i)),
+ 2, // offset always 2, this is only until we have optimized UV sets
+ i // set number equals UV layer index
+ );
+ til.push_back(input3);
+ }
+
+ if (has_color) {
+ COLLADASW::Input input4(COLLADASW::COLOR, getUrlBySemantics(geom_id, COLLADASW::COLOR), has_uvs ? 3 : 2);
+ til.push_back(input4);
+ }
+
+ // sets <vcount>
+ polylist.setVCountList(vcount_list);
+
+ // performs the actual writing
+ polylist.prepareToAppendValues();
+
+ // <p>
+ int texindex = 0;
+ for (i = 0; i < totfaces; i++) {
+ MFace *f = &mfaces[i];
+
+ if (f->mat_nr == material_index) {
+
+ unsigned int *v = &f->v1;
+ unsigned int *n = &norind[i].v1;
+ for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) {
+ polylist.appendValues(v[j]);
+ polylist.appendValues(n[j]);
+
+ if (has_uvs)
+ polylist.appendValues(texindex + j);
+
+ if (has_color)
+ polylist.appendValues(texindex + j);
+ }
+ }
+
+ texindex += 3;
+ if (f->v4 != 0)
+ texindex++;
+ }
+
+ polylist.finish();
+}
+
+// creates <source> for positions
+void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
+{
+#if 0
+ int totverts = dm->getNumVerts(dm);
+ MVert *verts = dm->getVertArray(dm);
+#endif
+ int totverts = me->totvert;
+ MVert *verts = me->mvert;
+
+ COLLADASW::FloatSourceF source(mSW);
+ source.setId(getIdBySemantics(geom_id, COLLADASW::POSITION));
+ source.setArrayId(getIdBySemantics(geom_id, COLLADASW::POSITION) +
+ ARRAY_ID_SUFFIX);
+ source.setAccessorCount(totverts);
+ source.setAccessorStride(3);
+ COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+ param.push_back("X");
+ param.push_back("Y");
+ param.push_back("Z");
+ /*main function, it creates <source id = "">, <float_array id = ""
+ count = ""> */
+ source.prepareToAppendValues();
+ //appends data to <float_array>
+ int i = 0;
+ for (i = 0; i < totverts; i++) {
+ source.appendValues(verts[i].co[0], verts[i].co[1], verts[i].co[2]);
+ }
+
+ source.finish();
+
+}
+
+void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *me)
+{
+ if (!CustomData_has_layer(&me->fdata, CD_MCOL))
+ return;
+
+ MFace *f;
+ int totcolor = 0, i, j;
+
+ for (i = 0, f = me->mface; i < me->totface; i++, f++)
+ totcolor += f->v4 ? 4 : 3;
+
+ COLLADASW::FloatSourceF source(mSW);
+ source.setId(getIdBySemantics(geom_id, COLLADASW::COLOR));
+ source.setArrayId(getIdBySemantics(geom_id, COLLADASW::COLOR) + ARRAY_ID_SUFFIX);
+ source.setAccessorCount(totcolor);
+ source.setAccessorStride(3);
+
+ COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+ param.push_back("R");
+ param.push_back("G");
+ param.push_back("B");
+
+ source.prepareToAppendValues();
+
+ int index = CustomData_get_active_layer_index(&me->fdata, CD_MCOL);
+
+ MCol *mcol = (MCol*)me->fdata.layers[index].data;
+ MCol *c = mcol;
+
+ for (i = 0, f = me->mface; i < me->totface; i++, c += 4, f++)
+ for (j = 0; j < (f->v4 ? 4 : 3); j++)
+ source.appendValues(c[j].b / 255.0f, c[j].g / 255.0f, c[j].r / 255.0f);
+
+ source.finish();
+}
+
+std::string GeometryExporter::makeTexcoordSourceId(std::string& geom_id, int layer_index)
+{
+ char suffix[20];
+ sprintf(suffix, "-%d", layer_index);
+ return getIdBySemantics(geom_id, COLLADASW::TEXCOORD) + suffix;
+}
+
+//creates <source> for texcoords
+void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
+{
+#if 0
+ int totfaces = dm->getNumFaces(dm);
+ MFace *mfaces = dm->getFaceArray(dm);
+#endif
+ int totfaces = me->totface;
+ MFace *mfaces = me->mface;
+
+ int totuv = 0;
+ int i;
+
+ // count totuv
+ for (i = 0; i < totfaces; i++) {
+ MFace *f = &mfaces[i];
+ if (f->v4 == 0) {
+ totuv+=3;
+ }
+ else {
+ totuv+=4;
+ }
+ }
+
+ int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
+
+ // write <source> for each layer
+ // each <source> will get id like meshName + "map-channel-1"
+ for (int a = 0; a < num_layers; a++) {
+ MTFace *tface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
+ // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a);
+
+ COLLADASW::FloatSourceF source(mSW);
+ std::string layer_id = makeTexcoordSourceId(geom_id, a);
+ source.setId(layer_id);
+ source.setArrayId(layer_id + ARRAY_ID_SUFFIX);
+
+ source.setAccessorCount(totuv);
+ source.setAccessorStride(2);
+ COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+ param.push_back("S");
+ param.push_back("T");
+
+ source.prepareToAppendValues();
+
+ for (i = 0; i < totfaces; i++) {
+ MFace *f = &mfaces[i];
+
+ for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) {
+ source.appendValues(tface[i].uv[j][0],
+ tface[i].uv[j][1]);
+ }
+ }
+
+ source.finish();
+ }
+}
+
+
+//creates <source> for normals
+void GeometryExporter::createNormalsSource(std::string geom_id, Mesh *me, std::vector<Normal>& nor)
+{
+#if 0
+ int totverts = dm->getNumVerts(dm);
+ MVert *verts = dm->getVertArray(dm);
+#endif
+
+ COLLADASW::FloatSourceF source(mSW);
+ source.setId(getIdBySemantics(geom_id, COLLADASW::NORMAL));
+ source.setArrayId(getIdBySemantics(geom_id, COLLADASW::NORMAL) +
+ ARRAY_ID_SUFFIX);
+ source.setAccessorCount((unsigned long)nor.size());
+ source.setAccessorStride(3);
+ COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+ param.push_back("X");
+ param.push_back("Y");
+ param.push_back("Z");
+
+ source.prepareToAppendValues();
+
+ std::vector<Normal>::iterator it;
+ for (it = nor.begin(); it != nor.end(); it++) {
+ Normal& n = *it;
+ source.appendValues(n.x, n.y, n.z);
+ }
+
+ source.finish();
+}
+
+void GeometryExporter::create_normals(std::vector<Normal> &nor, std::vector<Face> &ind, Mesh *me)
+{
+ int i, j, v;
+ MVert *vert = me->mvert;
+ std::map<unsigned int, unsigned int> nshar;
+
+ for (i = 0; i < me->totface; i++) {
+ MFace *fa = &me->mface[i];
+ Face f;
+ unsigned int *nn = &f.v1;
+ unsigned int *vv = &fa->v1;
+
+ memset(&f, 0, sizeof(f));
+ v = fa->v4 == 0 ? 3 : 4;
+
+ if (!(fa->flag & ME_SMOOTH)) {
+ Normal n;
+ if (v == 4)
+ normal_quad_v3(&n.x, vert[fa->v1].co, vert[fa->v2].co, vert[fa->v3].co, vert[fa->v4].co);
+ else
+ normal_tri_v3(&n.x, vert[fa->v1].co, vert[fa->v2].co, vert[fa->v3].co);
+ nor.push_back(n);
+ }
+
+ for (j = 0; j < v; j++) {
+ if (fa->flag & ME_SMOOTH) {
+ if (nshar.find(*vv) != nshar.end())
+ *nn = nshar[*vv];
+ else {
+ Normal n = {
+ vert[*vv].no[0]/32767.0,
+ vert[*vv].no[1]/32767.0,
+ vert[*vv].no[2]/32767.0
+ };
+ nor.push_back(n);
+ *nn = (unsigned int)nor.size() - 1;
+ nshar[*vv] = *nn;
+ }
+ vv++;
+ }
+ else {
+ *nn = (unsigned int)nor.size() - 1;
+ }
+ nn++;
+ }
+
+ ind.push_back(f);
+ }
+}
+
+std::string GeometryExporter::getIdBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix) {
+ return geom_id + getSuffixBySemantic(type) + other_suffix;
+}
+
+
+COLLADASW::URI GeometryExporter::getUrlBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix) {
+
+ std::string id(getIdBySemantics(geom_id, type, other_suffix));
+ return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id);
+
+}
+
+COLLADASW::URI GeometryExporter::makeUrl(std::string id)
+{
+ return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id);
+}
+
+
+/* int GeometryExporter::getTriCount(MFace *faces, int totface) {
+ int i;
+ int tris = 0;
+ for (i = 0; i < totface; i++) {
+ // if quad
+ if (faces[i].v4 != 0)
+ tris += 2;
+ else
+ tris++;
+ }
+
+ return tris;
+ }*/
diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h
new file mode 100644
index 00000000000..7a78b676f49
--- /dev/null
+++ b/source/blender/collada/GeometryExporter.h
@@ -0,0 +1,114 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __GEOMETRYEXPORTER_H__
+#define __GEOMETRYEXPORTER_H__
+
+#include <string>
+#include <vector>
+
+#include "COLLADASWStreamWriter.h"
+#include "COLLADASWLibraryGeometries.h"
+#include "COLLADASWInputList.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+// TODO: optimize UV sets by making indexed list with duplicates removed
+class GeometryExporter : COLLADASW::LibraryGeometries
+{
+ struct Face
+ {
+ unsigned int v1, v2, v3, v4;
+ };
+
+ struct Normal
+ {
+ float x, y, z;
+ };
+
+ Scene *mScene;
+
+public:
+ GeometryExporter(COLLADASW::StreamWriter *sw);
+
+ void exportGeom(Scene *sce);
+
+ void operator()(Object *ob);
+
+ // powerful because it handles both cases when there is material and when there's not
+ void createPolylist(int material_index,
+ bool has_uvs,
+ bool has_color,
+ Object *ob,
+ std::string& geom_id,
+ std::vector<Face>& norind);
+
+ // creates <source> for positions
+ void createVertsSource(std::string geom_id, Mesh *me);
+
+ void createVertexColorSource(std::string geom_id, Mesh *me);
+
+ std::string makeTexcoordSourceId(std::string& geom_id, int layer_index);
+
+ //creates <source> for texcoords
+ void createTexcoordsSource(std::string geom_id, Mesh *me);
+
+ //creates <source> for normals
+ void createNormalsSource(std::string geom_id, Mesh *me, std::vector<Normal>& nor);
+
+ void create_normals(std::vector<Normal> &nor, std::vector<Face> &ind, Mesh *me);
+
+ std::string getIdBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix = "");
+
+ COLLADASW::URI getUrlBySemantics(std::string geom_id, COLLADASW::Semantics type, std::string other_suffix = "");
+
+ COLLADASW::URI makeUrl(std::string id);
+
+ /* int getTriCount(MFace *faces, int totface);*/
+};
+
+struct GeometryFunctor {
+ // f should have
+ // void operator()(Object* ob)
+ template<class Functor>
+ void forEachMeshObjectInScene(Scene *sce, Functor &f)
+ {
+
+ Base *base= (Base*) sce->base.first;
+ while(base) {
+ Object *ob = base->object;
+
+ if (ob->type == OB_MESH && ob->data) {
+ f(ob);
+ }
+ base= base->next;
+
+ }
+ }
+};
+
+#endif
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
new file mode 100644
index 00000000000..3194b2269ea
--- /dev/null
+++ b/source/blender/collada/ImageExporter.cpp
@@ -0,0 +1,94 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "COLLADABUURI.h"
+#include "COLLADASWImage.h"
+
+#include "ImageExporter.h"
+#include "MaterialExporter.h"
+
+#include "DNA_texture_types.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_utildefines.h"
+#include "BLI_fileops.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+
+ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename) : COLLADASW::LibraryImages(sw), mfilename(filename)
+{}
+
+void ImagesExporter::exportImages(Scene *sce)
+{
+ openLibrary();
+ MaterialFunctor mf;
+ mf.forEachMaterialInScene<ImagesExporter>(sce, *this);
+
+ closeLibrary();
+}
+
+void ImagesExporter::operator()(Material *ma, Object *ob)
+{
+ int a;
+ for (a = 0; a < MAX_MTEX; a++) {
+ MTex *mtex = ma->mtex[a];
+ if (mtex && mtex->tex && mtex->tex->ima) {
+
+ Image *image = mtex->tex->ima;
+ std::string name(id_name(image));
+ name = translate_id(name);
+ char rel[FILE_MAX];
+ char abs[FILE_MAX];
+ char src[FILE_MAX];
+ char dir[FILE_MAX];
+
+ BLI_split_dirfile(mfilename, dir, NULL);
+
+ BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir);
+
+ if (abs[0] != '\0') {
+
+ // make absolute source path
+ BLI_strncpy(src, image->name, sizeof(src));
+ BLI_path_abs(src, G.main->name);
+
+ // make dest directory if it doesn't exist
+ BLI_make_existing_file(abs);
+
+ if (BLI_copy_fileops(src, abs) != 0) {
+ fprintf(stderr, "Cannot copy image to file's directory. \n");
+ }
+ }
+
+ if (find(mImages.begin(), mImages.end(), name) == mImages.end()) {
+ COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(rel)), name);
+ img.add(mSW);
+
+ mImages.push_back(name);
+ }
+ }
+ }
+}
diff --git a/source/blender/collada/ImageExporter.h b/source/blender/collada/ImageExporter.h
new file mode 100644
index 00000000000..13854d00730
--- /dev/null
+++ b/source/blender/collada/ImageExporter.h
@@ -0,0 +1,50 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __IMAGEEXPORTER_H__
+#define __IMAGEEXPORTER_H__
+
+#include <vector>
+#include <string>
+
+#include "COLLADASWStreamWriter.h"
+#include "COLLADASWLibraryImages.h"
+
+#include "DNA_material_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+class ImagesExporter: COLLADASW::LibraryImages
+{
+ const char *mfilename;
+ std::vector<std::string> mImages; // contains list of written images, to avoid duplicates
+public:
+ ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename);
+
+ void exportImages(Scene *sce);
+ void operator()(Material *ma, Object *ob);
+};
+
+#endif
diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp
new file mode 100644
index 00000000000..746f41fac00
--- /dev/null
+++ b/source/blender/collada/InstanceWriter.cpp
@@ -0,0 +1,64 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string>
+
+#include "COLLADASWInstanceMaterial.h"
+
+#include "BKE_customdata.h"
+#include "BKE_material.h"
+
+#include "DNA_mesh_types.h"
+
+#include "InstanceWriter.h"
+
+#include "collada_internal.h"
+#include "collada_utils.h"
+
+void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob)
+{
+ for(int a = 0; a < ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a+1);
+
+ COLLADASW::InstanceMaterialList& iml = bind_material.getInstanceMaterialList();
+
+ if (ma) {
+ std::string matid(id_name(ma));
+ matid = translate_id(matid);
+ COLLADASW::InstanceMaterial im(matid, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
+
+ // create <bind_vertex_input> for each uv layer
+ Mesh *me = (Mesh*)ob->data;
+ int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
+
+ for (int b = 0; b < totlayer; b++) {
+ char *name = bc_CustomData_get_layer_name(&me->fdata, CD_MTFACE, b);
+ im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", b));
+ }
+
+ iml.push_back(im);
+ }
+ }
+}
diff --git a/source/blender/collada/InstanceWriter.h b/source/blender/collada/InstanceWriter.h
new file mode 100644
index 00000000000..810bd04c7de
--- /dev/null
+++ b/source/blender/collada/InstanceWriter.h
@@ -0,0 +1,39 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __INSTANCEWRITER_H__
+#define __INSTANCEWRITER_H__
+
+#include "COLLADASWBindMaterial.h"
+
+#include "DNA_object_types.h"
+
+class InstanceWriter
+{
+protected:
+ void add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob);
+};
+
+#endif
diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
new file mode 100644
index 00000000000..5786c682d6a
--- /dev/null
+++ b/source/blender/collada/LightExporter.cpp
@@ -0,0 +1,139 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string>
+
+#include "COLLADASWColor.h"
+#include "COLLADASWLight.h"
+
+#include "DNA_lamp_types.h"
+
+#include "BLI_math.h"
+
+#include "LightExporter.h"
+#include "collada_internal.h"
+
+template<class Functor>
+void forEachLampObjectInScene(Scene *sce, Functor &f)
+{
+ Base *base= (Base*) sce->base.first;
+ while(base) {
+ Object *ob = base->object;
+
+ if (ob->type == OB_LAMP && ob->data) {
+ f(ob);
+ }
+ base= base->next;
+ }
+}
+
+LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryLights(sw){}
+
+void LightsExporter::exportLights(Scene *sce)
+{
+ openLibrary();
+
+ forEachLampObjectInScene(sce, *this);
+
+ closeLibrary();
+}
+void LightsExporter::operator()(Object *ob)
+{
+ Lamp *la = (Lamp*)ob->data;
+ std::string la_id(get_light_id(ob));
+ std::string la_name(id_name(la));
+ COLLADASW::Color col(la->r, la->g, la->b);
+ float att1, att2;
+ float e, d, constatt, linatt, quadatt;
+ att1 = att2 = 0.0f;
+
+ if(la->falloff_type==LA_FALLOFF_INVLINEAR) {
+ att1 = 1.0f;
+ att2 = 0.0f;
+ }
+ else if(la->falloff_type==LA_FALLOFF_INVSQUARE) {
+ att1 = 0.0f;
+ att2 = 1.0f;
+ }
+ else if(la->falloff_type==LA_FALLOFF_SLIDERS) {
+ att1 = la->att1;
+ att2 = la->att2;
+ }
+
+ e = la->energy;
+ d = la->dist;
+
+ constatt = linatt = quadatt = MAXFLOAT;
+ if(e > 0.0f) {
+ constatt = 1.0f/e;
+ linatt = att1/(d*e);
+ quadatt = att2/(d*d*(e*2));
+ }
+
+ // sun
+ if (la->type == LA_SUN) {
+ COLLADASW::DirectionalLight cla(mSW, la_id, la_name, e);
+ cla.setColor(col);
+ cla.setConstantAttenuation(constatt);
+ addLight(cla);
+ }
+ // hemi
+ else if (la->type == LA_HEMI) {
+ COLLADASW::AmbientLight cla(mSW, la_id, la_name, e);
+ cla.setColor(col);
+ cla.setConstantAttenuation(constatt);
+ addLight(cla);
+ }
+ // spot
+ else if (la->type == LA_SPOT) {
+ COLLADASW::SpotLight cla(mSW, la_id, la_name, e);
+ cla.setColor(col);
+ cla.setFallOffAngle(la->spotsize);
+ cla.setFallOffExponent(la->spotblend);
+ cla.setConstantAttenuation(constatt);
+ cla.setLinearAttenuation(linatt);
+ cla.setQuadraticAttenuation(quadatt);
+ addLight(cla);
+ }
+ // lamp
+ else if (la->type == LA_LOCAL) {
+ COLLADASW::PointLight cla(mSW, la_id, la_name, e);
+ cla.setColor(col);
+ cla.setConstantAttenuation(constatt);
+ cla.setLinearAttenuation(linatt);
+ cla.setQuadraticAttenuation(quadatt);
+ addLight(cla);
+ }
+ // area lamp is not supported
+ // it will be exported as a local lamp
+ else {
+ COLLADASW::PointLight cla(mSW, la_id, la_name, e);
+ cla.setColor(col);
+ cla.setConstantAttenuation(constatt);
+ cla.setLinearAttenuation(linatt);
+ cla.setQuadraticAttenuation(quadatt);
+ addLight(cla);
+ }
+}
diff --git a/source/blender/collada/LightExporter.h b/source/blender/collada/LightExporter.h
new file mode 100644
index 00000000000..3a4a481e471
--- /dev/null
+++ b/source/blender/collada/LightExporter.h
@@ -0,0 +1,43 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __LIGHTEXPORTER_H__
+#define __LIGHTEXPORTER_H__
+
+#include "COLLADASWStreamWriter.h"
+#include "COLLADASWLibraryLights.h"
+
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+class LightsExporter: COLLADASW::LibraryLights
+{
+public:
+ LightsExporter(COLLADASW::StreamWriter *sw);
+ void exportLights(Scene *sce);
+ void operator()(Object *ob);
+};
+
+#endif
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp
new file mode 100644
index 00000000000..d155b2196ff
--- /dev/null
+++ b/source/blender/collada/MaterialExporter.cpp
@@ -0,0 +1,53 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "COLLADABUUtils.h"
+
+#include "MaterialExporter.h"
+#include "collada_internal.h"
+
+MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryMaterials(sw){}
+
+void MaterialsExporter::exportMaterials(Scene *sce)
+{
+ openLibrary();
+
+ MaterialFunctor mf;
+ mf.forEachMaterialInScene<MaterialsExporter>(sce, *this);
+
+ closeLibrary();
+}
+
+void MaterialsExporter::operator()(Material *ma, Object *ob)
+{
+ std::string name(id_name(ma));
+
+ openMaterial(translate_id(name), name);
+
+ std::string efid = translate_id(name) + "-effect";
+ addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid));
+
+ closeMaterial();
+}
diff --git a/source/blender/collada/MaterialExporter.h b/source/blender/collada/MaterialExporter.h
new file mode 100644
index 00000000000..2138d26e6a8
--- /dev/null
+++ b/source/blender/collada/MaterialExporter.h
@@ -0,0 +1,94 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __MATERIALEXPORTER_H__
+#define __MATERIALEXPORTER_H__
+
+#include <string>
+#include <vector>
+
+#include "COLLADASWLibraryMaterials.h"
+#include "COLLADASWStreamWriter.h"
+
+#include "BKE_material.h"
+
+#include "DNA_material_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "GeometryExporter.h"
+#include "collada_internal.h"
+
+class MaterialsExporter: COLLADASW::LibraryMaterials
+{
+public:
+ MaterialsExporter(COLLADASW::StreamWriter *sw);
+ void exportMaterials(Scene *sce);
+ void operator()(Material *ma, Object *ob);
+};
+
+// used in forEachMaterialInScene
+template <class Functor>
+class ForEachMaterialFunctor
+{
+ std::vector<std::string> mMat; // contains list of material names, to avoid duplicate calling of f
+ Functor *f;
+public:
+ ForEachMaterialFunctor(Functor*f) : f(f) {}
+
+ void operator ()(Object *ob)
+ {
+ int a;
+ for(a = 0; a < ob->totcol; a++) {
+
+ Material *ma = give_current_material(ob, a+1);
+
+ if (!ma) continue;
+
+ std::string translated_id = translate_id(id_name(ma));
+ if (find(mMat.begin(), mMat.end(), translated_id) == mMat.end()) {
+ (*this->f)(ma, ob);
+
+ mMat.push_back(translated_id);
+ }
+ }
+ }
+};
+
+struct MaterialFunctor {
+ // calls f for each unique material linked to each object in sce
+ // f should have
+ // void operator()(Material* ma)
+ template<class Functor>
+ void forEachMaterialInScene(Scene *sce, Functor &f)
+ {
+ ForEachMaterialFunctor<Functor> matfunc(&f);
+ GeometryFunctor gf;
+ gf.forEachMeshObjectInScene<ForEachMaterialFunctor<Functor> >(sce, matfunc);
+ }
+};
+
+
+#endif
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
new file mode 100644
index 00000000000..be7abc3ec4e
--- /dev/null
+++ b/source/blender/collada/MeshImporter.cpp
@@ -0,0 +1,912 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <algorithm>
+
+#if !defined(WIN32) || defined(FREE_WINDOWS)
+#include <iostream>
+#endif
+
+#include "COLLADAFWMeshPrimitive.h"
+#include "COLLADAFWMeshVertexData.h"
+#include "COLLADAFWPolygons.h"
+
+extern "C" {
+#include "BKE_blender.h"
+#include "BKE_customdata.h"
+#include "BKE_displist.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_material.h"
+#include "BKE_mesh.h"
+#include "BKE_object.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_string.h"
+
+#include "MEM_guardedalloc.h"
+}
+
+#include "ArmatureImporter.h"
+#include "MeshImporter.h"
+#include "collada_utils.h"
+
+// works for COLLADAFW::Node, COLLADAFW::Geometry
+template<class T>
+static const char *bc_get_dae_name(T *node)
+{
+ const std::string& name = node->getName();
+ return name.size() ? name.c_str() : node->getOriginalId().c_str();
+}
+
+static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type)
+{
+ switch (type) {
+ case COLLADAFW::MeshPrimitive::LINES:
+ return "LINES";
+ case COLLADAFW::MeshPrimitive::LINE_STRIPS:
+ return "LINESTRIPS";
+ case COLLADAFW::MeshPrimitive::POLYGONS:
+ return "POLYGONS";
+ case COLLADAFW::MeshPrimitive::POLYLIST:
+ return "POLYLIST";
+ case COLLADAFW::MeshPrimitive::TRIANGLES:
+ return "TRIANGLES";
+ case COLLADAFW::MeshPrimitive::TRIANGLE_FANS:
+ return "TRIANGLE_FANS";
+ case COLLADAFW::MeshPrimitive::TRIANGLE_STRIPS:
+ return "TRIANGLE_FANS";
+ case COLLADAFW::MeshPrimitive::POINTS:
+ return "POINTS";
+ case COLLADAFW::MeshPrimitive::UNDEFINED_PRIMITIVE_TYPE:
+ return "UNDEFINED_PRIMITIVE_TYPE";
+ }
+ return "UNKNOWN";
+}
+
+static const char *bc_geomTypeToStr(COLLADAFW::Geometry::GeometryType type)
+{
+ switch (type) {
+ case COLLADAFW::Geometry::GEO_TYPE_MESH:
+ return "MESH";
+ case COLLADAFW::Geometry::GEO_TYPE_SPLINE:
+ return "SPLINE";
+ case COLLADAFW::Geometry::GEO_TYPE_CONVEX_MESH:
+ return "CONVEX_MESH";
+ case COLLADAFW::Geometry::GEO_TYPE_UNKNOWN:
+ default:
+ return "UNKNOWN";
+ }
+}
+
+
+UVDataWrapper::UVDataWrapper(COLLADAFW::MeshVertexData& vdata) : mVData(&vdata)
+{}
+
+#ifdef COLLADA_DEBUG
+void WVDataWrapper::print()
+{
+ fprintf(stderr, "UVs:\n");
+ switch(mVData->getType()) {
+ case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
+ {
+ COLLADAFW::ArrayPrimitiveType<float>* values = mVData->getFloatValues();
+ if (values->getCount()) {
+ for (int i = 0; i < values->getCount(); i += 2) {
+ fprintf(stderr, "%.1f, %.1f\n", (*values)[i], (*values)[i+1]);
+ }
+ }
+ }
+ break;
+ case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
+ {
+ COLLADAFW::ArrayPrimitiveType<double>* values = mVData->getDoubleValues();
+ if (values->getCount()) {
+ for (int i = 0; i < values->getCount(); i += 2) {
+ fprintf(stderr, "%.1f, %.1f\n", (float)(*values)[i], (float)(*values)[i+1]);
+ }
+ }
+ }
+ break;
+ }
+ fprintf(stderr, "\n");
+}
+#endif
+
+void UVDataWrapper::getUV(int uv_index[2], float *uv)
+{
+ switch(mVData->getType()) {
+ case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
+ {
+ COLLADAFW::ArrayPrimitiveType<float>* values = mVData->getFloatValues();
+ if (values->empty()) return;
+ uv[0] = (*values)[uv_index[0]];
+ uv[1] = (*values)[uv_index[1]];
+
+ }
+ break;
+ case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
+ {
+ COLLADAFW::ArrayPrimitiveType<double>* values = mVData->getDoubleValues();
+ if (values->empty()) return;
+ uv[0] = (float)(*values)[uv_index[0]];
+ uv[1] = (float)(*values)[uv_index[1]];
+
+ }
+ break;
+ case COLLADAFW::MeshVertexData::DATA_TYPE_UNKNOWN:
+ default:
+ fprintf(stderr, "MeshImporter.getUV(): unknown data type\n");
+ }
+}
+
+void MeshImporter::set_face_indices(MFace *mface, unsigned int *indices, bool quad)
+{
+ mface->v1 = indices[0];
+ mface->v2 = indices[1];
+ mface->v3 = indices[2];
+ if (quad) mface->v4 = indices[3];
+ else mface->v4 = 0;
+#ifdef COLLADA_DEBUG
+ // fprintf(stderr, "%u, %u, %u \n", indices[0], indices[1], indices[2]);
+#endif
+}
+
+// not used anymore, test_index_face from blenkernel is better
+#if 0
+// change face indices order so that v4 is not 0
+void MeshImporter::rotate_face_indices(MFace *mface) {
+ mface->v4 = mface->v1;
+ mface->v1 = mface->v2;
+ mface->v2 = mface->v3;
+ mface->v3 = 0;
+}
+#endif
+
+void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
+ COLLADAFW::IndexList& index_list, unsigned int *tris_indices)
+{
+ int uv_indices[4][2];
+
+ // per face vertex indices, this means for quad we have 4 indices, not 8
+ COLLADAFW::UIntValuesArray& indices = index_list.getIndices();
+
+ // make indices into FloatOrDoubleArray
+ for (int i = 0; i < 3; i++) {
+ int uv_index = indices[tris_indices[i]];
+ uv_indices[i][0] = uv_index * 2;
+ uv_indices[i][1] = uv_index * 2 + 1;
+ }
+
+ uvs.getUV(uv_indices[0], mtface->uv[0]);
+ uvs.getUV(uv_indices[1], mtface->uv[1]);
+ uvs.getUV(uv_indices[2], mtface->uv[2]);
+}
+
+void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
+ COLLADAFW::IndexList& index_list, int index, bool quad)
+{
+ int uv_indices[4][2];
+
+ // per face vertex indices, this means for quad we have 4 indices, not 8
+ COLLADAFW::UIntValuesArray& indices = index_list.getIndices();
+
+ // make indices into FloatOrDoubleArray
+ for (int i = 0; i < (quad ? 4 : 3); i++) {
+ int uv_index = indices[index + i];
+ uv_indices[i][0] = uv_index * 2;
+ uv_indices[i][1] = uv_index * 2 + 1;
+ }
+
+ uvs.getUV(uv_indices[0], mtface->uv[0]);
+ uvs.getUV(uv_indices[1], mtface->uv[1]);
+ uvs.getUV(uv_indices[2], mtface->uv[2]);
+
+ if (quad) uvs.getUV(uv_indices[3], mtface->uv[3]);
+
+#ifdef COLLADA_DEBUG
+ /*if (quad) {
+ fprintf(stderr, "face uv:\n"
+ "((%d, %d), (%d, %d), (%d, %d), (%d, %d))\n"
+ "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
+
+ uv_indices[0][0], uv_indices[0][1],
+ uv_indices[1][0], uv_indices[1][1],
+ uv_indices[2][0], uv_indices[2][1],
+ uv_indices[3][0], uv_indices[3][1],
+
+ mtface->uv[0][0], mtface->uv[0][1],
+ mtface->uv[1][0], mtface->uv[1][1],
+ mtface->uv[2][0], mtface->uv[2][1],
+ mtface->uv[3][0], mtface->uv[3][1]);
+ }
+ else {
+ fprintf(stderr, "face uv:\n"
+ "((%d, %d), (%d, %d), (%d, %d))\n"
+ "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
+
+ uv_indices[0][0], uv_indices[0][1],
+ uv_indices[1][0], uv_indices[1][1],
+ uv_indices[2][0], uv_indices[2][1],
+
+ mtface->uv[0][0], mtface->uv[0][1],
+ mtface->uv[1][0], mtface->uv[1][1],
+ mtface->uv[2][0], mtface->uv[2][1]);
+ }*/
+#endif
+}
+
+#ifdef COLLADA_DEBUG
+void MeshImporter::print_index_list(COLLADAFW::IndexList& index_list)
+{
+ fprintf(stderr, "Index list for \"%s\":\n", index_list.getName().c_str());
+ for (int i = 0; i < index_list.getIndicesCount(); i += 2) {
+ fprintf(stderr, "%u, %u\n", index_list.getIndex(i), index_list.getIndex(i + 1));
+ }
+ fprintf(stderr, "\n");
+}
+#endif
+
+bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh)
+{
+ COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
+
+ const char *name = bc_get_dae_name(mesh);
+
+ for (unsigned i = 0; i < prim_arr.getCount(); i++) {
+
+ COLLADAFW::MeshPrimitive *mp = prim_arr[i];
+ COLLADAFW::MeshPrimitive::PrimitiveType type = mp->getPrimitiveType();
+
+ const char *type_str = bc_primTypeToStr(type);
+
+ // OpenCollada passes POLYGONS type for <polylist>
+ if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) {
+
+ COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
+ COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray();
+
+ for(unsigned int j = 0; j < vca.getCount(); j++){
+ int count = vca[j];
+ if (count < 3) {
+ fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n",
+ type_str, name);
+ return false;
+ }
+ }
+
+ }
+ else if(type != COLLADAFW::MeshPrimitive::TRIANGLES) {
+ fprintf(stderr, "Primitive type %s is not supported.\n", type_str);
+ return false;
+ }
+ }
+
+ if (mesh->getPositions().empty()) {
+ fprintf(stderr, "Mesh %s has no vertices.\n", name);
+ return false;
+ }
+
+ return true;
+}
+
+void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me)
+{
+ // vertices
+ me->totvert = mesh->getPositions().getFloatValues()->getCount() / 3;
+ me->mvert = (MVert*)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
+
+ COLLADAFW::MeshVertexData& pos = mesh->getPositions();
+ MVert *mvert;
+ int i;
+
+ for (i = 0, mvert = me->mvert; i < me->totvert; i++, mvert++) {
+ get_vector(mvert->co, pos, i);
+ }
+}
+
+int MeshImporter::triangulate_poly(unsigned int *indices, int totvert, MVert *verts, std::vector<unsigned int>& tri)
+{
+ ListBase dispbase;
+ DispList *dl;
+ float *vert;
+ int i = 0;
+
+ dispbase.first = dispbase.last = NULL;
+
+ dl = (DispList*)MEM_callocN(sizeof(DispList), "poly disp");
+ dl->nr = totvert;
+ dl->type = DL_POLY;
+ dl->parts = 1;
+ dl->verts = vert = (float*)MEM_callocN(totvert * 3 * sizeof(float), "poly verts");
+ dl->index = (int*)MEM_callocN(sizeof(int) * 3 * totvert, "dl index");
+
+ BLI_addtail(&dispbase, dl);
+
+ for (i = 0; i < totvert; i++) {
+ copy_v3_v3(vert, verts[indices[i]].co);
+ vert += 3;
+ }
+
+ filldisplist(&dispbase, &dispbase, 0);
+
+ int tottri = 0;
+ dl= (DispList*)dispbase.first;
+
+ if (dl->type == DL_INDEX3) {
+ tottri = dl->parts;
+
+ int *index = dl->index;
+ for (i= 0; i < tottri; i++) {
+ int t[3]= {*index, *(index + 1), *(index + 2)};
+
+ std::sort(t, t + 3);
+
+ tri.push_back(t[0]);
+ tri.push_back(t[1]);
+ tri.push_back(t[2]);
+
+ index += 3;
+ }
+ }
+
+ freedisplist(&dispbase);
+
+ return tottri;
+}
+
+int MeshImporter::count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me)
+{
+ COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
+ unsigned int i;
+ int tottri = 0;
+
+ for (i = 0; i < prim_arr.getCount(); i++) {
+
+ COLLADAFW::MeshPrimitive *mp = prim_arr[i];
+ int type = mp->getPrimitiveType();
+ size_t prim_totface = mp->getFaceCount();
+ unsigned int *indices = mp->getPositionIndices().getData();
+
+ if (type == COLLADAFW::MeshPrimitive::POLYLIST ||
+ type == COLLADAFW::MeshPrimitive::POLYGONS) {
+
+ COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
+ COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray();
+
+ for (unsigned int j = 0; j < prim_totface; j++) {
+ int vcount = vcounta[j];
+
+ if (vcount > 4) {
+ std::vector<unsigned int> tri;
+
+ // tottri += triangulate_poly(indices, vcount, me->mvert, tri) - 1; // XXX why - 1?!
+ tottri += triangulate_poly(indices, vcount, me->mvert, tri);
+ }
+
+ indices += vcount;
+ }
+ }
+ }
+ return tottri;
+}
+
+// TODO: import uv set names
+void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris)
+{
+ unsigned int i;
+
+ // allocate faces
+ me->totface = mesh->getFacesCount() + new_tris;
+ me->mface = (MFace*)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
+
+ // allocate UV layers
+ unsigned int totuvset = mesh->getUVCoords().getInputInfosArray().getCount();
+
+ for (i = 0; i < totuvset; i++) {
+ if (mesh->getUVCoords().getLength(i) == 0) {
+ totuvset = 0;
+ break;
+ }
+ }
+
+ for (i = 0; i < totuvset; i++) {
+ COLLADAFW::MeshVertexData::InputInfos *info = mesh->getUVCoords().getInputInfosArray()[i];
+ CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface, info->mName.c_str());
+ //this->set_layername_map[i] = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
+ }
+
+ // activate the first uv layer
+ if (totuvset) me->mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, 0);
+
+ UVDataWrapper uvs(mesh->getUVCoords());
+
+#ifdef COLLADA_DEBUG
+ // uvs.print();
+#endif
+
+ MFace *mface = me->mface;
+
+ MaterialIdPrimitiveArrayMap mat_prim_map;
+
+ int face_index = 0;
+
+ COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
+
+ bool has_normals = mesh->hasNormals();
+ COLLADAFW::MeshVertexData& nor = mesh->getNormals();
+
+ for (i = 0; i < prim_arr.getCount(); i++) {
+
+ COLLADAFW::MeshPrimitive *mp = prim_arr[i];
+
+ // faces
+ size_t prim_totface = mp->getFaceCount();
+ unsigned int *indices = mp->getPositionIndices().getData();
+ unsigned int *nind = mp->getNormalIndices().getData();
+ unsigned int j, k;
+ int type = mp->getPrimitiveType();
+ int index = 0;
+
+ // since we cannot set mface->mat_nr here, we store a portion of me->mface in Primitive
+ Primitive prim = {mface, 0};
+ COLLADAFW::IndexListArray& index_list_array = mp->getUVCoordIndicesArray();
+
+#ifdef COLLADA_DEBUG
+ /*
+ fprintf(stderr, "Primitive %d:\n", i);
+ for (int j = 0; j < totuvset; j++) {
+ print_index_list(*index_list_array[j]);
+ }
+ */
+#endif
+
+ if (type == COLLADAFW::MeshPrimitive::TRIANGLES) {
+ for (j = 0; j < prim_totface; j++){
+
+ set_face_indices(mface, indices, false);
+ indices += 3;
+
+#if 0
+ for (k = 0; k < totuvset; k++) {
+ if (!index_list_array.empty() && index_list_array[k]) {
+ // get mtface by face index and uv set index
+ MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
+ set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, false);
+ }
+ }
+#else
+ for (k = 0; k < index_list_array.getCount(); k++) {
+ int uvset_index = index_list_array[k]->getSetIndex();
+
+ // get mtface by face index and uv set index
+ MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index);
+ set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, false);
+ }
+#endif
+
+ test_index_face(mface, &me->fdata, face_index, 3);
+
+ if (has_normals) {
+ if (!flat_face(nind, nor, 3))
+ mface->flag |= ME_SMOOTH;
+
+ nind += 3;
+ }
+
+ index += 3;
+ mface++;
+ face_index++;
+ prim.totface++;
+ }
+ }
+ else if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) {
+ COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
+ COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray();
+
+ for (j = 0; j < prim_totface; j++) {
+
+ // face
+ int vcount = vcounta[j];
+ if (vcount == 3 || vcount == 4) {
+
+ set_face_indices(mface, indices, vcount == 4);
+
+ // set mtface for each uv set
+ // it is assumed that all primitives have equal number of UV sets
+
+#if 0
+ for (k = 0; k < totuvset; k++) {
+ if (!index_list_array.empty() && index_list_array[k]) {
+ // get mtface by face index and uv set index
+ MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
+ set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, mface->v4 != 0);
+ }
+ }
+#else
+ for (k = 0; k < index_list_array.getCount(); k++) {
+ int uvset_index = index_list_array[k]->getSetIndex();
+
+ // get mtface by face index and uv set index
+ MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index);
+ set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, mface->v4 != 0);
+ }
+#endif
+
+ test_index_face(mface, &me->fdata, face_index, vcount);
+
+ if (has_normals) {
+ if (!flat_face(nind, nor, vcount))
+ mface->flag |= ME_SMOOTH;
+
+ nind += vcount;
+ }
+
+ mface++;
+ face_index++;
+ prim.totface++;
+
+ }
+ else {
+ std::vector<unsigned int> tri;
+
+ triangulate_poly(indices, vcount, me->mvert, tri);
+
+ for (k = 0; k < tri.size() / 3; k++) {
+ int v = k * 3;
+ unsigned int uv_indices[3] = {
+ index + tri[v],
+ index + tri[v + 1],
+ index + tri[v + 2]
+ };
+ unsigned int tri_indices[3] = {
+ indices[tri[v]],
+ indices[tri[v + 1]],
+ indices[tri[v + 2]]
+ };
+
+ set_face_indices(mface, tri_indices, false);
+
+#if 0
+ for (unsigned int l = 0; l < totuvset; l++) {
+ if (!index_list_array.empty() && index_list_array[l]) {
+ // get mtface by face index and uv set index
+ MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, l);
+ set_face_uv(&mtface[face_index], uvs, l, *index_list_array[l], uv_indices);
+ }
+ }
+#else
+ for (unsigned int l = 0; l < index_list_array.getCount(); l++) {
+ int uvset_index = index_list_array[l]->getSetIndex();
+
+ // get mtface by face index and uv set index
+ MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index);
+ set_face_uv(&mtface[face_index], uvs, *index_list_array[l], uv_indices);
+ }
+#endif
+
+
+ test_index_face(mface, &me->fdata, face_index, 3);
+
+ if (has_normals) {
+ unsigned int ntri[3] = {nind[tri[v]], nind[tri[v + 1]], nind[tri[v + 2]]};
+
+ if (!flat_face(ntri, nor, 3))
+ mface->flag |= ME_SMOOTH;
+ }
+
+ mface++;
+ face_index++;
+ prim.totface++;
+ }
+
+ if (has_normals)
+ nind += vcount;
+ }
+
+ index += vcount;
+ indices += vcount;
+ }
+ }
+
+ mat_prim_map[mp->getMaterialId()].push_back(prim);
+ }
+
+ geom_uid_mat_mapping_map[mesh->getUniqueId()] = mat_prim_map;
+}
+
+void MeshImporter::get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i)
+{
+ i *= 3;
+
+ switch(arr.getType()) {
+ case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
+ {
+ COLLADAFW::ArrayPrimitiveType<float>* values = arr.getFloatValues();
+ if (values->empty()) return;
+
+ v[0] = (*values)[i++];
+ v[1] = (*values)[i++];
+ v[2] = (*values)[i];
+ }
+ break;
+ case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
+ {
+ COLLADAFW::ArrayPrimitiveType<double>* values = arr.getDoubleValues();
+ if (values->empty()) return;
+
+ v[0] = (float)(*values)[i++];
+ v[1] = (float)(*values)[i++];
+ v[2] = (float)(*values)[i];
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+bool MeshImporter::flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, int count)
+{
+ float a[3], b[3];
+
+ get_vector(a, nor, *nind);
+ normalize_v3(a);
+
+ nind++;
+
+ for (int i = 1; i < count; i++, nind++) {
+ get_vector(b, nor, *nind);
+ normalize_v3(b);
+
+ float dp = dot_v3v3(a, b);
+
+ if (dp < 0.99999f || dp > 1.00001f)
+ return false;
+ }
+
+ return true;
+}
+
+MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce) : unitconverter(unitconv), scene(sce), armature_importer(arm) {}
+
+Object *MeshImporter::get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid)
+{
+ if (uid_object_map.find(geom_uid) != uid_object_map.end())
+ return uid_object_map[geom_uid];
+ return NULL;
+}
+
+MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture,
+ Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map,
+ MTex *color_texture)
+{
+ const COLLADAFW::TextureMapId texture_index = ctexture.getTextureMapId();
+ const size_t setindex = ctexture.getSetIndex();
+ std::string uvname = ctexture.getSemantic();
+
+ const CustomData *data = &me->fdata;
+ int layer_index = CustomData_get_layer_index(data, CD_MTFACE);
+ CustomDataLayer *cdl = &data->layers[layer_index+setindex];
+
+ /* set uvname to bind_vertex_input semantic */
+ BLI_strncpy(cdl->name, uvname.c_str(), sizeof(cdl->name));
+
+ if (texindex_texarray_map.find(texture_index) == texindex_texarray_map.end()) {
+
+ fprintf(stderr, "Cannot find texture array by texture index.\n");
+ return color_texture;
+ }
+
+ std::vector<MTex*> textures = texindex_texarray_map[texture_index];
+
+ std::vector<MTex*>::iterator it;
+
+ for (it = textures.begin(); it != textures.end(); it++) {
+
+ MTex *texture = *it;
+
+ if (texture) {
+ BLI_strncpy(texture->uvname, uvname.c_str(), sizeof(texture->uvname));
+ if (texture->mapto == MAP_COL) color_texture = texture;
+ }
+ }
+ return color_texture;
+}
+
+MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial,
+ std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
+ Object *ob, const COLLADAFW::UniqueId *geom_uid,
+ MTex **color_texture, char *layername, MTFace *texture_face,
+ std::map<Material*, TexIndexTextureArrayMap>& material_texture_mapping_map, int mat_index)
+{
+ Mesh *me = (Mesh*)ob->data;
+ const COLLADAFW::UniqueId& ma_uid = cmaterial.getReferencedMaterial();
+
+ // do we know this material?
+ if (uid_material_map.find(ma_uid) == uid_material_map.end()) {
+
+ fprintf(stderr, "Cannot find material by UID.\n");
+ return NULL;
+ }
+
+ Material *ma = uid_material_map[ma_uid];
+ assign_material(ob, ma, ob->totcol + 1);
+
+ COLLADAFW::TextureCoordinateBindingArray& tex_array =
+ cmaterial.getTextureCoordinateBindingArray();
+ TexIndexTextureArrayMap texindex_texarray_map = material_texture_mapping_map[ma];
+ unsigned int i;
+ // loop through <bind_vertex_inputs>
+ for (i = 0; i < tex_array.getCount(); i++) {
+
+ *color_texture = assign_textures_to_uvlayer(tex_array[i], me, texindex_texarray_map,
+ *color_texture);
+ }
+
+ // set texture face
+ if (*color_texture &&
+ strlen((*color_texture)->uvname) &&
+ strcmp(layername, (*color_texture)->uvname) != 0) {
+
+ texture_face = (MTFace*)CustomData_get_layer_named(&me->fdata, CD_MTFACE,
+ (*color_texture)->uvname);
+ strcpy(layername, (*color_texture)->uvname);
+ }
+
+ MaterialIdPrimitiveArrayMap& mat_prim_map = geom_uid_mat_mapping_map[*geom_uid];
+ COLLADAFW::MaterialId mat_id = cmaterial.getMaterialId();
+
+ // assign material indices to mesh faces
+ if (mat_prim_map.find(mat_id) != mat_prim_map.end()) {
+
+ std::vector<Primitive>& prims = mat_prim_map[mat_id];
+
+ std::vector<Primitive>::iterator it;
+
+ for (it = prims.begin(); it != prims.end(); it++) {
+ Primitive& prim = *it;
+ i = 0;
+ while (i++ < prim.totface) {
+ prim.mface->mat_nr = mat_index;
+ prim.mface++;
+ // bind texture images to faces
+ if (texture_face && (*color_texture)) {
+ texture_face->mode = TF_TEX;
+ texture_face->tpage = (Image*)(*color_texture)->tex->ima;
+ texture_face++;
+ }
+ }
+ }
+ }
+
+ return texture_face;
+}
+
+
+Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom,
+ bool isController,
+ std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
+ std::map<Material*, TexIndexTextureArrayMap>& material_texture_mapping_map)
+{
+ const COLLADAFW::UniqueId *geom_uid = &geom->getInstanciatedObjectId();
+
+ // check if node instanciates controller or geometry
+ if (isController) {
+
+ geom_uid = armature_importer->get_geometry_uid(*geom_uid);
+
+ if (!geom_uid) {
+ fprintf(stderr, "Couldn't find a mesh UID by controller's UID.\n");
+ return NULL;
+ }
+ }
+ else {
+
+ if (uid_mesh_map.find(*geom_uid) == uid_mesh_map.end()) {
+ // this could happen if a mesh was not created
+ // (e.g. if it contains unsupported geometry)
+ fprintf(stderr, "Couldn't find a mesh by UID.\n");
+ return NULL;
+ }
+ }
+ if (!uid_mesh_map[*geom_uid]) return NULL;
+
+ Object *ob = add_object(scene, OB_MESH);
+
+ // store object pointer for ArmatureImporter
+ uid_object_map[*geom_uid] = ob;
+
+ // name Object
+ const std::string& id = node->getOriginalId();
+ if (id.length())
+ rename_id(&ob->id, (char*)id.c_str());
+
+ // replace ob->data freeing the old one
+ Mesh *old_mesh = (Mesh*)ob->data;
+
+ set_mesh(ob, uid_mesh_map[*geom_uid]);
+
+ if (old_mesh->id.us == 0) free_libblock(&G.main->mesh, old_mesh);
+
+ char layername[100];
+ MTFace *texture_face = NULL;
+ MTex *color_texture = NULL;
+
+ COLLADAFW::MaterialBindingArray& mat_array =
+ geom->getMaterialBindings();
+
+ // loop through geom's materials
+ for (unsigned int i = 0; i < mat_array.getCount(); i++) {
+
+ texture_face = assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid,
+ &color_texture, layername, texture_face,
+ material_texture_mapping_map, i);
+ }
+
+ return ob;
+}
+
+// create a mesh storing a pointer in a map so it can be retrieved later by geometry UID
+bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
+{
+ // TODO: import also uvs, normals
+ // XXX what to do with normal indices?
+ // XXX num_normals may be != num verts, then what to do?
+
+ // check geometry->getType() first
+ if (geom->getType() != COLLADAFW::Geometry::GEO_TYPE_MESH) {
+ // TODO: report warning
+ fprintf(stderr, "Mesh type %s is not supported\n", bc_geomTypeToStr(geom->getType()));
+ return true;
+ }
+
+ COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh*)geom;
+
+ if (!is_nice_mesh(mesh)) {
+ fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh));
+ return true;
+ }
+
+ const std::string& str_geom_id = mesh->getOriginalId();
+ Mesh *me = add_mesh((char*)str_geom_id.c_str());
+
+ // store the Mesh pointer to link it later with an Object
+ this->uid_mesh_map[mesh->getUniqueId()] = me;
+
+ int new_tris = 0;
+
+ read_vertices(mesh, me);
+
+ new_tris = count_new_tris(mesh, me);
+
+ read_faces(mesh, me, new_tris);
+
+ make_edges(me, 0);
+
+ mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+
+ return true;
+}
diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h
new file mode 100644
index 00000000000..055c4798855
--- /dev/null
+++ b/source/blender/collada/MeshImporter.h
@@ -0,0 +1,152 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BC__MESHIMPORTER_H__
+#define __BC__MESHIMPORTER_H__
+
+#include <map>
+#include <vector>
+
+#include "COLLADAFWIndexList.h"
+#include "COLLADAFWInstanceGeometry.h"
+#include "COLLADAFWMaterialBinding.h"
+#include "COLLADAFWMesh.h"
+#include "COLLADAFWMeshVertexData.h"
+#include "COLLADAFWNode.h"
+#include "COLLADAFWTextureCoordinateBinding.h"
+#include "COLLADAFWTypes.h"
+#include "COLLADAFWUniqueId.h"
+
+#include "DNA_material_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_texture_types.h"
+
+#include "ArmatureImporter.h"
+#include "collada_utils.h"
+
+// only for ArmatureImporter to "see" MeshImporter::get_object_by_geom_uid
+class MeshImporterBase
+{
+public:
+ virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) = 0;
+};
+
+class UVDataWrapper
+{
+ COLLADAFW::MeshVertexData *mVData;
+public:
+ UVDataWrapper(COLLADAFW::MeshVertexData& vdata);
+
+#ifdef COLLADA_DEBUG
+ void print();
+#endif
+
+ void getUV(int uv_index[2], float *uv);
+};
+
+class MeshImporter : public MeshImporterBase
+{
+private:
+
+ Scene *scene;
+ ArmatureImporter *armature_importer;
+
+ std::map<COLLADAFW::UniqueId, Mesh*> uid_mesh_map; // geometry unique id-to-mesh map
+ std::map<COLLADAFW::UniqueId, Object*> uid_object_map; // geom uid-to-object
+ // this structure is used to assign material indices to faces
+ // it holds a portion of Mesh faces and corresponds to a DAE primitive list (<triangles>, <polylist>, etc.)
+ struct Primitive {
+ MFace *mface;
+ unsigned int totface;
+ };
+ typedef std::map<COLLADAFW::MaterialId, std::vector<Primitive> > MaterialIdPrimitiveArrayMap;
+ std::map<COLLADAFW::UniqueId, MaterialIdPrimitiveArrayMap> geom_uid_mat_mapping_map; // crazy name!
+
+
+ void set_face_indices(MFace *mface, unsigned int *indices, bool quad);
+
+ // not used anymore, test_index_face from blenkernel is better
+#if 0
+ // change face indices order so that v4 is not 0
+ void rotate_face_indices(MFace *mface);
+#endif
+
+ void set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
+ COLLADAFW::IndexList& index_list, unsigned int *tris_indices);
+
+ void set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
+ COLLADAFW::IndexList& index_list, int index, bool quad);
+
+#ifdef COLLADA_DEBUG
+ void print_index_list(COLLADAFW::IndexList& index_list);
+#endif
+
+ bool is_nice_mesh(COLLADAFW::Mesh *mesh);
+
+ void read_vertices(COLLADAFW::Mesh *mesh, Mesh *me);
+
+ int triangulate_poly(unsigned int *indices, int totvert, MVert *verts, std::vector<unsigned int>& tri);
+
+ int count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me);
+
+ // TODO: import uv set names
+ void read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
+
+ void get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i);
+
+ bool flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor, int count);
+
+ UnitConverter *unitconverter;
+
+public:
+
+ MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce);
+
+ virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid);
+
+ MTex *assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture,
+ Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map,
+ MTex *color_texture);
+
+ MTFace *assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial,
+ std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
+ Object *ob, const COLLADAFW::UniqueId *geom_uid,
+ MTex **color_texture, char *layername, MTFace *texture_face,
+ std::map<Material*, TexIndexTextureArrayMap>& material_texture_mapping_map, int mat_index);
+
+
+ Object *create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom,
+ bool isController,
+ std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
+ std::map<Material*, TexIndexTextureArrayMap>& material_texture_mapping_map);
+
+ // create a mesh storing a pointer in a map so it can be retrieved later by geometry UID
+ bool write_geometry(const COLLADAFW::Geometry* geom);
+
+};
+
+#endif
diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp
new file mode 100644
index 00000000000..ba9451ecf84
--- /dev/null
+++ b/source/blender/collada/SkinInfo.cpp
@@ -0,0 +1,324 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <algorithm>
+
+#if !defined(WIN32) || defined(FREE_WINDOWS)
+#include <stdint.h>
+#endif
+
+#include "BKE_object.h"
+#include "DNA_armature_types.h"
+#include "DNA_modifier_types.h"
+#include "ED_mesh.h"
+#include "ED_object.h"
+#include "BKE_action.h"
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+
+#include "SkinInfo.h"
+#include "collada_utils.h"
+
+// use this for retrieving bone names, since these must be unique
+template<class T>
+static const char *bc_get_joint_name(T *node)
+{
+ const std::string& id = node->getOriginalId();
+ return id.size() ? id.c_str() : node->getName().c_str();
+}
+
+// This is used to store data passed in write_controller_data.
+// Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members
+// so that arrays don't get freed until we free them explicitly.
+SkinInfo::SkinInfo() {}
+
+SkinInfo::SkinInfo(const SkinInfo& skin) : weights(skin.weights),
+ joint_data(skin.joint_data),
+ unit_converter(skin.unit_converter),
+ ob_arm(skin.ob_arm),
+ controller_uid(skin.controller_uid),
+ parent(skin.parent)
+{
+ copy_m4_m4(bind_shape_matrix, (float (*)[4])skin.bind_shape_matrix);
+
+ transfer_uint_array_data_const(skin.joints_per_vertex, joints_per_vertex);
+ transfer_uint_array_data_const(skin.weight_indices, weight_indices);
+ transfer_int_array_data_const(skin.joint_indices, joint_indices);
+}
+
+SkinInfo::SkinInfo(UnitConverter *conv) : unit_converter(conv), ob_arm(NULL), parent(NULL) {}
+
+// nobody owns the data after this, so it should be freed manually with releaseMemory
+template <class T>
+void SkinInfo::transfer_array_data(T& src, T& dest)
+{
+ dest.setData(src.getData(), src.getCount());
+ src.yieldOwnerShip();
+ dest.yieldOwnerShip();
+}
+
+// when src is const we cannot src.yieldOwnerShip, this is used by copy constructor
+void SkinInfo::transfer_int_array_data_const(const COLLADAFW::IntValuesArray& src, COLLADAFW::IntValuesArray& dest)
+{
+ dest.setData((int*)src.getData(), src.getCount());
+ dest.yieldOwnerShip();
+}
+
+void SkinInfo::transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray& src, COLLADAFW::UIntValuesArray& dest)
+{
+ dest.setData((unsigned int*)src.getData(), src.getCount());
+ dest.yieldOwnerShip();
+}
+
+void SkinInfo::borrow_skin_controller_data(const COLLADAFW::SkinControllerData* skin)
+{
+ transfer_array_data((COLLADAFW::UIntValuesArray&)skin->getJointsPerVertex(), joints_per_vertex);
+ transfer_array_data((COLLADAFW::UIntValuesArray&)skin->getWeightIndices(), weight_indices);
+ transfer_array_data((COLLADAFW::IntValuesArray&)skin->getJointIndices(), joint_indices);
+ // transfer_array_data(skin->getWeights(), weights);
+
+ // cannot transfer data for FloatOrDoubleArray, copy values manually
+ const COLLADAFW::FloatOrDoubleArray& weight = skin->getWeights();
+ for (unsigned int i = 0; i < weight.getValuesCount(); i++)
+ weights.push_back(bc_get_float_value(weight, i));
+
+ unit_converter->dae_matrix_to_mat4_(bind_shape_matrix, skin->getBindShapeMatrix());
+}
+
+void SkinInfo::free()
+{
+ joints_per_vertex.releaseMemory();
+ weight_indices.releaseMemory();
+ joint_indices.releaseMemory();
+ // weights.releaseMemory();
+}
+
+// using inverse bind matrices to construct armature
+// it is safe to invert them to get the original matrices
+// because if they are inverse matrices, they can be inverted
+void SkinInfo::add_joint(const COLLADABU::Math::Matrix4& matrix)
+{
+ JointData jd;
+ unit_converter->dae_matrix_to_mat4_(jd.inv_bind_mat, matrix);
+ joint_data.push_back(jd);
+}
+
+void SkinInfo::set_controller(const COLLADAFW::SkinController* co)
+{
+ controller_uid = co->getUniqueId();
+
+ // fill in joint UIDs
+ const COLLADAFW::UniqueIdArray& joint_uids = co->getJoints();
+ for (unsigned int i = 0; i < joint_uids.getCount(); i++) {
+ joint_data[i].joint_uid = joint_uids[i];
+
+ // // store armature pointer
+ // JointData& jd = joint_index_to_joint_info_map[i];
+ // jd.ob_arm = ob_arm;
+
+ // now we'll be able to get inv bind matrix from joint id
+ // joint_id_to_joint_index_map[joint_ids[i]] = i;
+ }
+}
+
+// called from write_controller
+Object *SkinInfo::create_armature(Scene *scene)
+{
+ ob_arm = add_object(scene, OB_ARMATURE);
+ return ob_arm;
+}
+
+Object* SkinInfo::set_armature(Object *ob_arm)
+{
+ if (this->ob_arm)
+ return this->ob_arm;
+
+ this->ob_arm = ob_arm;
+ return ob_arm;
+}
+
+bool SkinInfo::get_joint_inv_bind_matrix(float inv_bind_mat[][4], COLLADAFW::Node *node)
+{
+ const COLLADAFW::UniqueId& uid = node->getUniqueId();
+ std::vector<JointData>::iterator it;
+ for (it = joint_data.begin(); it != joint_data.end(); it++) {
+ if ((*it).joint_uid == uid) {
+ copy_m4_m4(inv_bind_mat, (*it).inv_bind_mat);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+Object *SkinInfo::get_armature()
+{
+ return ob_arm;
+}
+
+const COLLADAFW::UniqueId& SkinInfo::get_controller_uid()
+{
+ return controller_uid;
+}
+
+// check if this skin controller references a joint or any descendant of it
+//
+// some nodes may not be referenced by SkinController,
+// in this case to determine if the node belongs to this armature,
+// we need to search down the tree
+bool SkinInfo::uses_joint_or_descendant(COLLADAFW::Node *node)
+{
+ const COLLADAFW::UniqueId& uid = node->getUniqueId();
+ std::vector<JointData>::iterator it;
+ for (it = joint_data.begin(); it != joint_data.end(); it++) {
+ if ((*it).joint_uid == uid)
+ return true;
+ }
+
+ COLLADAFW::NodePointerArray& children = node->getChildNodes();
+ for (unsigned int i = 0; i < children.getCount(); i++) {
+ if (uses_joint_or_descendant(children[i]))
+ return true;
+ }
+
+ return false;
+}
+
+void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid,
+ TransformReader *tm)
+{
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+
+ ModifierData *md = ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Armature);
+ ((ArmatureModifierData *)md)->object = ob_arm;
+
+ copy_m4_m4(ob->obmat, bind_shape_matrix);
+ object_apply_mat4(ob, ob->obmat);
+#if 1
+ bc_set_parent(ob, ob_arm, C);
+#else
+ Object workob;
+ ob->parent = ob_arm;
+ ob->partype = PAROBJECT;
+
+ what_does_parent(scene, ob, &workob);
+ invert_m4_m4(ob->parentinv, workob.obmat);
+
+ ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
+
+ DAG_scene_sort(bmain, scene);
+ DAG_ids_flush_update(bmain, 0);
+ WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+#endif
+
+ ((bArmature*)ob_arm->data)->deformflag = ARM_DEF_VGROUP;
+
+ // create all vertex groups
+ std::vector<JointData>::iterator it;
+ int joint_index;
+ for (it = joint_data.begin(), joint_index = 0; it != joint_data.end(); it++, joint_index++) {
+ const char *name = "Group";
+
+ // name group by joint node name
+ if (joint_by_uid.find((*it).joint_uid) != joint_by_uid.end()) {
+ name = bc_get_joint_name(joint_by_uid[(*it).joint_uid]);
+ }
+
+ ED_vgroup_add_name(ob, (char*)name);
+ }
+
+ // <vcount> - number of joints per vertex - joints_per_vertex
+ // <v> - [[bone index, weight index] * joints per vertex] * vertices - weight indices
+ // ^ bone index can be -1 meaning weight toward bind shape, how to express this in Blender?
+
+ // for each vertex in weight indices
+ // for each bone index in vertex
+ // add vertex to group at group index
+ // treat group index -1 specially
+
+ // get def group by index with BLI_findlink
+
+ for (unsigned int vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) {
+
+ unsigned int limit = weight + joints_per_vertex[vertex];
+ for ( ; weight < limit; weight++) {
+ int joint = joint_indices[weight], joint_weight = weight_indices[weight];
+
+ // -1 means "weight towards the bind shape", we just don't assign it to any group
+ if (joint != -1) {
+ bDeformGroup *def = (bDeformGroup*)BLI_findlink(&ob->defbase, joint);
+
+ ED_vgroup_vert_add(ob, def, vertex, weights[joint_weight], WEIGHT_REPLACE);
+ }
+ }
+ }
+}
+
+bPoseChannel *SkinInfo::get_pose_channel_from_node(COLLADAFW::Node *node)
+{
+ return get_pose_channel(ob_arm->pose, bc_get_joint_name(node));
+}
+
+void SkinInfo::set_parent(Object *_parent)
+{
+ parent = _parent;
+}
+
+Object* SkinInfo::get_parent()
+{
+ return parent;
+}
+
+void SkinInfo::find_root_joints(const std::vector<COLLADAFW::Node*> &root_joints,
+ std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid,
+ std::vector<COLLADAFW::Node*>& result)
+{
+ std::vector<COLLADAFW::Node*>::const_iterator it;
+ for (it = root_joints.begin(); it != root_joints.end(); it++) {
+ COLLADAFW::Node *root = *it;
+ std::vector<JointData>::iterator ji;
+ for (ji = joint_data.begin(); ji != joint_data.end(); ji++) {
+ COLLADAFW::Node *joint = joint_by_uid[(*ji).joint_uid];
+ if (find_node_in_tree(joint, root)) {
+ if (std::find(result.begin(), result.end(), root) == result.end())
+ result.push_back(root);
+ }
+ }
+ }
+}
+
+bool SkinInfo::find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root)
+{
+ if (node == tree_root)
+ return true;
+
+ COLLADAFW::NodePointerArray& children = tree_root->getChildNodes();
+ for (unsigned int i = 0; i < children.getCount(); i++) {
+ if (find_node_in_tree(node, children[i]))
+ return true;
+ }
+
+ return false;
+}
diff --git a/source/blender/collada/SkinInfo.h b/source/blender/collada/SkinInfo.h
new file mode 100644
index 00000000000..1e31baff2a9
--- /dev/null
+++ b/source/blender/collada/SkinInfo.h
@@ -0,0 +1,133 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BC_SKININFO_H__
+#define __BC_SKININFO_H__
+
+#include <map>
+#include <vector>
+
+#include "COLLADAFWUniqueId.h"
+#include "COLLADAFWTypes.h"
+#include "COLLADAFWNode.h"
+#include "COLLADAFWSkinController.h"
+#include "COLLADAFWSkinControllerData.h"
+
+#include "DNA_object_types.h"
+#include "BKE_context.h"
+
+#include "TransformReader.h"
+#include "collada_internal.h"
+
+// This is used to store data passed in write_controller_data.
+// Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members
+// so that arrays don't get freed until we free them explicitly.
+class SkinInfo
+{
+private:
+ // to build armature bones from inverse bind matrices
+ struct JointData {
+ float inv_bind_mat[4][4]; // joint inverse bind matrix
+ COLLADAFW::UniqueId joint_uid; // joint node UID
+ // Object *ob_arm; // armature object
+ };
+
+ float bind_shape_matrix[4][4];
+
+ // data from COLLADAFW::SkinControllerData, each array should be freed
+ COLLADAFW::UIntValuesArray joints_per_vertex;
+ COLLADAFW::UIntValuesArray weight_indices;
+ COLLADAFW::IntValuesArray joint_indices;
+ // COLLADAFW::FloatOrDoubleArray weights;
+ std::vector<float> weights;
+
+ std::vector<JointData> joint_data; // index to this vector is joint index
+
+ UnitConverter *unit_converter;
+
+ Object *ob_arm;
+ COLLADAFW::UniqueId controller_uid;
+ Object *parent;
+
+public:
+
+ SkinInfo();
+ SkinInfo(const SkinInfo& skin);
+ SkinInfo(UnitConverter *conv);
+
+ // nobody owns the data after this, so it should be freed manually with releaseMemory
+ template <typename T>
+ void transfer_array_data(T& src, T& dest);
+
+ // when src is const we cannot src.yieldOwnerShip, this is used by copy constructor
+ void transfer_int_array_data_const(const COLLADAFW::IntValuesArray& src, COLLADAFW::IntValuesArray& dest);
+
+ void transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray& src, COLLADAFW::UIntValuesArray& dest);
+
+ void borrow_skin_controller_data(const COLLADAFW::SkinControllerData* skin);
+
+ void free();
+
+ // using inverse bind matrices to construct armature
+ // it is safe to invert them to get the original matrices
+ // because if they are inverse matrices, they can be inverted
+ void add_joint(const COLLADABU::Math::Matrix4& matrix);
+
+ void set_controller(const COLLADAFW::SkinController* co);
+
+ // called from write_controller
+ Object *create_armature(Scene *scene);
+
+ Object* set_armature(Object *ob_arm);
+
+ bool get_joint_inv_bind_matrix(float inv_bind_mat[][4], COLLADAFW::Node *node);
+
+ Object *get_armature();
+
+ const COLLADAFW::UniqueId& get_controller_uid();
+
+ // check if this skin controller references a joint or any descendant of it
+ //
+ // some nodes may not be referenced by SkinController,
+ // in this case to determine if the node belongs to this armature,
+ // we need to search down the tree
+ bool uses_joint_or_descendant(COLLADAFW::Node *node);
+
+ void link_armature(bContext *C, Object *ob, std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid, TransformReader *tm);
+
+ bPoseChannel *get_pose_channel_from_node(COLLADAFW::Node *node);
+
+ void set_parent(Object *_parent);
+
+ Object* get_parent();
+
+ void find_root_joints(const std::vector<COLLADAFW::Node*> &root_joints,
+ std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid,
+ std::vector<COLLADAFW::Node*>& result);
+
+ bool find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root);
+
+};
+
+#endif
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
new file mode 100644
index 00000000000..814fda58e3c
--- /dev/null
+++ b/source/blender/collada/TransformReader.cpp
@@ -0,0 +1,125 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "TransformReader.h"
+
+TransformReader::TransformReader(UnitConverter* conv) : unit_converter(conv) {}
+
+void TransformReader::get_node_mat(float mat[][4], COLLADAFW::Node *node, std::map<COLLADAFW::UniqueId, Animation> *animation_map, Object *ob)
+{
+ float cur[4][4];
+ float copy[4][4];
+
+ unit_m4(mat);
+
+ for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) {
+
+ COLLADAFW::Transformation *tm = node->getTransformations()[i];
+ COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
+
+ switch(type) {
+ case COLLADAFW::Transformation::TRANSLATE:
+ dae_translate_to_mat4(tm, cur);
+ break;
+ case COLLADAFW::Transformation::ROTATE:
+ dae_rotate_to_mat4(tm, cur);
+ break;
+ case COLLADAFW::Transformation::SCALE:
+ dae_scale_to_mat4(tm, cur);
+ break;
+ case COLLADAFW::Transformation::MATRIX:
+ dae_matrix_to_mat4(tm, cur);
+ break;
+ case COLLADAFW::Transformation::LOOKAT:
+ case COLLADAFW::Transformation::SKEW:
+ fprintf(stderr, "LOOKAT and SKEW transformations are not supported yet.\n");
+ break;
+ }
+
+ copy_m4_m4(copy, mat);
+ mul_m4_m4m4(mat, cur, copy);
+
+ if (animation_map) {
+ // AnimationList that drives this Transformation
+ const COLLADAFW::UniqueId& anim_list_id = tm->getAnimationList();
+
+ // store this so later we can link animation data with ob
+ Animation anim = {ob, node, tm};
+ (*animation_map)[anim_list_id] = anim;
+ }
+ }
+}
+
+void TransformReader::dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[][4])
+{
+ COLLADAFW::Rotate *ro = (COLLADAFW::Rotate*)tm;
+ COLLADABU::Math::Vector3& axis = ro->getRotationAxis();
+ float angle = (float)(ro->getRotationAngle() * M_PI / 180.0f);
+ float ax[] = {axis[0], axis[1], axis[2]};
+ // float quat[4];
+ // axis_angle_to_quat(quat, axis, angle);
+ // quat_to_mat4(m, quat);
+ axis_angle_to_mat4(m, ax, angle);
+}
+
+void TransformReader::dae_translate_to_mat4(COLLADAFW::Transformation *tm, float m[][4])
+{
+ COLLADAFW::Translate *tra = (COLLADAFW::Translate*)tm;
+ COLLADABU::Math::Vector3& t = tra->getTranslation();
+
+ unit_m4(m);
+
+ m[3][0] = (float)t[0];
+ m[3][1] = (float)t[1];
+ m[3][2] = (float)t[2];
+}
+
+void TransformReader::dae_scale_to_mat4(COLLADAFW::Transformation *tm, float m[][4])
+{
+ COLLADABU::Math::Vector3& s = ((COLLADAFW::Scale*)tm)->getScale();
+ float size[3] = {(float)s[0], (float)s[1], (float)s[2]};
+ size_to_mat4(m, size);
+}
+
+void TransformReader::dae_matrix_to_mat4(COLLADAFW::Transformation *tm, float m[][4])
+{
+ unit_converter->dae_matrix_to_mat4_(m, ((COLLADAFW::Matrix*)tm)->getMatrix());
+}
+
+void TransformReader::dae_translate_to_v3(COLLADAFW::Transformation *tm, float v[3])
+{
+ dae_vector3_to_v3(((COLLADAFW::Translate*)tm)->getTranslation(), v);
+}
+
+void TransformReader::dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3])
+{
+ dae_vector3_to_v3(((COLLADAFW::Scale*)tm)->getScale(), v);
+}
+
+void TransformReader::dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3])
+{
+ v[0] = v3.x;
+ v[1] = v3.y;
+ v[2] = v3.z;
+}
diff --git a/source/blender/collada/TransformReader.h b/source/blender/collada/TransformReader.h
new file mode 100644
index 00000000000..4dff8884a44
--- /dev/null
+++ b/source/blender/collada/TransformReader.h
@@ -0,0 +1,70 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BC_TRANSFORMREADER_H__
+#define __BC_TRANSFORMREADER_H__
+
+#include "COLLADAFWNode.h"
+#include "COLLADAFWTransformation.h"
+#include "COLLADAFWTranslate.h"
+#include "COLLADAFWRotate.h"
+#include "COLLADAFWScale.h"
+#include "COLLADAFWMatrix.h"
+#include "COLLADAFWUniqueId.h"
+#include "Math/COLLADABUMathVector3.h"
+
+#include "DNA_object_types.h"
+#include "BLI_math.h"
+
+#include "collada_internal.h"
+
+//struct Object;
+
+class TransformReader : public TransformBase
+{
+protected:
+
+ UnitConverter *unit_converter;
+
+public:
+ struct Animation {
+ Object *ob;
+ COLLADAFW::Node *node;
+ COLLADAFW::Transformation *tm; // which transform is animated by an AnimationList->id
+ };
+
+ TransformReader(UnitConverter* conv);
+
+ void get_node_mat(float mat[][4], COLLADAFW::Node *node, std::map<COLLADAFW::UniqueId, Animation> *animation_map, Object *ob);
+
+ void dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[][4]);
+ void dae_translate_to_mat4(COLLADAFW::Transformation *tm, float m[][4]);
+ void dae_scale_to_mat4(COLLADAFW::Transformation *tm, float m[][4]);
+ void dae_matrix_to_mat4(COLLADAFW::Transformation *tm, float m[][4]);
+ void dae_translate_to_v3(COLLADAFW::Transformation *tm, float v[3]);
+ void dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3]);
+ void dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3]);
+};
+
+#endif
diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
new file mode 100644
index 00000000000..a373191e773
--- /dev/null
+++ b/source/blender/collada/TransformWriter.cpp
@@ -0,0 +1,100 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "BKE_object.h"
+
+#include "TransformWriter.h"
+
+#include "BLI_math.h"
+
+void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[][4], float parent_mat[][4])
+{
+ float loc[3], rot[3], scale[3];
+ float local[4][4];
+
+ if (parent_mat) {
+ float invpar[4][4];
+ invert_m4_m4(invpar, parent_mat);
+ mul_m4_m4m4(local, mat, invpar);
+ }
+ else {
+ copy_m4_m4(local, mat);
+ }
+
+ TransformBase::decompose(local, loc, rot, NULL, scale);
+
+ add_transform(node, loc, rot, scale);
+}
+
+void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
+{
+ float rot[3], loc[3], scale[3];
+
+ if (ob->parent) {
+ float C[4][4], tmat[4][4], imat[4][4], mat[4][4];
+
+ // factor out scale from obmat
+
+ copy_v3_v3(scale, ob->size);
+
+ ob->size[0] = ob->size[1] = ob->size[2] = 1.0f;
+ object_to_mat4(ob, C);
+ copy_v3_v3(ob->size, scale);
+
+ mul_serie_m4(tmat, ob->parent->obmat, ob->parentinv, C, NULL, NULL, NULL, NULL, NULL);
+
+ // calculate local mat
+
+ invert_m4_m4(imat, ob->parent->obmat);
+ mul_m4_m4m4(mat, tmat, imat);
+
+ // done
+
+ mat4_to_eul(rot, mat);
+ copy_v3_v3(loc, mat[3]);
+ }
+ else {
+ copy_v3_v3(loc, ob->loc);
+ copy_v3_v3(rot, ob->rot);
+ copy_v3_v3(scale, ob->size);
+ }
+
+ add_transform(node, loc, rot, scale);
+}
+
+void TransformWriter::add_node_transform_identity(COLLADASW::Node& node)
+{
+ float loc[] = {0.0f, 0.0f, 0.0f}, scale[] = {1.0f, 1.0f, 1.0f}, rot[] = {0.0f, 0.0f, 0.0f};
+ add_transform(node, loc, rot, scale);
+}
+
+void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float rot[3], float scale[3])
+{
+ node.addTranslate("location", loc[0], loc[1], loc[2]);
+ node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2]));
+ node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1]));
+ node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));
+ node.addScale("scale", scale[0], scale[1], scale[2]);
+}
diff --git a/source/blender/collada/TransformWriter.h b/source/blender/collada/TransformWriter.h
new file mode 100644
index 00000000000..054a28c08a1
--- /dev/null
+++ b/source/blender/collada/TransformWriter.h
@@ -0,0 +1,48 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
+ * Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __TRANSFORMWRITER_H__
+#define __TRANSFORMWRITER_H__
+
+#include "COLLADASWNode.h"
+
+#include "DNA_object_types.h"
+
+#include "collada_internal.h"
+
+class TransformWriter : protected TransformBase
+{
+protected:
+ void add_node_transform(COLLADASW::Node& node, float mat[][4], float parent_mat[][4]);
+
+ void add_node_transform_ob(COLLADASW::Node& node, Object *ob);
+
+ void add_node_transform_identity(COLLADASW::Node& node);
+
+private:
+ void add_transform(COLLADASW::Node& node, float loc[3], float rot[3], float scale[3]);
+};
+
+#endif
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index a519db3332c..d499249cfa2 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -21,15 +21,15 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-#include "BKE_main.h"
-#include "BKE_scene.h"
-#include "BKE_context.h"
#include "DocumentExporter.h"
#include "DocumentImporter.h"
extern "C"
{
+#include "BKE_scene.h"
+#include "BKE_context.h"
+
int collada_import(bContext *C, const char *filepath)
{
DocumentImporter imp;
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
new file mode 100644
index 00000000000..6f401c1856f
--- /dev/null
+++ b/source/blender/collada/collada_internal.cpp
@@ -0,0 +1,266 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "collada_internal.h"
+
+UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {}
+
+void UnitConverter::read_asset(const COLLADAFW::FileInfo* asset)
+{
+ unit = asset->getUnit();
+ up_axis = asset->getUpAxisType();
+}
+
+UnitConverter::UnitSystem UnitConverter::isMetricSystem()
+{
+ switch(unit.getLinearUnitUnit()) {
+ case COLLADAFW::FileInfo::Unit::MILLIMETER:
+ case COLLADAFW::FileInfo::Unit::CENTIMETER:
+ case COLLADAFW::FileInfo::Unit::DECIMETER:
+ case COLLADAFW::FileInfo::Unit::METER:
+ case COLLADAFW::FileInfo::Unit::KILOMETER:
+ return UnitConverter::Metric;
+ case COLLADAFW::FileInfo::Unit::INCH:
+ case COLLADAFW::FileInfo::Unit::FOOT:
+ case COLLADAFW::FileInfo::Unit::YARD:
+ return UnitConverter::Imperial;
+ default:
+ return UnitConverter::None;
+ }
+}
+
+float UnitConverter::getLinearMeter()
+{
+ return (float)unit.getLinearUnitMeter();
+}
+
+void UnitConverter::convertVector3(COLLADABU::Math::Vector3 &vec, float *v)
+{
+ v[0] = vec.x;
+ v[1] = vec.y;
+ v[2] = vec.z;
+}
+
+// TODO need also for angle conversion, time conversion...
+
+void UnitConverter::dae_matrix_to_mat4_(float out[][4], const COLLADABU::Math::Matrix4& in)
+{
+ // in DAE, matrices use columns vectors, (see comments in COLLADABUMathMatrix4.h)
+ // so here, to make a blender matrix, we swap columns and rows
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
+ out[i][j] = in[j][i];
+ }
+ }
+}
+
+void UnitConverter::mat4_to_dae(float out[][4], float in[][4])
+{
+ copy_m4_m4(out, in);
+ transpose_m4(out);
+}
+
+void UnitConverter::mat4_to_dae_double(double out[][4], float in[][4])
+{
+ float mat[4][4];
+
+ mat4_to_dae(mat, in);
+
+ for (int i = 0; i < 4; i++)
+ for (int j = 0; j < 4; j++)
+ out[i][j] = mat[i][j];
+}
+
+void TransformBase::decompose(float mat[][4], float *loc, float eul[3], float quat[4], float *size)
+{
+ mat4_to_size(size, mat);
+ if (eul) {
+ mat4_to_eul(eul, mat);
+ }
+ if (quat) {
+ mat4_to_quat(quat, mat);
+ }
+ copy_v3_v3(loc, mat[3]);
+}
+
+/**
+Translation map.
+Used to translate every COLLADA id to a valid id, no matter what "wrong" letters may be
+included. Look at the IDREF XSD declaration for more.
+Follows strictly the COLLADA XSD declaration which explicitly allows non-english chars,
+like special chars (e.g. micro sign), umlauts and so on.
+The COLLADA spec also allows additional chars for member access ('.'), these
+must obviously be removed too, otherwise they would be heavily misinterpreted.
+*/
+const unsigned char translate_start_name_map[256] = {
+95, 95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+65, 66, 67, 68, 69, 70, 71, 72,
+73, 74, 75, 76, 77, 78, 79, 80,
+81, 82, 83, 84, 85, 86, 87, 88,
+89, 90, 95, 95, 95, 95, 95, 95,
+97, 98, 99, 100, 101, 102, 103, 104,
+105, 106, 107, 108, 109, 110, 111, 112,
+113, 114, 115, 116, 117, 118, 119, 120,
+121, 122, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 192,
+193, 194, 195, 196, 197, 198, 199, 200,
+201, 202, 203, 204, 205, 206, 207, 208,
+209, 210, 211, 212, 213, 214, 95, 216,
+217, 218, 219, 220, 221, 222, 223, 224,
+225, 226, 227, 228, 229, 230, 231, 232,
+233, 234, 235, 236, 237, 238, 239, 240,
+241, 242, 243, 244, 245, 246, 95, 248,
+249, 250, 251, 252, 253, 254, 255};
+
+const unsigned char translate_name_map[256] = {
+95, 95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 45, 95, 95, 48,
+49, 50, 51, 52, 53, 54, 55, 56,
+57, 95, 95, 95, 95, 95, 95, 95,
+65, 66, 67, 68, 69, 70, 71, 72,
+73, 74, 75, 76, 77, 78, 79, 80,
+81, 82, 83, 84, 85, 86, 87, 88,
+89, 90, 95, 95, 95, 95, 95, 95,
+97, 98, 99, 100, 101, 102, 103, 104,
+105, 106, 107, 108, 109, 110, 111, 112,
+113, 114, 115, 116, 117, 118, 119, 120,
+121, 122, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 95, 95,
+95, 95, 95, 95, 95, 95, 183, 95,
+95, 95, 95, 95, 95, 95, 95, 192,
+193, 194, 195, 196, 197, 198, 199, 200,
+201, 202, 203, 204, 205, 206, 207, 208,
+209, 210, 211, 212, 213, 214, 95, 216,
+217, 218, 219, 220, 221, 222, 223, 224,
+225, 226, 227, 228, 229, 230, 231, 232,
+233, 234, 235, 236, 237, 238, 239, 240,
+241, 242, 243, 244, 245, 246, 95, 248,
+249, 250, 251, 252, 253, 254, 255};
+
+typedef std::map< std::string, std::vector<std::string> > map_string_list;
+map_string_list global_id_map;
+
+void clear_global_id_map()
+{
+ global_id_map.clear();
+}
+
+/** Look at documentation of translate_map */
+std::string translate_id(const std::string &id)
+{
+ if (id.size() == 0)
+ { return id; }
+ std::string id_translated = id;
+ id_translated[0] = translate_start_name_map[(unsigned int)id_translated[0]];
+ for (unsigned int i=1; i < id_translated.size(); i++)
+ {
+ id_translated[i] = translate_name_map[(unsigned int)id_translated[i]];
+ }
+ // It's so much workload now, the if() should speed up things.
+ if (id_translated != id)
+ {
+ // Search duplicates
+ map_string_list::iterator iter = global_id_map.find(id_translated);
+ if (iter != global_id_map.end())
+ {
+ unsigned int i = 0;
+ bool found = false;
+ for (i=0; i < iter->second.size(); i++)
+ {
+ if (id == iter->second[i])
+ {
+ found = true;
+ break;
+ }
+ }
+ bool convert = false;
+ if (found)
+ {
+ if (i > 0)
+ { convert = true; }
+ }
+ else
+ {
+ convert = true;
+ global_id_map[id_translated].push_back(id);
+ }
+ if (convert)
+ {
+ std::stringstream out;
+ out << ++i;
+ id_translated += out.str();
+ }
+ }
+ else { global_id_map[id_translated].push_back(id); }
+ }
+ return id_translated;
+}
+
+std::string id_name(void *id)
+{
+ return ((ID*)id)->name + 2;
+}
+
+std::string get_geometry_id(Object *ob)
+{
+ return translate_id(id_name(ob)) + "-mesh";
+}
+
+std::string get_light_id(Object *ob)
+{
+ return translate_id(id_name(ob)) + "-light";
+}
+
+std::string get_joint_id(Bone *bone, Object *ob_arm)
+{
+ return translate_id(id_name(ob_arm) + "_" + bone->name);
+}
+
+std::string get_camera_id(Object *ob)
+{
+ return translate_id(id_name(ob)) + "-camera";
+}
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index 242fce749c4..72b03a3d090 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -24,9 +24,17 @@
#ifndef BLENDER_COLLADA_H
#define BLENDER_COLLADA_H
+#include <string>
+#include <vector>
+#include <map>
+
#include "COLLADAFWFileInfo.h"
#include "Math/COLLADABUMathMatrix4.h"
+#include "DNA_armature_types.h"
+#include "DNA_object_types.h"
+#include "BLI_math.h"
+
class UnitConverter
{
private:
@@ -35,61 +43,50 @@ private:
public:
- UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {}
+ enum UnitSystem {
+ None,
+ Metric,
+ Imperial
+ };
+
+ // Initialize with Z_UP, since Blender uses right-handed, z-up
+ UnitConverter();
- void read_asset(const COLLADAFW::FileInfo* asset)
- {
- }
+ void read_asset(const COLLADAFW::FileInfo* asset);
- // TODO
- // convert vector vec from COLLADA format to Blender
- void convertVec3(float *vec)
- {
- }
+ void convertVector3(COLLADABU::Math::Vector3 &vec, float *v);
+
+ UnitConverter::UnitSystem isMetricSystem(void);
+
+ float getLinearMeter(void);
// TODO need also for angle conversion, time conversion...
- void dae_matrix_to_mat4(float out[][4], const COLLADABU::Math::Matrix4& in)
- {
- // in DAE, matrices use columns vectors, (see comments in COLLADABUMathMatrix4.h)
- // so here, to make a blender matrix, we swap columns and rows
- for (int i = 0; i < 4; i++) {
- for (int j = 0; j < 4; j++) {
- out[i][j] = in[j][i];
- }
- }
- }
-
- void mat4_to_dae(float out[][4], float in[][4])
- {
- copy_m4_m4(out, in);
- transpose_m4(out);
- }
-
- void mat4_to_dae_double(double out[][4], float in[][4])
- {
- float mat[4][4];
-
- mat4_to_dae(mat, in);
-
- for (int i = 0; i < 4; i++)
- for (int j = 0; j < 4; j++)
- out[i][j] = mat[i][j];
- }
+ void dae_matrix_to_mat4_(float out[][4], const COLLADABU::Math::Matrix4& in);
+
+ void mat4_to_dae(float out[][4], float in[][4]);
+
+ void mat4_to_dae_double(double out[][4], float in[][4]);
};
class TransformBase
{
public:
- void decompose(float mat[][4], float *loc, float eul[3], float quat[4], float *size)
- {
- mat4_to_size(size, mat);
- if (eul)
- mat4_to_eul(eul, mat);
- if (quat)
- mat4_to_quat(quat, mat);
- copy_v3_v3(loc, mat[3]);
- }
+ void decompose(float mat[][4], float *loc, float eul[3], float quat[4], float *size);
};
+extern void clear_global_id_map();
+/** Look at documentation of translate_map */
+extern std::string translate_id(const std::string &id);
+
+extern std::string id_name(void *id);
+
+extern std::string get_geometry_id(Object *ob);
+
+extern std::string get_light_id(Object *ob);
+
+extern std::string get_joint_id(Bone *bone, Object *ob_arm);
+
+extern std::string get_camera_id(Object *ob);
+
#endif
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
new file mode 100644
index 00000000000..0634c910e96
--- /dev/null
+++ b/source/blender/collada/collada_utils.cpp
@@ -0,0 +1,106 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "COLLADAFWGeometry.h"
+#include "COLLADAFWMeshPrimitive.h"
+#include "COLLADAFWMeshVertexData.h"
+
+#include "DNA_customdata_types.h"
+#include "DNA_object_types.h"
+
+#include "BLI_math.h"
+
+#include "BKE_context.h"
+#include "BKE_customdata.h"
+#include "BKE_depsgraph.h"
+#include "BKE_object.h"
+
+#include "WM_api.h" // XXX hrm, see if we can do without this
+#include "WM_types.h"
+
+float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index)
+{
+ if (index >= array.getValuesCount())
+ return 0.0f;
+
+ if (array.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT)
+ return array.getFloatValues()->getData()[index];
+ else
+ return array.getDoubleValues()->getData()[index];
+}
+
+// copied from /editors/object/object_relations.c
+int bc_test_parent_loop(Object *par, Object *ob)
+{
+ /* test if 'ob' is a parent somewhere in par's parents */
+
+ if(par == NULL) return 0;
+ if(ob == par) return 1;
+
+ return bc_test_parent_loop(par->parent, ob);
+}
+
+// a shortened version of parent_set_exec()
+// if is_parent_space is true then ob->obmat will be multiplied by par->obmat before parenting
+int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
+{
+ Object workob;
+ Main *bmain = CTX_data_main(C);
+ Scene *sce = CTX_data_scene(C);
+
+ if (!par || bc_test_parent_loop(par, ob))
+ return false;
+
+ ob->parent = par;
+ ob->partype = PAROBJECT;
+
+ ob->parsubstr[0] = 0;
+
+ if (is_parent_space) {
+ float mat[4][4];
+ // calc par->obmat
+ where_is_object(sce, par);
+
+ // move child obmat into world space
+ mul_m4_m4m4(mat, ob->obmat, par->obmat);
+ copy_m4_m4(ob->obmat, mat);
+ }
+
+ // apply child obmat (i.e. decompose it into rot/loc/size)
+ object_apply_mat4(ob, ob->obmat);
+
+ // compute parentinv
+ what_does_parent(sce, ob, &workob);
+ invert_m4_m4(ob->parentinv, workob.obmat);
+
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
+ par->recalc |= OB_RECALC_OB;
+
+ DAG_scene_sort(bmain, sce);
+ DAG_ids_flush_update(bmain, 0);
+ WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+
+ return true;
+}
+
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
new file mode 100644
index 00000000000..ba5ba7f3cf5
--- /dev/null
+++ b/source/blender/collada/collada_utils.h
@@ -0,0 +1,50 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BC_UTILS_H__
+#define __BC_UTILS_H__
+
+#include "COLLADAFWMeshPrimitive.h"
+#include "COLLADAFWGeometry.h"
+#include "COLLADAFWFloatOrDoubleArray.h"
+#include "COLLADAFWTypes.h"
+
+#include <vector>
+#include <map>
+
+#include "DNA_object_types.h"
+#include "DNA_customdata_types.h"
+#include "DNA_texture_types.h"
+#include "BKE_context.h"
+
+typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex*> > TexIndexTextureArrayMap;
+
+extern float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index);
+
+extern int bc_test_parent_loop(Object *par, Object *ob);
+extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space=true);
+extern char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n);
+extern char *bc_CustomData_get_active_layer_name(const CustomData *data, int type);
+
+#endif
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 3fb8e441d6f..73c7cfd4381 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -89,7 +89,7 @@
/* Draw Backdrop ---------------------------------- */
/* get backdrop color for top-level widgets (Scene and Object only) */
-static void acf_generic_root_color(bAnimContext *ac, bAnimListElem *ale, float *color)
+static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
{
/* darker blue for top-level widgets */
UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, color);
@@ -115,7 +115,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa
/* get backdrop color for data expanders under top-level Scene/Object */
-static void acf_generic_dataexpand_color(bAnimContext *ac, bAnimListElem *ale, float *color)
+static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
{
/* lighter color than top-level widget */
UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, color);
@@ -202,11 +202,11 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f
/* Indention + Offset ------------------------------------------- */
/* indention level is always the value in the name */
-static short acf_generic_indention_0(bAnimContext *ac, bAnimListElem *ale)
+static short acf_generic_indention_0(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
{
return 0;
}
-static short acf_generic_indention_1(bAnimContext *ac, bAnimListElem *ale)
+static short acf_generic_indention_1(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
{
return 1;
}
@@ -218,7 +218,7 @@ static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale)
#endif
/* indention which varies with the grouping status */
-static short acf_generic_indention_flexible(bAnimContext *ac, bAnimListElem *ale)
+static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListElem *ale)
{
short indent= 0;
@@ -352,7 +352,7 @@ static void *acf_generic_dsexpand_setting_ptr(bAnimListElem *ale, int setting, s
}
/* check if some setting exists for this object-based data-expander (datablock only) */
-static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
{
switch (setting) {
/* expand is always supported */
@@ -375,7 +375,7 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle
/* Animation Summary ----------------------------------- */
/* get backdrop color for summary widget */
-static void acf_summary_color(bAnimContext *ac, bAnimListElem *ale, float *color)
+static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
{
// FIXME: hardcoded color - same as the 'action' line in NLA
// reddish color
@@ -404,27 +404,27 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi
}
/* name for summary entries */
-static void acf_summary_name(bAnimListElem *ale, char *name)
+static void acf_summary_name(bAnimListElem *UNUSED(ale), char *name)
{
if (name)
strcpy(name, "DopeSheet Summary");
}
// TODO: this is really a temp icon I think
-static int acf_summary_icon(bAnimListElem *ale)
+static int acf_summary_icon(bAnimListElem *UNUSED(ale))
{
return ICON_BORDERMOVE;
}
/* check if some setting exists for this channel */
-static short acf_summary_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static short acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
{
/* only expanded is supported, as it is used for hiding all stuff which the summary covers */
return (setting == ACHANNEL_SETTING_EXPAND);
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_summary_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
if (setting == ACHANNEL_SETTING_EXPAND) {
/* expanded */
@@ -481,13 +481,13 @@ static bAnimChannelType ACF_SUMMARY =
/* Scene ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_scene_icon(bAnimListElem *ale)
+static int acf_scene_icon(bAnimListElem *UNUSED(ale))
{
return ICON_SCENE_DATA;
}
/* check if some setting exists for this channel */
-static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
{
switch (setting) {
/* muted only in NLA */
@@ -509,7 +509,7 @@ static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int s
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_scene_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -652,7 +652,7 @@ static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_object_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_object_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -726,7 +726,7 @@ static bAnimChannelType ACF_OBJECT =
/* Group ------------------------------------------- */
/* get backdrop color for group widget */
-static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float *color)
+static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float *color)
{
/* highlight only for action group channels */
if (ale->flag & AGRP_ACTIVE)
@@ -764,7 +764,7 @@ static void acf_group_name(bAnimListElem *ale, char *name)
}
/* check if some setting exists for this channel */
-static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting)
{
/* for now, all settings are supported, though some are only conditionally */
switch (setting) {
@@ -814,7 +814,7 @@ static int acf_group_setting_flag(bAnimContext *ac, int setting, short *neg)
}
/* get pointer to the setting */
-static void *acf_group_setting_ptr(bAnimListElem *ale, int setting, short *type)
+static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type)
{
bActionGroup *agrp= (bActionGroup *)ale->data;
@@ -875,7 +875,7 @@ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_fcurve_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -900,7 +900,7 @@ static int acf_fcurve_setting_flag(bAnimContext *ac, int setting, short *neg)
}
/* get pointer to the setting */
-static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int setting, short *type)
+static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type)
{
FCurve *fcu= (FCurve *)ale->data;
@@ -929,13 +929,13 @@ static bAnimChannelType ACF_FCURVE =
/* Object Action Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_fillactd_icon(bAnimListElem *ale)
+static int acf_fillactd_icon(bAnimListElem *UNUSED(ale))
{
return ICON_ACTION;
}
/* check if some setting exists for this channel */
-static short acf_fillactd_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static short acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
{
switch (setting) {
/* only select and expand supported */
@@ -949,7 +949,7 @@ static short acf_fillactd_setting_valid(bAnimContext *ac, bAnimListElem *ale, in
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_fillactd_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1013,19 +1013,19 @@ static bAnimChannelType ACF_FILLACTD =
/* Drivers Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_filldrivers_icon(bAnimListElem *ale)
+static int acf_filldrivers_icon(bAnimListElem *UNUSED(ale))
{
return ICON_ANIM_DATA;
}
-static void acf_filldrivers_name(bAnimListElem *ale, char *name)
+static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name)
{
strcpy(name, "Drivers");
}
/* check if some setting exists for this channel */
// TODO: this could be made more generic
-static short acf_filldrivers_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static short acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
{
switch (setting) {
/* only expand supported */
@@ -1038,7 +1038,7 @@ static short acf_filldrivers_setting_valid(bAnimContext *ac, bAnimListElem *ale,
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_filldrivers_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1091,18 +1091,18 @@ static bAnimChannelType ACF_FILLDRIVERS =
/* Materials Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_fillmatd_icon(bAnimListElem *ale)
+static int acf_fillmatd_icon(bAnimListElem *UNUSED(ale))
{
return ICON_MATERIAL_DATA;
}
-static void acf_fillmatd_name(bAnimListElem *ale, char *name)
+static void acf_fillmatd_name(bAnimListElem *UNUSED(ale), char *name)
{
strcpy(name, "Materials");
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_fillmatd_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_fillmatd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1137,18 +1137,18 @@ static bAnimChannelType ACF_FILLMATD=
/* Particles Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_fillpartd_icon(bAnimListElem *ale)
+static int acf_fillpartd_icon(bAnimListElem *UNUSED(ale))
{
return ICON_PARTICLE_DATA;
}
-static void acf_fillpartd_name(bAnimListElem *ale, char *name)
+static void acf_fillpartd_name(bAnimListElem *UNUSED(ale), char *name)
{
strcpy(name, "Particles");
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_fillpartd_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_fillpartd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1205,12 +1205,12 @@ static short acf_filltexd_offset(bAnimContext *ac, bAnimListElem *ale)
}
// TODO: just get this from RNA?
-static int acf_filltexd_icon(bAnimListElem *ale)
+static int acf_filltexd_icon(bAnimListElem *UNUSED(ale))
{
return ICON_TEXTURE_DATA;
}
-static void acf_filltexd_name(bAnimListElem *ale, char *name)
+static void acf_filltexd_name(bAnimListElem *UNUSED(ale), char *name)
{
strcpy(name, "Textures");
}
@@ -1253,7 +1253,7 @@ static void *acf_filltexd_setting_ptr(bAnimListElem *ale, int setting, short *ty
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_filltexd_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_filltexd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1289,19 +1289,19 @@ static bAnimChannelType ACF_FILLTEXD=
/* Material Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dsmat_icon(bAnimListElem *ale)
+static int acf_dsmat_icon(bAnimListElem *UNUSED(ale))
{
return ICON_MATERIAL_DATA;
}
/* offset for material expanders */
-static short acf_dsmat_offset(bAnimContext *ac, bAnimListElem *ale)
+static short acf_dsmat_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
{
return 21;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dsmat_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1371,13 +1371,13 @@ static bAnimChannelType ACF_DSMAT=
/* Lamp Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dslam_icon(bAnimListElem *ale)
+static int acf_dslam_icon(bAnimListElem *UNUSED(ale))
{
return ICON_LAMP_DATA;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dslam_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1447,13 +1447,13 @@ static bAnimChannelType ACF_DSLAM=
/* Texture Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dstex_icon(bAnimListElem *ale)
+static int acf_dstex_icon(bAnimListElem *UNUSED(ale))
{
return ICON_TEXTURE_DATA;
}
/* offset for texture expanders */
-static short acf_dstex_offset(bAnimContext *ac, bAnimListElem *ale)
+static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *ale)
{
short offset = 21;
@@ -1472,7 +1472,7 @@ static short acf_dstex_offset(bAnimContext *ac, bAnimListElem *ale)
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dstex_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1542,13 +1542,13 @@ static bAnimChannelType ACF_DSTEX=
/* Camera Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dscam_icon(bAnimListElem *ale)
+static int acf_dscam_icon(bAnimListElem *UNUSED(ale))
{
return ICON_CAMERA_DATA;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dscam_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1634,7 +1634,7 @@ static int acf_dscur_icon(bAnimListElem *ale)
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dscur_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1704,13 +1704,13 @@ static bAnimChannelType ACF_DSCUR=
/* Shape Key Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dsskey_icon(bAnimListElem *ale)
+static int acf_dsskey_icon(bAnimListElem *UNUSED(ale))
{
return ICON_SHAPEKEY_DATA;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dsskey_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1780,13 +1780,13 @@ static bAnimChannelType ACF_DSSKEY=
/* World Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dswor_icon(bAnimListElem *ale)
+static int acf_dswor_icon(bAnimListElem *UNUSED(ale))
{
return ICON_WORLD_DATA;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dswor_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1856,13 +1856,13 @@ static bAnimChannelType ACF_DSWOR=
/* Particle Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dspart_icon(bAnimListElem *ale)
+static int acf_dspart_icon(bAnimListElem *UNUSED(ale))
{
return ICON_PARTICLE_DATA;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dspart_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -1932,13 +1932,13 @@ static bAnimChannelType ACF_DSPART=
/* MetaBall Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dsmball_icon(bAnimListElem *ale)
+static int acf_dsmball_icon(bAnimListElem *UNUSED(ale))
{
return ICON_META_DATA;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dsmball_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -2008,13 +2008,13 @@ static bAnimChannelType ACF_DSMBALL=
/* Armature Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dsarm_icon(bAnimListElem *ale)
+static int acf_dsarm_icon(bAnimListElem *UNUSED(ale))
{
return ICON_ARMATURE_DATA;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dsarm_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -2084,13 +2084,13 @@ static bAnimChannelType ACF_DSARM=
/* NodeTree Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dsntree_icon(bAnimListElem *ale)
+static int acf_dsntree_icon(bAnimListElem *UNUSED(ale))
{
return ICON_NODETREE;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dsntree_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -2160,13 +2160,13 @@ static bAnimChannelType ACF_DSNTREE=
/* Mesh Expander ------------------------------------------- */
// TODO: just get this from RNA?
-static int acf_dsmesh_icon(bAnimListElem *ale)
+static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale))
{
return ICON_MESH_DATA;
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_dsmesh_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -2251,7 +2251,7 @@ static void acf_shapekey_name(bAnimListElem *ale, char *name)
}
/* check if some setting exists for this channel */
-static short acf_shapekey_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
+static short acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting)
{
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -2266,7 +2266,7 @@ static short acf_shapekey_setting_valid(bAnimContext *ac, bAnimListElem *ale, in
}
/* get the appropriate flag(s) for the setting when it is valid */
-static int acf_shapekey_setting_flag(bAnimContext *ac, int setting, short *neg)
+static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
*neg= 0;
@@ -2851,7 +2851,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* ------------------ */
/* callback for (normal) widget settings - send notifiers */
-static void achannel_setting_widget_cb(bContext *C, void *poin, void *poin2)
+static void achannel_setting_widget_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
}
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 4414da222a6..16eb08be933 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -922,7 +922,7 @@ void ANIM_OT_channels_move_bottom (wmOperatorType *ot)
/* ******************** Delete Channel Operator *********************** */
-static int animchannels_delete_exec(bContext *C, wmOperator *op)
+static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
@@ -1023,7 +1023,7 @@ void ANIM_OT_channels_delete (wmOperatorType *ot)
/* ******************** Set Channel Visibility Operator *********************** */
/* NOTE: this operator is only valid in the Graph Editor channels region */
-static int animchannels_visibility_set_exec(bContext *C, wmOperator *op)
+static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
@@ -1101,7 +1101,7 @@ void ANIM_OT_channels_visibility_set (wmOperatorType *ot)
/* ******************** Toggle Channel Visibility Operator *********************** */
/* NOTE: this operator is only valid in the Graph Editor channels region */
-static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *op)
+static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
@@ -1628,7 +1628,7 @@ void ANIM_OT_channels_select_border(wmOperatorType *ot)
/* ******************** Mouse-Click Operator *********************** */
/* Handle selection changes due to clicking on channels. Settings will get caught by UI code... */
-static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, short selectmode)
+static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_index, short selectmode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 5312e97c604..ed23e72b328 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -96,7 +96,7 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
/* tags the given ID block for refreshes (if applicable) due to
* Animation Editor editing */
-void ANIM_id_update(Scene *scene, ID *id)
+void ANIM_id_update(Scene *UNUSED(scene), ID *id)
{
if (id) {
AnimData *adt= BKE_animdata_from_id(id);
@@ -121,7 +121,7 @@ void ANIM_id_update(Scene *scene, ID *id)
*/
/* perform syncing updates for Action Groups */
-static void animchan_sync_group (bAnimContext *ac, bAnimListElem *ale)
+static void animchan_sync_group (bAnimContext *UNUSED(ac), bAnimListElem *ale)
{
bActionGroup *agrp= (bActionGroup *)ale->data;
ID *owner_id= ale->id;
@@ -154,7 +154,7 @@ static void animchan_sync_group (bAnimContext *ac, bAnimListElem *ale)
}
/* perform syncing updates for F-Curves */
-static void animchan_sync_fcurve (bAnimContext *ac, bAnimListElem *ale)
+static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale)
{
FCurve *fcu= (FCurve *)ale->data;
ID *owner_id= ale->id;
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index b564780f6c0..373ad5472ab 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -256,7 +256,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
/* Draw current frame number in a little box */
if (flag & DRAWCFRA_SHOW_NUMBOX) {
- UI_view2d_view_orthoSpecial(C, v2d, 1);
+ UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1);
draw_cfra_number(scene, v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS));
}
}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index feb680ff40a..08b4f8a7bc8 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -91,7 +91,7 @@
/* Get shapekey data being edited (for Action Editor -> ShapeKey mode) */
/* Note: there's a similar function in key.c (ob_get_key) */
-Key *actedit_get_shapekeys (bAnimContext *ac, SpaceAction *saction)
+static Key *actedit_get_shapekeys (bAnimContext *ac)
{
Scene *scene= ac->scene;
Object *ob;
@@ -153,7 +153,7 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction)
case SACTCONT_SHAPEKEY: /* 'ShapeKey Editor' */
ac->datatype= ANIMCONT_SHAPEKEY;
- ac->data= actedit_get_shapekeys(ac, saction);
+ ac->data= actedit_get_shapekeys(ac);
ac->mode= saction->mode;
return 1;
@@ -1065,7 +1065,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS
* - for normal filtering (i.e. for editing), we only need the NLA-tracks but they can be in 'normal' evaluation
* order, i.e. first to last. Otherwise, some tools may get screwed up.
*/
-static int animdata_filter_nla (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, AnimData *adt, int filter_mode, void *owner, short ownertype, ID *owner_id)
+static int animdata_filter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDopeSheet *UNUSED(ads), AnimData *adt, int filter_mode, void *owner, short ownertype, ID *owner_id)
{
bAnimListElem *ale;
NlaTrack *nlt;
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 5c4d231fd3a..055ee1c3392 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -336,7 +336,7 @@ void draw_markers_time(const bContext *C, int flag)
/* ************************** add markers *************************** */
/* add TimeMarker at curent frame */
-static int ed_marker_add(bContext *C, wmOperator *op)
+static int ed_marker_add(bContext *C, wmOperator *UNUSED(op))
{
ListBase *markers= context_get_markers(C);
TimeMarker *marker;
@@ -489,7 +489,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
}
/* note, init has to be called succesfully */
-static void ed_marker_move_apply(bContext *C, wmOperator *op)
+static void ed_marker_move_apply(wmOperator *op)
{
MarkerMove *mm= op->customdata;
TimeMarker *marker;
@@ -508,7 +508,7 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op)
static void ed_marker_move_cancel(bContext *C, wmOperator *op)
{
RNA_int_set(op->ptr, "frames", 0);
- ed_marker_move_apply(C, op);
+ ed_marker_move_apply(op);
ed_marker_move_exit(C, op);
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
@@ -565,7 +565,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
offs= (int)fac;
RNA_int_set(op->ptr, "frames", offs);
- ed_marker_move_apply(C, op);
+ ed_marker_move_apply(op);
/* cruft below is for header print */
for (a=0, marker= mm->markers->first; marker; marker= marker->next) {
@@ -632,7 +632,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
outputNumInput(&mm->num, str_tx);
RNA_int_set(op->ptr, "frames", vec[0]);
- ed_marker_move_apply(C, op);
+ ed_marker_move_apply(op);
// ed_marker_header_update(C, op, str, (int)vec[0]);
// strcat(str, str_tx);
sprintf(str, "Marker offset %s", str_tx);
@@ -649,7 +649,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
static int ed_marker_move_exec(bContext *C, wmOperator *op)
{
if(ed_marker_move_init(C, op)) {
- ed_marker_move_apply(C, op);
+ ed_marker_move_apply(op);
ed_marker_move_exit(C, op);
return OPERATOR_FINISHED;
}
@@ -697,7 +697,7 @@ callbacks:
/* duplicate selected TimeMarkers */
-static void ed_marker_duplicate_apply(bContext *C, wmOperator *op)
+static void ed_marker_duplicate_apply(bContext *C)
{
ListBase *markers= context_get_markers(C);
TimeMarker *marker, *newmarker;
@@ -731,7 +731,7 @@ static void ed_marker_duplicate_apply(bContext *C, wmOperator *op)
static int ed_marker_duplicate_exec(bContext *C, wmOperator *op)
{
- ed_marker_duplicate_apply(C, op);
+ ed_marker_duplicate_apply(C);
ed_marker_move_exec(C, op); /* assumes frs delta set */
return OPERATOR_FINISHED;
@@ -740,7 +740,7 @@ static int ed_marker_duplicate_exec(bContext *C, wmOperator *op)
static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *evt)
{
- ed_marker_duplicate_apply(C, op);
+ ed_marker_duplicate_apply(C);
return ed_marker_move_invoke(C, op, evt);
}
@@ -1033,7 +1033,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot)
/* ******************************* remove marker ***************** */
/* remove selected TimeMarkers */
-static int ed_marker_delete_exec(bContext *C, wmOperator *op)
+static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
ListBase *markers= context_get_markers(C);
TimeMarker *marker, *nmarker;
@@ -1130,7 +1130,7 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot)
/* ******************************* camera bind marker ***************** */
/* remove selected TimeMarkers */
-static int ed_marker_camera_bind_exec(bContext *C, wmOperator *op)
+static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
ListBase *markers= context_get_markers(C);
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 9b9c9435518..a80ea3e12bf 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -233,7 +233,7 @@ void ANIM_OT_previewrange_set(wmOperatorType *ot)
/* ****************** clear preview range operator ****************************/
-static int previewrange_clear_exec(bContext *C, wmOperator *op)
+static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
ScrArea *curarea= CTX_wm_area(C);
@@ -269,7 +269,7 @@ void ANIM_OT_previewrange_clear(wmOperatorType *ot)
/* ****************** time display toggle operator ****************************/
-static int toggle_time_exec(bContext *C, wmOperator *op)
+static int toggle_time_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *curarea= CTX_wm_area(C);
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 898d7db89fc..6ace48dd301 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -115,7 +115,7 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind
/* Main Driver Management API calls:
* Add a new driver for the specified property on the given ID block
*/
-short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short flag, int type)
+short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag), int type)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
@@ -193,7 +193,7 @@ short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short fla
/* Main Driver Management API calls:
* Remove the driver for the specified property on the given ID block (if available)
*/
-short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag)
+short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
AnimData *adt;
FCurve *fcu;
@@ -262,7 +262,7 @@ short ANIM_driver_can_paste (void)
/* Main Driver Management API calls:
* Make a copy of the driver for the specified property on the given ID block
*/
-short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short flag)
+short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
@@ -307,7 +307,7 @@ short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short fl
* Add a new driver for the specified property on the given ID block or replace an existing one
* with the driver + driver-curve data from the buffer
*/
-short ANIM_paste_driver (ID *id, const char rna_path[], int array_index, short flag)
+short ANIM_paste_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
@@ -472,7 +472,7 @@ void ANIM_OT_driver_button_remove (wmOperatorType *ot)
/* Copy Driver Button Operator ------------------------ */
-static int copy_driver_button_exec (bContext *C, wmOperator *op)
+static int copy_driver_button_exec (bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr;
PropertyRNA *prop= NULL;
@@ -518,7 +518,7 @@ void ANIM_OT_copy_driver_button (wmOperatorType *ot)
/* Paste Driver Button Operator ------------------------ */
-static int paste_driver_button_exec (bContext *C, wmOperator *op)
+static int paste_driver_button_exec (bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr;
PropertyRNA *prop= NULL;
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 35e6cb66d45..2b8d0f35b9a 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -74,7 +74,7 @@
}
/* callback to verify modifier data */
-static void validate_fmodifier_cb (bContext *C, void *fcm_v, void *dummy)
+static void validate_fmodifier_cb (bContext *UNUSED(C), void *fcm_v, void *UNUSED(arg))
{
FModifier *fcm= (FModifier *)fcm_v;
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
@@ -215,7 +215,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* --------------- */
/* draw settings for generator modifier */
-static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short width)
+static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
{
uiLayout *col;
PointerRNA ptr;
@@ -238,7 +238,7 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm
/* --------------- */
/* draw settings for cycles modifier */
-static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short width)
+static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
{
uiLayout *split, *col;
PointerRNA ptr;
@@ -267,7 +267,7 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor
/* --------------- */
/* draw settings for noise modifier */
-static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short width)
+static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
{
uiLayout *split, *col;
PointerRNA ptr;
@@ -374,7 +374,7 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float
/* callback to add new envelope data point */
// TODO: should we have a separate file for things like this?
-static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *dummy)
+static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *UNUSED(arg))
{
Scene *scene= CTX_data_scene(C);
FMod_Envelope *env= (FMod_Envelope *)fcm_dv;
@@ -426,7 +426,7 @@ static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *dummy)
/* callback to remove envelope data point */
// TODO: should we have a separate file for things like this?
-static void fmod_envelope_deletepoint_cb (bContext *C, void *fcm_dv, void *ind_v)
+static void fmod_envelope_deletepoint_cb (bContext *UNUSED(C), void *fcm_dv, void *ind_v)
{
FMod_Envelope *env= (FMod_Envelope *)fcm_dv;
FCM_EnvelopeData *fedn;
@@ -454,7 +454,7 @@ static void fmod_envelope_deletepoint_cb (bContext *C, void *fcm_dv, void *ind_v
}
/* draw settings for envelope modifier */
-static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short width)
+static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
{
FMod_Envelope *env= (FMod_Envelope *)fcm->data;
FCM_EnvelopeData *fed;
@@ -509,7 +509,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
/* --------------- */
/* draw settings for limits modifier */
-static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short width)
+static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
{
uiLayout *split, *col, *row;
PointerRNA ptr;
@@ -557,7 +557,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
/* --------------- */
/* draw settings for stepped interpolation modifier */
-static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short width)
+static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
{
uiLayout *col, *subcol;
PointerRNA ptr;
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 02e141a7a69..c895baa49f8 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -655,7 +655,7 @@ void draw_gpl_channel(View2D *v2d, bDopeSheet *ads, bGPDlayer *gpl, float ypos)
BLI_dlrbTree_init(&keys);
- gpl_to_keylist(ads, gpl, &keys, NULL);
+ gpl_to_keylist(ads, gpl, &keys);
BLI_dlrbTree_linkedlist_sync(&keys);
@@ -898,7 +898,7 @@ void action_to_keylist(AnimData *adt, bAction *act, DLRBT_Tree *keys, DLRBT_Tree
}
-void gpl_to_keylist(bDopeSheet *ads, bGPDlayer *gpl, DLRBT_Tree *keys, DLRBT_Tree *blocks)
+void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys)
{
bGPDframe *gpf;
ActKeyColumn *ak;
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 17d674784f8..0958b4870b5 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -369,7 +369,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, Scene *sce, KeyframeEdi
}
/* This function is used to loop over the keyframe data in a DopeSheet summary */
-static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag)
+static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int UNUSED(filterflag))
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -541,7 +541,7 @@ static short ok_bezier_framerange(KeyframeEditData *ked, BezTriple *bezt)
return ok;
}
-static short ok_bezier_selected(KeyframeEditData *ked, BezTriple *bezt)
+static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
/* this macro checks all beztriple handles for selection...
* only one of the verts has to be selected for this to be ok...
@@ -677,7 +677,7 @@ void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt)
/* Transform */
/* snaps the keyframe to the nearest frame */
-static short snap_bezier_nearest(KeyframeEditData *ked, BezTriple *bezt)
+static short snap_bezier_nearest(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->vec[1][0]= (float)(floor(bezt->vec[1][0]+0.5));
@@ -713,7 +713,7 @@ static short snap_bezier_nearmarker(KeyframeEditData *ked, BezTriple *bezt)
}
/* make the handles have the same value as the key */
-static short snap_bezier_horizontal(KeyframeEditData *ked, BezTriple *bezt)
+static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f2 & SELECT) {
bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1];
@@ -768,7 +768,7 @@ static short mirror_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
-static short mirror_bezier_yaxis(KeyframeEditData *ked, BezTriple *bezt)
+static short mirror_bezier_yaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
float diff;
@@ -780,7 +780,7 @@ static short mirror_bezier_yaxis(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
-static short mirror_bezier_xaxis(KeyframeEditData *ked, BezTriple *bezt)
+static short mirror_bezier_xaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
float diff;
@@ -841,7 +841,7 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
/* Settings */
/* Sets the selected bezier handles to type 'auto' */
-static short set_bezier_auto(KeyframeEditData *ked, BezTriple *bezt)
+static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
if (bezt->f1 & SELECT) bezt->h1= HD_AUTO; /* the secret code for auto */
@@ -859,7 +859,7 @@ static short set_bezier_auto(KeyframeEditData *ked, BezTriple *bezt)
}
/* Sets the selected bezier handles to type 'vector' */
-static short set_bezier_vector(KeyframeEditData *ked, BezTriple *bezt)
+static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
if (bezt->f1 & SELECT) bezt->h1= HD_VECT;
@@ -879,7 +879,7 @@ static short set_bezier_vector(KeyframeEditData *ked, BezTriple *bezt)
/* Queries if the handle should be set to 'free' or 'align' */
// NOTE: this was used for the 'toggle free/align' option
// currently this isn't used, but may be restored later
-static short bezier_isfree(KeyframeEditData *ked, BezTriple *bezt)
+static short bezier_isfree(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if ((bezt->f1 & SELECT) && (bezt->h1)) return 1;
if ((bezt->f3 & SELECT) && (bezt->h2)) return 1;
@@ -887,7 +887,7 @@ static short bezier_isfree(KeyframeEditData *ked, BezTriple *bezt)
}
/* Sets selected bezier handles to type 'align' */
-static short set_bezier_align(KeyframeEditData *ked, BezTriple *bezt)
+static short set_bezier_align(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f1 & SELECT) bezt->h1= HD_ALIGN;
if (bezt->f3 & SELECT) bezt->h2= HD_ALIGN;
@@ -895,7 +895,7 @@ static short set_bezier_align(KeyframeEditData *ked, BezTriple *bezt)
}
/* Sets selected bezier handles to type 'free' */
-static short set_bezier_free(KeyframeEditData *ked, BezTriple *bezt)
+static short set_bezier_free(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f1 & SELECT) bezt->h1= HD_FREE;
if (bezt->f3 & SELECT) bezt->h2= HD_FREE;
@@ -925,21 +925,21 @@ KeyframeEditFunc ANIM_editkeyframes_handles(short code)
/* ------- */
-static short set_bezt_constant(KeyframeEditData *ked, BezTriple *bezt)
+static short set_bezt_constant(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->ipo= BEZT_IPO_CONST;
return 0;
}
-static short set_bezt_linear(KeyframeEditData *ked, BezTriple *bezt)
+static short set_bezt_linear(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->ipo= BEZT_IPO_LIN;
return 0;
}
-static short set_bezt_bezier(KeyframeEditData *ked, BezTriple *bezt)
+static short set_bezt_bezier(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f2 & SELECT)
bezt->ipo= BEZT_IPO_BEZ;
@@ -962,21 +962,21 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code)
/* ------- */
-static short set_keytype_keyframe(KeyframeEditData *ked, BezTriple *bezt)
+static short set_keytype_keyframe(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_KEYFRAME;
return 0;
}
-static short set_keytype_breakdown(KeyframeEditData *ked, BezTriple *bezt)
+static short set_keytype_breakdown(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_BREAKDOWN;
return 0;
}
-static short set_keytype_extreme(KeyframeEditData *ked, BezTriple *bezt)
+static short set_keytype_extreme(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
if (bezt->f2 & SELECT)
BEZKEYTYPE(bezt)= BEZT_KEYTYPE_EXTREME;
@@ -1038,7 +1038,7 @@ static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
-static short select_bezier_invert(KeyframeEditData *ked, BezTriple *bezt)
+static short select_bezier_invert(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
{
/* Invert the selection for the whole bezier triple */
bezt->f2 ^= SELECT;
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index befcc0a71cb..68e38d04620 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -486,7 +486,7 @@ void free_anim_copybuf (void)
/* ------------------- */
/* This function adds data to the keyframes copy/paste buffer, freeing existing data first */
-short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data)
+short copy_animedit_keys (bAnimContext *UNUSED(ac), ListBase *anim_data)
{
bAnimListElem *ale;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index e92065eea91..ddd692d26ea 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -917,7 +917,7 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_
* The flag argument is used for special settings that alter the behaviour of
* the keyframe deletion. These include the quick refresh options.
*/
-short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag)
+short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag))
{
AnimData *adt= BKE_animdata_from_id(id);
PointerRNA id_ptr, ptr;
@@ -1146,7 +1146,7 @@ void ANIM_OT_keyframe_insert (wmOperatorType *ot)
* then calls the menu if necessary before
*/
-static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *event)
+static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene= CTX_data_scene(C);
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 77e0c84d2f3..57617651823 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -107,7 +107,7 @@ static int keyingset_poll_activePath_edit (bContext *C)
/* Add a Default (Empty) Keying Set ------------------------- */
-static int add_default_keyingset_exec (bContext *C, wmOperator *op)
+static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
short flag=0, keyingflag=0;
@@ -464,7 +464,7 @@ void ANIM_OT_keyingset_button_remove (wmOperatorType *ot)
/* Change Active KeyingSet Operator ------------------------ */
/* This operator checks if a menu should be shown for choosing the KeyingSet to make the active one */
-static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *event)
+static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
/* call the menu, which will call this operator again, hence the cancelled */
ANIM_keying_sets_menu_setup(C, op->type->name, "ANIM_OT_keying_set_active_set");
@@ -558,7 +558,7 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[
/* --------------- */
/* Add the given KeyingSetInfo to the list of type infos, and create an appropriate builtin set too */
-void ANIM_keyingset_info_register (const bContext *C, KeyingSetInfo *ksi)
+void ANIM_keyingset_info_register (KeyingSetInfo *ksi)
{
KeyingSet *ks;
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index 2d28d3cb9e5..acbfec125e0 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -51,9 +51,7 @@ void ARMATURE_OT_align(struct wmOperatorType *ot);
void ARMATURE_OT_calculate_roll(struct wmOperatorType *ot);
void ARMATURE_OT_switch_direction(struct wmOperatorType *ot);
-void ARMATURE_OT_subdivs(struct wmOperatorType *ot);
-void ARMATURE_OT_subdivide_simple(struct wmOperatorType *ot);
-void ARMATURE_OT_subdivide_multi(struct wmOperatorType *ot);
+void ARMATURE_OT_subdivide(struct wmOperatorType *ot);
void ARMATURE_OT_parent_set(struct wmOperatorType *ot);
void ARMATURE_OT_parent_clear(struct wmOperatorType *ot);
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index 78b0b2e5e0d..ff4accfd066 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -57,9 +57,7 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(ARMATURE_OT_align);
WM_operatortype_append(ARMATURE_OT_calculate_roll);
WM_operatortype_append(ARMATURE_OT_switch_direction);
- WM_operatortype_append(ARMATURE_OT_subdivs);
- WM_operatortype_append(ARMATURE_OT_subdivide_simple);
- WM_operatortype_append(ARMATURE_OT_subdivide_multi);
+ WM_operatortype_append(ARMATURE_OT_subdivide);
WM_operatortype_append(ARMATURE_OT_parent_set);
WM_operatortype_append(ARMATURE_OT_parent_clear);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index ead5d44d393..c8c0a4e6980 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -558,7 +558,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob)
static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C); // must be active object, not edit-object
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object
bArmature *arm= get_armature(ob);
bPose *pose;
bPoseChannel *pchan;
@@ -655,10 +655,10 @@ void POSE_OT_armature_apply (wmOperatorType *ot)
/* set the current pose as the restpose */
-static int pose_visual_transform_apply_exec (bContext *C, wmOperator *op)
+static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C); // must be active object, not edit-object
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object
/* don't check if editmode (should be done by caller) */
if (ob->type!=OB_ARMATURE)
@@ -817,7 +817,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
}
/* join armature exec is exported for use in object->join objects operator... */
-int join_armature_exec(bContext *C, wmOperator *op)
+int join_armature_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -1075,7 +1075,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
* sel: remove selected bones from the armature, otherwise the unselected bones are removed
* (ob is not in editmode)
*/
-static void separate_armature_bones (Scene *scene, Object *ob, short sel)
+static void separate_armature_bones(Object *ob, short sel)
{
bArmature *arm= (bArmature *)ob->data;
bPoseChannel *pchan, *pchann;
@@ -1127,7 +1127,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel)
}
/* separate selected bones into their armature */
-static int separate_armature_exec (bContext *C, wmOperator *op)
+static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -1176,8 +1176,8 @@ static int separate_armature_exec (bContext *C, wmOperator *op)
/* 3) remove bones that shouldn't still be around on both armatures */
- separate_armature_bones(scene, oldob, 1);
- separate_armature_bones(scene, newob, 0);
+ separate_armature_bones(oldob, 1);
+ separate_armature_bones(newob, 0);
/* 4) fix links before depsgraph flushes */ // err... or after?
@@ -1389,7 +1389,7 @@ static int pose_setflag_exec (bContext *C, wmOperator *op)
CTX_DATA_END;
/* note, notifier might evolve */
- WM_event_add_notifier(C, NC_OBJECT|ND_POSE, CTX_data_active_object(C));
+ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ED_object_pose_armature(CTX_data_active_object(C)));
return OPERATOR_FINISHED;
}
@@ -1787,7 +1787,7 @@ EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo)
/* previously delete_armature */
/* only editmode! */
-static int armature_delete_selected_exec(bContext *C, wmOperator *op)
+static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
bArmature *arm;
EditBone *curBone, *next;
@@ -2087,7 +2087,7 @@ float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3])
/* Set roll value for given bone -> Z-Axis Point up (original method) */
-static void auto_align_ebone_zaxisup(Scene *scene, View3D *v3d, EditBone *ebone)
+static void auto_align_ebone_zaxisup(Scene *UNUSED(scene), View3D *UNUSED(v3d), EditBone *ebone)
{
float delta[3], curmat[3][3];
float xaxis[3]={1.0f, 0.0f, 0.0f}, yaxis[3], zaxis[3]={0.0f, 0.0f, 1.0f};
@@ -2377,7 +2377,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
/* previously addvert_armature */
/* the ctrl-click method */
-static int armature_click_extrude_exec(bContext *C, wmOperator *op)
+static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d;
bArmature *arm;
@@ -2691,7 +2691,7 @@ EditBone *duplicateEditBone(EditBone *curBone, char *name, ListBase *editbones,
}
/* previously adduplicate_armature */
-static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
+static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
bArmature *arm;
EditBone *eBone = NULL;
@@ -3262,7 +3262,7 @@ void ARMATURE_OT_merge (wmOperatorType *ot)
/* ************** END Add/Remove stuff in editmode ************ */
/* *************** Tools in editmode *********** */
-static int armature_hide_exec(bContext *C, wmOperator *op)
+static int armature_hide_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
bArmature *arm= obedit->data;
@@ -3302,7 +3302,7 @@ void ARMATURE_OT_hide(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int armature_reveal_exec(bContext *C, wmOperator *op)
+static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
bArmature *arm= obedit->data;
@@ -3632,10 +3632,7 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
int numcuts, i;
/* there may not be a number_cuts property defined (for 'simple' subdivide) */
- if (RNA_property_is_set(op->ptr, "number_cuts"))
- numcuts= RNA_int_get(op->ptr, "number_cuts");
- else
- numcuts= 1;
+ numcuts= RNA_int_get(op->ptr, "number_cuts");
/* loop over all editable bones */
// XXX the old code did this in reverse order though!
@@ -3690,26 +3687,11 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-
-void ARMATURE_OT_subdivide_simple(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Subdivide Simple";
- ot->idname= "ARMATURE_OT_subdivide_simple";
-
- /* api callbacks */
- ot->exec = armature_subdivide_exec;
- ot->poll = ED_operator_editarmature;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-void ARMATURE_OT_subdivide_multi(wmOperatorType *ot)
+void ARMATURE_OT_subdivide(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Subdivide Multi";
- ot->idname= "ARMATURE_OT_subdivide_multi";
+ ot->idname= "ARMATURE_OT_subdivide";
/* api callbacks */
ot->exec = armature_subdivide_exec;
@@ -3719,65 +3701,7 @@ void ARMATURE_OT_subdivide_multi(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* Properties */
- RNA_def_int(ot->srna, "number_cuts", 2, 1, INT_MAX, "Number of Cuts", "", 1, 10);
-}
-
-
-
-static int armature_subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- uiPopupMenu *pup;
- uiLayout *layout;
-
- pup= uiPupMenuBegin(C, "Subdivision Type", 0);
- layout= uiPupMenuLayout(pup);
- uiItemsEnumO(layout, "ARMATURE_OT_subdivs", "type");
- uiPupMenuEnd(C, pup);
-
- return OPERATOR_CANCELLED;
-}
-
-static int armature_subdivs_exec(bContext *C, wmOperator *op)
-{
- switch (RNA_int_get(op->ptr, "type"))
- {
- case 0: /* simple */
- RNA_int_set(op->ptr, "number_cuts", 1);
- armature_subdivide_exec(C, op);
- break;
- case 1: /* multi */
- armature_subdivide_exec(C, op);
- break;
- }
-
- return OPERATOR_FINISHED;
-}
-
-void ARMATURE_OT_subdivs(wmOperatorType *ot)
-{
- static EnumPropertyItem type_items[]= {
- {0, "SIMPLE", 0, "Simple", ""},
- {1, "MULTI", 0, "Multi", ""},
- {0, NULL, 0, NULL, NULL}};
-
- /* identifiers */
- ot->name= "subdivs";
- ot->idname= "ARMATURE_OT_subdivs";
-
- /* api callbacks */
- ot->invoke= armature_subdivs_invoke;
- ot->exec= armature_subdivs_exec;
-
- ot->poll= ED_operator_editarmature;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* props */
- RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
-
- /* this is temp, the ops are different, but they are called from subdivs, so all the possible props should be here as well*/
- RNA_def_int(ot->srna, "number_cuts", 2, 1, INT_MAX, "Number of Cuts", "", 1, 10);
+ RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
}
/* ----------- */
@@ -3788,7 +3712,7 @@ void ARMATURE_OT_subdivs(wmOperatorType *ot)
* this to be done easily.
*/
-static int armature_switch_direction_exec(bContext *C, wmOperator *op)
+static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_edit_object(C);
bArmature *arm= (bArmature *)ob->data;
@@ -4009,7 +3933,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int armature_parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
EditBone *actbone = CTX_data_active_bone(C);
uiPopupMenu *pup= uiPupMenuBegin(C, "Make Parent ", 0);
@@ -4106,7 +4030,7 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot)
/* **************** Selections ******************/
-static int armature_select_inverse_exec(bContext *C, wmOperator *op)
+static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
/* Set the flags */
CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) {
@@ -4552,7 +4476,7 @@ void ED_pose_deselectall (Object *ob, int test)
arm->act_bone= NULL;
}
-static int bone_skinnable(Object *ob, Bone *bone, void *datap)
+static int bone_skinnable_cb(Object *ob, Bone *bone, void *datap)
{
/* Bones that are deforming
* are regarded to be "skinnable" and are eligible for
@@ -4601,7 +4525,7 @@ static int bone_skinnable(Object *ob, Bone *bone, void *datap)
return 0;
}
-static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data)
+static int vgroup_add_unique_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
{
/* This group creates a vertex group to ob that has the
* same name as bone (provided the bone is skinnable).
@@ -4616,7 +4540,7 @@ static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data)
return 0;
}
-static int dgroup_skinnable(Object *ob, Bone *bone, void *datap)
+static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap)
{
/* Bones that are deforming
* are regarded to be "skinnable" and are eligible for
@@ -4672,7 +4596,7 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap)
return 0;
}
-static void add_vgroups__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
+static void add_vgroups__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
/* DerivedMesh mapFunc for getting final coords in weight paint mode */
@@ -4723,7 +4647,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i
}
}
-void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int mirror)
+void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, int mirror)
{
/* This functions implements the automatic computation of vertex group
* weights, either through envelopes or using a heat equilibrium.
@@ -4755,7 +4679,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
looper_data.list= NULL;
/* count the number of skinnable bones */
- numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable);
+ numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb);
if (numbones == 0)
return;
@@ -4764,7 +4688,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
* and fill it with all of the skinnable bones */
bonelist = MEM_callocN(numbones*sizeof(Bone *), "bonelist");
looper_data.list= bonelist;
- bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable);
+ bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb);
/* create an array of pointers to the deform groups that
* coorespond to the skinnable bones (creating them
@@ -4773,7 +4697,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
dgroupflip = MEM_callocN(numbones*sizeof(bDeformGroup *), "dgroupflip");
looper_data.list= dgrouplist;
- bone_looper(ob, arm->bonebase.first, &looper_data, dgroup_skinnable);
+ bone_looper(ob, arm->bonebase.first, &looper_data, dgroup_skinnable_cb);
/* create an array of root and tip positions transformed into
* global coords */
@@ -4870,14 +4794,22 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
/* compute the weights based on gathered vertices and bones */
if (heat) {
+ const char *error= NULL;
heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip,
- root, tip, selected);
+ root, tip, selected, &error);
+
+ if(error) {
+ BKE_report(reports, RPT_WARNING, error);
+ }
}
else {
envelope_bone_weighting(ob, mesh, verts, numbones, bonelist, dgrouplist,
dgroupflip, root, tip, selected, mat4_to_scale(par->obmat));
}
-
+
+ /* only generated in some cases but can call anyway */
+ mesh_octree_table(ob, NULL, NULL, 'e');
+
/* free the memory allocated */
MEM_freeN(bonelist);
MEM_freeN(dgrouplist);
@@ -4888,7 +4820,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
MEM_freeN(verts);
}
-void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mode, int mirror)
+void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, int mode, int mirror)
{
/* Lets try to create some vertex groups
* based on the bones of the parent armature.
@@ -4899,7 +4831,7 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod
/* Traverse the bone list, trying to create empty vertex
* groups cooresponding to the bone.
*/
- bone_looper(ob, arm->bonebase.first, NULL, ED_vgroup_add_unique_bone);
+ bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb);
if (ob->type == OB_MESH)
ED_vgroup_data_create(ob->data);
@@ -4909,15 +4841,15 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod
* that are populated with the vertices for which the
* bone is closest.
*/
- add_verts_to_dgroups(scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror);
+ add_verts_to_dgroups(reports, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror);
}
}
/* ************* Clear Pose *****************************/
-static int pose_clear_scale_exec(bContext *C, wmOperator *op)
+static int pose_clear_scale_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
short autokey = 0;
/* only clear those channels that are not locked */
@@ -4956,7 +4888,7 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op)
/* now recalculate paths */
if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS))
- ED_pose_recalculate_paths(C, scene, ob);
+ ED_pose_recalculate_paths(scene, ob);
}
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
@@ -4982,10 +4914,10 @@ void POSE_OT_scale_clear(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int pose_clear_loc_exec(bContext *C, wmOperator *op)
+static int pose_clear_loc_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
short autokey = 0;
/* only clear those channels that are not locked */
@@ -5025,7 +4957,7 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op)
/* now recalculate paths */
if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS))
- ED_pose_recalculate_paths(C, scene, ob);
+ ED_pose_recalculate_paths(scene, ob);
}
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
@@ -5051,10 +4983,10 @@ void POSE_OT_loc_clear(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int pose_clear_rot_exec(bContext *C, wmOperator *op)
+static int pose_clear_rot_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
short autokey = 0;
/* only clear those channels that are not locked */
@@ -5178,7 +5110,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
/* now recalculate paths */
if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS))
- ED_pose_recalculate_paths(C, scene, ob);
+ ED_pose_recalculate_paths(scene, ob);
}
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
@@ -5207,7 +5139,7 @@ void POSE_OT_rot_clear(wmOperatorType *ot)
/* ***************** selections ********************** */
-static int pose_select_inverse_exec(bContext *C, wmOperator *op)
+static int pose_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
/* Set the flags */
@@ -5304,9 +5236,9 @@ void POSE_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
-static int pose_select_parent_exec(bContext *C, wmOperator *op)
+static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bPoseChannel *pchan,*parent;
/* Determine if there is an active bone */
@@ -5348,7 +5280,7 @@ void POSE_OT_select_parent(wmOperatorType *ot)
/* ************* hide/unhide pose bones ******************* */
-static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr)
+static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
{
bArmature *arm= ob->data;
@@ -5363,7 +5295,7 @@ static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr)
return 0;
}
-static int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr)
+static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
{
bArmature *arm= ob->data;
@@ -5381,15 +5313,13 @@ static int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr)
/* active object is armature in posemode, poll checked */
static int pose_hide_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm= ob->data;
if(RNA_boolean_get(op->ptr, "unselected"))
- bone_looper(ob, arm->bonebase.first, NULL,
- hide_unselected_pose_bone);
+ bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb);
else
- bone_looper(ob, arm->bonebase.first, NULL,
- hide_selected_pose_bone);
+ bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob);
@@ -5414,7 +5344,7 @@ void POSE_OT_hide(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "");
}
-static int show_pose_bone(Object *ob, Bone *bone, void *ptr)
+static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
{
bArmature *arm= ob->data;
@@ -5429,12 +5359,12 @@ static int show_pose_bone(Object *ob, Bone *bone, void *ptr)
}
/* active object is armature in posemode, poll checked */
-static int pose_reveal_exec(bContext *C, wmOperator *op)
+static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm= ob->data;
- bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone);
+ bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob);
@@ -5626,7 +5556,7 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
}
-static int armature_flip_names_exec (bContext *C, wmOperator *op)
+static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_edit_object(C);
bArmature *arm;
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c
index 1c9024f6f91..6eda622ead8 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -46,7 +46,7 @@
#include "armature_intern.h"
#include "BIF_generate.h"
-void setBoneRollFromNormal(EditBone *bone, float *no, float invmat[][4], float tmat[][3])
+void setBoneRollFromNormal(EditBone *bone, float *no, float UNUSED(invmat[][4]), float tmat[][3])
{
if (no != NULL && !is_zero_v3(no))
{
@@ -118,7 +118,7 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
}
}
-int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int start, int end, float head[3], float p[3])
+int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int start, int end, float UNUSED(head[3]), float p[3])
{
static float stroke_length = 0;
static float current_length;
@@ -277,7 +277,7 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
return -1;
}
-EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *editbones, BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion)
+EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *UNUSED(editbones), BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion)
{
EditBone *lastBone = NULL;
EditBone *child = NULL;
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 637c6076314..e80f1494d8c 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -374,7 +374,7 @@ static RigNode *newRigNodeHead(RigGraph *rg, RigArc *arc, float p[3])
return node;
}
-static void addRigNodeHead(RigGraph *rg, RigArc *arc, RigNode *node)
+static void addRigNodeHead(RigGraph *UNUSED(rg), RigArc *arc, RigNode *node)
{
node->degree++;
@@ -1784,7 +1784,7 @@ static void repositionTailControl(RigGraph *rigg, RigControl *ctrl)
finalizeControl(rigg, ctrl, 1); /* resize will be recalculated anyway so we don't need it */
}
-static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], float tail[3], float qrot[4], float resize)
+static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], float UNUSED(tail[3]), float qrot[4], float resize)
{
float parent_offset[3], tail_offset[3];
@@ -2051,7 +2051,7 @@ static float calcCostLengthDistance(BArcIterator *iter, float **vec_cache, RigEd
}
#endif
-static float calcCostAngleLengthDistance(BArcIterator *iter, float **vec_cache, RigEdge *edge, float *vec0, float *vec1, float *vec2, int i1, int i2, float angle_weight, float length_weight, float distance_weight)
+static float calcCostAngleLengthDistance(BArcIterator *iter, float **UNUSED(vec_cache), RigEdge *edge, float *vec0, float *vec1, float *vec2, int i1, int i2, float angle_weight, float length_weight, float distance_weight)
{
float vec_second[3], vec_first[3];
float length2;
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 241301b8ee1..93bddb3834b 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -184,7 +184,7 @@ void BIF_makeListTemplates(const bContext *C)
}
}
-char *BIF_listTemplates(const bContext *C)
+char *BIF_listTemplates(const bContext *UNUSED(C))
{
GHashIterator ghi;
char menu_header[] = "Template%t|None%x0|";
@@ -309,7 +309,7 @@ char * BIF_nameBoneTemplate(const bContext *C)
return RIG_nameBone(rg, 0, index);
}
-void BIF_freeTemplates(bContext *C)
+void BIF_freeTemplates(bContext *UNUSED(C))
{
if (TEMPLATES_MENU != NULL)
{
@@ -1029,7 +1029,7 @@ void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_DrawData
sub_v3_v3v3(vec, fp, dvec);
}
-int sk_getStrokeDrawPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd)
+int sk_getStrokeDrawPoint(bContext *C, SK_Point *pt, SK_Sketch *UNUSED(sketch), SK_Stroke *stk, SK_DrawData *dd)
{
pt->type = dd->type;
pt->mode = PT_PROJECT;
@@ -1773,7 +1773,7 @@ int sk_getSegments(SK_Stroke *segments, SK_Stroke *gesture)
return segments->nb_points - 1;
}
-int sk_detectCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+int sk_detectCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
if (gest->nb_segments == 1 && gest->nb_intersections == 1)
{
@@ -1783,7 +1783,7 @@ int sk_detectCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
return 0;
}
-void sk_applyCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
SK_Intersection *isect;
@@ -1800,7 +1800,7 @@ void sk_applyCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
}
}
-int sk_detectTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+int sk_detectTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
if (gest->nb_segments == 2 && gest->nb_intersections == 1 && gest->nb_self_intersections == 0)
{
@@ -1821,7 +1821,7 @@ int sk_detectTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
return 0;
}
-void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
SK_Intersection *isect;
float trim_dir[3];
@@ -1856,7 +1856,7 @@ void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
}
}
-int sk_detectCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 1)
{
@@ -1883,7 +1883,7 @@ int sk_detectCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
return 0;
}
-void sk_applyCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
SK_Intersection *isect;
int command = 1;
@@ -1918,7 +1918,7 @@ void sk_applyCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
}
}
-int sk_detectDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
if (gest->nb_segments == 2 && gest->nb_intersections == 2)
{
@@ -1939,7 +1939,7 @@ int sk_detectDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
return 0;
}
-void sk_applyDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+void sk_applyDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *sketch)
{
SK_Intersection *isect;
@@ -1955,7 +1955,7 @@ void sk_applyDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
}
}
-int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
ARegion *ar = CTX_wm_region(C);
if (gest->nb_segments > 2 && gest->nb_intersections == 2)
@@ -2003,7 +2003,7 @@ int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
return 0;
}
-void sk_applyMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+void sk_applyMergeGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
SK_Intersection *isect;
@@ -2034,7 +2034,7 @@ void sk_applyMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
}
}
-int sk_detectReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+int sk_detectReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 0)
{
@@ -2076,7 +2076,7 @@ int sk_detectReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
return 0;
}
-void sk_applyReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+void sk_applyReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
SK_Intersection *isect;
@@ -2093,7 +2093,7 @@ void sk_applyReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
}
}
-int sk_detectConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+int sk_detectConvertGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
if (gest->nb_segments == 3 && gest->nb_self_intersections == 1)
{
@@ -2102,7 +2102,7 @@ int sk_detectConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
return 0;
}
-void sk_applyConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
+void sk_applyConvertGesture(bContext *C, SK_Gesture *UNUSED(gest), SK_Sketch *sketch)
{
sk_convert(C, sketch);
}
@@ -2215,7 +2215,7 @@ void sk_queueRedrawSketch(SK_Sketch *sketch)
}
}
-void sk_drawSketch(Scene *scene, View3D *v3d, SK_Sketch *sketch, int with_names)
+void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch, int with_names)
{
ToolSettings *ts= scene->toolsettings;
SK_Stroke *stk;
@@ -2452,7 +2452,7 @@ void BDR_drawSketch(const bContext *C)
}
}
-static int sketch_delete(bContext *C, wmOperator *op, wmEvent *event)
+static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
if (sketch)
@@ -2558,7 +2558,7 @@ SK_Sketch* viewcontextSketch(ViewContext *vc, int create)
return sketch;
}
-static int sketch_convert(bContext *C, wmOperator *op, wmEvent *event)
+static int sketch_convert(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
if (sketch != NULL)
@@ -2569,7 +2569,7 @@ static int sketch_convert(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_FINISHED;
}
-static int sketch_cancel(bContext *C, wmOperator *op, wmEvent *event)
+static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
if (sketch != NULL)
@@ -2581,7 +2581,7 @@ static int sketch_cancel(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_PASS_THROUGH;
}
-static int sketch_finish(bContext *C, wmOperator *op, wmEvent *event)
+static int sketch_finish(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
if (sketch != NULL)
@@ -2595,7 +2595,7 @@ static int sketch_finish(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_PASS_THROUGH;
}
-static int sketch_select(bContext *C, wmOperator *op, wmEvent *event)
+static int sketch_select(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
SK_Sketch *sketch = contextSketch(C, 0);
if (sketch)
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 84b02b4796a..f193defc129 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -61,8 +61,8 @@
/* ************* XXX *************** */
-static void waitcursor(int val) {}
-static void progress_bar(int dummy_val, const char *dummy) {}
+static void waitcursor(int UNUSED(val)) {}
+static void progress_bar(int UNUSED(dummy_val), const char *UNUSED(dummy)) {}
static void start_progress_bar() {}
static void end_progress_bar() {}
static void error(char *str) { printf("error: %s\n", str); }
@@ -362,7 +362,7 @@ void laplacian_begin_solve(LaplacianSystem *sys, int index)
}
}
-void laplacian_add_right_hand_side(LaplacianSystem *sys, int v, float value)
+void laplacian_add_right_hand_side(LaplacianSystem *UNUSED(sys), int v, float value)
{
nlRightHandSideAdd(0, v, value);
}
@@ -398,7 +398,7 @@ typedef struct BVHCallbackUserData {
LaplacianSystem *sys;
} BVHCallbackUserData;
-static void bvh_callback(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
+static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit)
{
BVHCallbackUserData *data = (struct BVHCallbackUserData*)userdata;
MFace *mf = data->sys->heat.mface + index;
@@ -642,13 +642,15 @@ static float heat_limit_weight(float weight)
return weight;
}
-void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected)
+void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected, const char **err_str)
{
LaplacianSystem *sys;
MFace *mface;
float solution, weight;
int *vertsflipped = NULL, *mask= NULL;
int a, totface, j, bbone, firstsegment, lastsegment, thrownerror = 0;
+
+ *err_str= NULL;
/* count triangles and create mask */
if(me->editflag & ME_EDIT_PAINT_MASK)
@@ -760,8 +762,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
}
}
else if(!thrownerror) {
- error("Bone Heat Weighting:"
- " failed to find solution for one or more bones");
+ *err_str= "Bone Heat Weighting: failed to find solution for one or more bones";
thrownerror= 1;
break;
}
@@ -1400,7 +1401,7 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
MEM_freeN(stack);
}
-static float meshdeform_boundary_phi(MeshDeformBind *mdb, MDefBoundIsect *isect, int cagevert)
+static float meshdeform_boundary_phi(MeshDeformBind *UNUSED(mdb), MDefBoundIsect *isect, int cagevert)
{
int a;
@@ -1411,7 +1412,7 @@ static float meshdeform_boundary_phi(MeshDeformBind *mdb, MDefBoundIsect *isect,
return 0.0f;
}
-static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *vec, int cagevert)
+static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNUSED(vec), int UNUSED(cagevert))
{
float dvec[3], ivec[3], wx, wy, wz, result=0.0f;
float weight, totweight= 0.0f;
@@ -1562,7 +1563,7 @@ static void meshdeform_matrix_add_semibound_phi(MeshDeformBind *mdb, int x, int
}
}
-static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y, int z, int cagevert)
+static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y, int z, int UNUSED(cagevert))
{
float phi, totweight;
int i, a, acenter;
@@ -1711,7 +1712,7 @@ static void meshdeform_matrix_solve(MeshDeformBind *mdb)
nlDeleteContext(context);
}
-static void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, MeshDeformBind *mdb)
+static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierData *mmd, MeshDeformBind *mdb)
{
MDefBindInfluence *inf;
MDefInfluence *mdinf;
diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h
index 640eb33c945..cba43043e8d 100644
--- a/source/blender/editors/armature/meshlaplacian.h
+++ b/source/blender/editors/armature/meshlaplacian.h
@@ -66,7 +66,7 @@ float laplacian_system_get_solution(int v);
void heat_bone_weighting(struct Object *ob, struct Mesh *me, float (*verts)[3],
int numbones, struct bDeformGroup **dgrouplist,
struct bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3],
- int *selected);
+ int *selected, const char **error);
#ifdef RIGID_DEFORM
/* As-Rigid-As-Possible Deformation */
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index 8d8f1bf24ee..7b2ec9891f4 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -119,7 +119,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode)
/* get info from context */
pso->scene= CTX_data_scene(C);
- pso->ob= CTX_data_active_object(C);
+ pso->ob= ED_object_pose_armature(CTX_data_active_object(C));
pso->arm= (pso->ob)? pso->ob->data : NULL;
pso->ar= CTX_wm_region(C); /* only really needed when doing modal() */
@@ -157,7 +157,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode)
}
/* exiting the operator - free data */
-static void pose_slide_exit (bContext *C, wmOperator *op)
+static void pose_slide_exit(wmOperator *op)
{
tPoseSlideOp *pso= op->customdata;
@@ -376,7 +376,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
}
/* apply() - perform the pose sliding based on weighting various poses */
-static void pose_slide_apply (bContext *C, wmOperator *op, tPoseSlideOp *pso)
+static void pose_slide_apply(bContext *C, tPoseSlideOp *pso)
{
tPChanFCurveLink *pfl;
@@ -434,7 +434,7 @@ static void pose_slide_autoKeyframe (bContext *C, tPoseSlideOp *pso)
}
/* reset changes made to current pose */
-static void pose_slide_reset (bContext *C, tPoseSlideOp *pso)
+static void pose_slide_reset (tPoseSlideOp *pso)
{
/* wrapper around the generic call, so that custom stuff can be added later */
poseAnim_mapping_reset(&pso->pfLinks);
@@ -501,7 +501,7 @@ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp *
/* initial apply for operator... */
// TODO: need to calculate percentage for initial round too...
- pose_slide_apply(C, op, pso);
+ pose_slide_apply(C, pso);
/* depsgraph updates + redraws */
pose_slide_refresh(C, pso);
@@ -528,7 +528,7 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt)
/* insert keyframes as required... */
pose_slide_autoKeyframe(C, pso);
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
/* done! */
return OPERATOR_FINISHED;
@@ -541,13 +541,13 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt)
WM_cursor_restore(win);
/* reset transforms back to original state */
- pose_slide_reset(C, pso);
+ pose_slide_reset(pso);
/* depsgraph updates + redraws */
pose_slide_refresh(C, pso);
/* clean up temp data */
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
/* cancelled! */
return OPERATOR_CANCELLED;
@@ -562,10 +562,10 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt)
RNA_float_set(op->ptr, "percentage", pso->percentage);
/* reset transforms (to avoid accumulation errors) */
- pose_slide_reset(C, pso);
+ pose_slide_reset(pso);
/* apply... */
- pose_slide_apply(C, op, pso);
+ pose_slide_apply(C, pso);
}
break;
@@ -579,10 +579,10 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt)
}
/* common code for cancel() */
-static int pose_slide_cancel (bContext *C, wmOperator *op)
+static int pose_slide_cancel (bContext *UNUSED(C), wmOperator *op)
{
/* cleanup and done */
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
@@ -590,13 +590,13 @@ static int pose_slide_cancel (bContext *C, wmOperator *op)
static int pose_slide_exec_common (bContext *C, wmOperator *op, tPoseSlideOp *pso)
{
/* settings should have been set up ok for applying, so just apply! */
- pose_slide_apply(C, op, pso);
+ pose_slide_apply(C, pso);
/* insert keyframes if needed */
pose_slide_autoKeyframe(C, pso);
/* cleanup and done */
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
return OPERATOR_FINISHED;
}
@@ -612,13 +612,13 @@ static void pose_slide_opdef_properties (wmOperatorType *ot)
/* ------------------------------------ */
/* invoke() - for 'push' mode */
-static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
tPoseSlideOp *pso;
/* initialise data */
if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) {
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else
@@ -635,7 +635,7 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op)
/* initialise data (from RNA-props) */
if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) {
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else
@@ -669,13 +669,13 @@ void POSE_OT_push (wmOperatorType *ot)
/* ........................ */
/* invoke() - for 'relax' mode */
-static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
tPoseSlideOp *pso;
/* initialise data */
if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) {
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else
@@ -692,7 +692,7 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op)
/* initialise data (from RNA-props) */
if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) {
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else
@@ -726,13 +726,13 @@ void POSE_OT_relax (wmOperatorType *ot)
/* ........................ */
/* invoke() - for 'breakdown' mode */
-static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
tPoseSlideOp *pso;
/* initialise data */
if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) {
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else
@@ -749,7 +749,7 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op)
/* initialise data (from RNA-props) */
if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) {
- pose_slide_exit(C, op);
+ pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 6083616044e..a595396b15d 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -268,9 +268,9 @@ static KeyingSet *poselib_ks_locrotscale = NULL; /* the only keyingset we'll ne
/* ----- */
-static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *arg)
+static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *UNUSED(arg))
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bAction *act= ob->poselib;
TimeMarker *marker;
@@ -290,10 +290,10 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout,
}
}
-static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm= (ob) ? ob->data : NULL;
bPose *pose= (ob) ? ob->pose : NULL;
uiPopupMenu *pup;
@@ -329,7 +329,7 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt)
static int poselib_add_exec (bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bAction *act = poselib_validate(ob);
bArmature *arm= (ob) ? ob->data : NULL;
bPose *pose= (ob) ? ob->pose : NULL;
@@ -402,9 +402,9 @@ void POSELIB_OT_pose_add (wmOperatorType *ot)
/* ----- */
-static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bAction *act= (ob) ? ob->poselib : NULL;
TimeMarker *marker;
EnumPropertyItem *item= NULL, item_tmp;
@@ -436,7 +436,7 @@ static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *ptr,
static int poselib_remove_exec (bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bAction *act= (ob) ? ob->poselib : NULL;
TimeMarker *marker;
FCurve *fcu;
@@ -505,7 +505,7 @@ void POSELIB_OT_pose_remove (wmOperatorType *ot)
static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bAction *act= (ob) ? ob->poselib : NULL;
TimeMarker *marker;
@@ -533,7 +533,7 @@ static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt)
static int poselib_rename_exec (bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bAction *act= (ob) ? ob->poselib : NULL;
TimeMarker *marker;
char newname[64];
@@ -1034,7 +1034,7 @@ static void poselib_preview_handle_search (tPoseLib_PreviewData *pld, unsigned s
}
/* handle events for poselib_preview_poses */
-static int poselib_preview_handle_event (bContext *C, wmOperator *op, wmEvent *event)
+static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wmEvent *event)
{
tPoseLib_PreviewData *pld= op->customdata;
int ret = OPERATOR_RUNNING_MODAL;
@@ -1237,7 +1237,7 @@ static int poselib_preview_handle_event (bContext *C, wmOperator *op, wmEvent *e
static void poselib_preview_init_data (bContext *C, wmOperator *op)
{
tPoseLib_PreviewData *pld;
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
int pose_index = RNA_int_get(op->ptr, "pose_index");
/* set up preview state info */
@@ -1411,7 +1411,7 @@ static int poselib_preview_modal (bContext *C, wmOperator *op, wmEvent *event)
}
/* Modal Operator init */
-static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
tPoseLib_PreviewData *pld;
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index b94b3e68318..ecb34609b2d 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -71,11 +71,43 @@
#include "armature_intern.h"
/* ************* XXX *************** */
-static int pupmenu(const char *dummy) {return 0;}
-static void error(const char *dummy) {};
-static void BIF_undo_push(const char *dummy) {}
+static int pupmenu(const char *UNUSED(dummy)) {return 0;}
+static void error(const char *UNUSED(dummy)) {};
+static void BIF_undo_push(const char *UNUSED(dummy)) {}
/* ************* XXX *************** */
+
+static int object_pose_context(Object *ob)
+{
+ if( (ob) &&
+ (ob->type == OB_ARMATURE) &&
+ (ob->pose) &&
+ (ob->mode & OB_MODE_POSE)
+ ) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+Object *ED_object_pose_armature(Object *ob)
+{
+ if(ob==NULL)
+ return NULL;
+
+ if(object_pose_context(ob))
+ return ob;
+
+ ob= modifiers_isDeformedByArmature(ob);
+
+ if(object_pose_context(ob))
+ return ob;
+
+ return NULL;
+}
+
+
/* This function is used to indicate that a bone is selected and needs keyframes inserted */
void set_pose_keys (Object *ob)
{
@@ -194,7 +226,7 @@ int ED_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan)
*
* To be called from various tools that do incremental updates
*/
-void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
+void ED_pose_recalculate_paths(Scene *scene, Object *ob)
{
ListBase targets = {NULL, NULL};
@@ -210,7 +242,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
/* For the object with pose/action: create path curves for selected bones
* This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
*/
-static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
+static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
Scene *scene= CTX_data_scene(C);
@@ -220,7 +252,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= CTX_data_active_object(C);
+ ob= ED_object_pose_armature(CTX_data_active_object(C));
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
@@ -235,7 +267,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
/* calculate the bones that now have motionpaths... */
// TODO: only make for the selected bones?
- ED_pose_recalculate_paths(C, scene, ob);
+ ED_pose_recalculate_paths(scene, ob);
/* notifiers for updates */
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
@@ -287,7 +319,7 @@ void ED_pose_clear_paths(Object *ob)
}
/* operator callback for this */
-static int pose_clear_paths_exec (bContext *C, wmOperator *op)
+static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
Object *ob;
@@ -296,7 +328,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *op)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= CTX_data_active_object(C);
+ ob= ED_object_pose_armature(CTX_data_active_object(C));
/* only continue if there's an object */
if ELEM(NULL, ob, ob->pose)
@@ -328,9 +360,9 @@ void POSE_OT_paths_clear (wmOperatorType *ot)
/* ******************* Select Constraint Target Operator ************* */
-static int pose_select_constraint_target_exec(bContext *C, wmOperator *op)
+static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm= ob->data;
bConstraint *con;
int found= 0;
@@ -390,7 +422,7 @@ void POSE_OT_select_constraint_target(wmOperatorType *ot)
static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm= ob->data;
Bone *curbone, *pabone, *chbone;
int direction = RNA_enum_get(op->ptr, "direction");
@@ -570,7 +602,7 @@ static short pose_select_same_layer (bContext *C, Object *ob, short extend)
static int pose_select_grouped_exec (bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
short extend= RNA_boolean_get(op->ptr, "extend");
short changed = 0;
@@ -856,7 +888,7 @@ void free_posebuf(void)
static int pose_copy_exec (bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
/* sanity checking */
if ELEM(NULL, ob, ob->pose) {
@@ -895,7 +927,7 @@ void POSE_OT_copy (wmOperatorType *ot)
static int pose_paste_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bPoseChannel *chan, *pchan;
int flip= RNA_boolean_get(op->ptr, "flipped");
@@ -1068,7 +1100,7 @@ void POSE_OT_paste (wmOperatorType *ot)
/* ********************************************** */
-static int pose_group_add_exec (bContext *C, wmOperator *op)
+static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
Object *ob;
@@ -1077,7 +1109,7 @@ static int pose_group_add_exec (bContext *C, wmOperator *op)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= CTX_data_active_object(C);
+ ob= ED_object_pose_armature(CTX_data_active_object(C));
/* only continue if there's an object */
if (ob == NULL)
@@ -1108,7 +1140,7 @@ void POSE_OT_group_add (wmOperatorType *ot)
}
-static int pose_group_remove_exec (bContext *C, wmOperator *op)
+static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
Object *ob;
@@ -1117,7 +1149,7 @@ static int pose_group_remove_exec (bContext *C, wmOperator *op)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= CTX_data_active_object(C);
+ ob= ED_object_pose_armature(CTX_data_active_object(C));
/* only continue if there's an object */
if (ob == NULL)
@@ -1150,7 +1182,7 @@ void POSE_OT_group_remove (wmOperatorType *ot)
/* ------------ */
/* invoke callback which presents a list of bone-groups for the user to choose from */
-static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
ScrArea *sa= CTX_wm_area(C);
Object *ob;
@@ -1165,7 +1197,7 @@ static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= CTX_data_active_object(C);
+ ob= ED_object_pose_armature(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1215,7 +1247,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= CTX_data_active_object(C);
+ ob= ED_object_pose_armature(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1268,7 +1300,7 @@ void POSE_OT_group_assign (wmOperatorType *ot)
}
-static int pose_group_unassign_exec (bContext *C, wmOperator *op)
+static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
Object *ob;
@@ -1280,7 +1312,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *op)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= CTX_data_active_object(C);
+ ob= ED_object_pose_armature(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1343,7 +1375,7 @@ static void pose_group_select(bContext *C, Object *ob, int select)
CTX_DATA_END;
}
-static int pose_group_select_exec (bContext *C, wmOperator *op)
+static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
Object *ob;
@@ -1352,7 +1384,7 @@ static int pose_group_select_exec (bContext *C, wmOperator *op)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= CTX_data_active_object(C);
+ ob= ED_object_pose_armature(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1381,7 +1413,7 @@ void POSE_OT_group_select (wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int pose_group_deselect_exec (bContext *C, wmOperator *op)
+static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
Object *ob;
@@ -1390,7 +1422,7 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *op)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= CTX_data_active_object(C);
+ ob= ED_object_pose_armature(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
@@ -1421,9 +1453,9 @@ void POSE_OT_group_deselect (wmOperatorType *ot)
/* ********************************************** */
-static int pose_flip_names_exec (bContext *C, wmOperator *op)
+static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm;
/* paranoia checks */
@@ -1468,7 +1500,7 @@ void POSE_OT_flip_names (wmOperatorType *ot)
static int pose_autoside_names_exec (bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm;
char newname[32];
short axis= RNA_enum_get(op->ptr, "axis");
@@ -1567,7 +1599,7 @@ void pose_activate_flipped_bone(Scene *scene)
/* Present a popup to get the layers that should be used */
static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm= (ob)? ob->data : NULL;
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
@@ -1588,7 +1620,7 @@ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev
/* Set the visible layers for the active armature (edit and pose modes) */
static int pose_armature_layers_exec (bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm= (ob)? ob->data : NULL;
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
@@ -1677,7 +1709,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
/* Set the visible layers for the active armature (edit and pose modes) */
static int pose_bone_layers_exec (bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bArmature *arm= (ob)? ob->data : NULL;
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
@@ -1795,10 +1827,10 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot)
/* ********************************************** */
-static int pose_flip_quats_exec (bContext *C, wmOperator *op)
+static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
/* loop through all selected pchans, flipping and keying (as needed) */
@@ -1863,9 +1895,9 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot)
/* ********************************************** */
/* context: active channel */
+#if 0
void pose_special_editmenu(Scene *scene)
{
-#if 0
Object *obedit= scene->obedit; // XXX context
Object *ob= OBACT;
short nr;
@@ -1888,7 +1920,7 @@ void pose_special_editmenu(Scene *scene)
pose_clear_paths(ob);
}
else if(nr==5) {
- pose_clear_user_transforms(scene, ob);
+ pose_clear_user_transforms(ob);
}
else if(nr==6) {
pose_relax();
@@ -1896,11 +1928,11 @@ void pose_special_editmenu(Scene *scene)
else if(ELEM3(nr, 7, 8, 9)) {
pose_autoside_names(nr-7);
}
-#endif
}
+
/* Restore selected pose-bones to 'action'-defined pose */
-void pose_clear_user_transforms(Scene *scene, Object *ob)
+static void pose_clear_user_transforms(Object *ob)
{
bArmature *arm= ob->data;
bPoseChannel *pchan;
@@ -1932,3 +1964,4 @@ void pose_clear_user_transforms(Scene *scene, Object *ob)
BIF_undo_push("Clear User Transform");
}
+#endif
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 9602d80575a..5af1658a83f 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -442,7 +442,7 @@ void flipArc(ReebArc *arc)
}
#ifdef DEBUG_REEB_NODE
-void NodeDegreeDecrement(ReebGraph *rg, ReebNode *node)
+void NodeDegreeDecrement(ReebGraph *UNUSED(rg), ReebNode *node)
{
node->degree--;
@@ -452,7 +452,7 @@ void NodeDegreeDecrement(ReebGraph *rg, ReebNode *node)
// }
}
-void NodeDegreeIncrement(ReebGraph *rg, ReebNode *node)
+void NodeDegreeIncrement(ReebGraph *UNUSED(rg), ReebNode *node)
{
// if (node->degree == 0)
// {
@@ -523,7 +523,7 @@ void verifyNodeDegree(ReebGraph *rg)
#endif
}
-void verifyBucketsArc(ReebGraph *rg, ReebArc *arc)
+void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc)
{
ReebNode *head = (ReebNode*)arc->head;
ReebNode *tail = (ReebNode*)arc->tail;
@@ -1692,7 +1692,7 @@ int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_internal, flo
return value;
}
-int filterCyclesReebGraph(ReebGraph *rg, float distance_threshold)
+int filterCyclesReebGraph(ReebGraph *rg, float UNUSED(distance_threshold))
{
ReebArc *arc1, *arc2;
ReebArc *next2;
@@ -1723,7 +1723,7 @@ int filterCyclesReebGraph(ReebGraph *rg, float distance_threshold)
return filtered;
}
-int filterSmartReebGraph(ReebGraph *rg, float threshold)
+int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
{
int value = 0;
#if 0 //XXX
@@ -2180,7 +2180,7 @@ void addFacetoArc(ReebArc *arc, EditFace *efa)
BLI_ghash_insert(arc->faces, efa, efa);
}
-void mergeArcFaces(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc)
+void mergeArcFaces(ReebGraph *UNUSED(rg), ReebArc *aDst, ReebArc *aSrc)
{
GHashIterator ghi;
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index 4558827c619..80582c7f1b0 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -194,6 +194,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
keymap->poll= ED_operator_editsurfcurve;
WM_keymap_add_menu(keymap, "INFO_MT_edit_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_menu(keymap, "INFO_MT_curve_handle_type_set", VKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 0, 0);
@@ -214,9 +215,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "TRANSFORM_OT_tilt", TKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN);
- RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1);
- RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, 0, 0)->ptr, "type", 3);
- RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0)->ptr, "type", 2);
WM_keymap_add_item(keymap, "CURVE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 6193b6eb916..97379cc110c 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -732,7 +732,7 @@ static void calc_shapeKeys(Object *obedit)
int totvert= count_curveverts(&editnurb->nurbs);
float (*ofs)[3] = NULL;
- float *oldkey, *newkey, *fp, *ofp;
+ float *oldkey, *newkey, *ofp;
/* editing the base key should update others */
if(cu->key->type==KEY_RELATIVE) {
@@ -776,7 +776,7 @@ static void calc_shapeKeys(Object *obedit)
for (j= 0; j < 3; ++j) {
VECSUB(ofs[i], bezt->vec[j], oldbezt->vec[j]);
i++;
- fp+= 3;
+ // fp+= 3; // unused
}
ofs[i++][0]= bezt->alfa - oldbezt->alfa;
} else {
@@ -796,7 +796,7 @@ static void calc_shapeKeys(Object *obedit)
}
i += 2;
++bp;
- fp += 4;
+ // fp += 4; //unused
}
}
@@ -809,7 +809,7 @@ static void calc_shapeKeys(Object *obedit)
while(currkey) {
int apply_offset = (ofs && (currkey != actkey) && (editnurb->shapenr-1 == currkey->relative));
- fp= newkey= MEM_callocN(cu->key->elemsize * totvert, "currkey->data");
+ float *fp= newkey= MEM_callocN(cu->key->elemsize * totvert, "currkey->data");
ofp= oldkey = currkey->data;
nu= editnurb->nurbs.first;
@@ -1343,7 +1343,7 @@ static void weightflagNurb(ListBase *editnurb, short flag, float w)
}
}
-static int deleteflagNurb(bContext *C, wmOperator *op, int flag)
+static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
@@ -1765,7 +1765,7 @@ static void adduplicateflagNurb(Object *obedit, short flag)
/**************** switch direction operator ***************/
-static int switch_direction_exec(bContext *C, wmOperator *op)
+static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= (Curve*)obedit->data;
@@ -1902,7 +1902,7 @@ void CURVE_OT_radius_set(wmOperatorType *ot)
/********************* smooth operator ********************/
-static int smooth_exec(bContext *C, wmOperator *op)
+static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -1974,7 +1974,7 @@ void CURVE_OT_smooth(wmOperatorType *ot)
/**************** smooth curve radius operator *************/
/* TODO, make smoothing distance based */
-static int smooth_radius_exec(bContext *C, wmOperator *op)
+static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -2265,7 +2265,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu
}
}
-static int de_select_first_exec(bContext *C, wmOperator *op)
+static int de_select_first_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
@@ -2289,7 +2289,7 @@ void CURVE_OT_de_select_first(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int de_select_last_exec(bContext *C, wmOperator *op)
+static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
@@ -2470,7 +2470,7 @@ void CURVE_OT_hide(wmOperatorType *ot)
/********************** reveal operator *********************/
-static int reveal_exec(bContext *C, wmOperator *op)
+static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -2527,7 +2527,7 @@ void CURVE_OT_reveal(wmOperatorType *ot)
/********************** select invert operator *********************/
-static int select_inverse_exec(bContext *C, wmOperator *op)
+static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
@@ -4071,7 +4071,7 @@ static int spin_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int spin_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -4271,7 +4271,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot)
/***************** extrude operator **********************/
-static int extrude_exec(bContext *C, wmOperator *op)
+static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
@@ -4296,7 +4296,7 @@ static int extrude_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if(extrude_exec(C, op) == OPERATOR_FINISHED) {
RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
@@ -4406,7 +4406,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -4531,7 +4531,7 @@ void CURVE_OT_select_linked(wmOperatorType *ot)
/***************** select row operator **********************/
-static int select_row_exec(bContext *C, wmOperator *op)
+static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
@@ -4606,7 +4606,7 @@ void CURVE_OT_select_row(wmOperatorType *ot)
/***************** select next operator **********************/
-static int select_next_exec(bContext *C, wmOperator *op)
+static int select_next_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -4633,7 +4633,7 @@ void CURVE_OT_select_next(wmOperatorType *ot)
/***************** select previous operator **********************/
-static int select_previous_exec(bContext *C, wmOperator *op)
+static int select_previous_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -4660,7 +4660,7 @@ void CURVE_OT_select_previous(wmOperatorType *ot)
/***************** select more operator **********************/
-static int select_more_exec(bContext *C, wmOperator *op)
+static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -4748,7 +4748,7 @@ void CURVE_OT_select_more(wmOperatorType *ot)
/******************** select less operator *****************/
/* basic method: deselect if control point doesn't have all neighbours selected */
-static int select_less_exec(bContext *C, wmOperator *op)
+static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -5099,7 +5099,7 @@ void CURVE_OT_select_nth(wmOperatorType *ot)
/********************** add duplicate operator *********************/
-static int duplicate_exec(bContext *C, wmOperator *op)
+static int duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
@@ -5109,7 +5109,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
duplicate_exec(C, op);
@@ -5432,7 +5432,7 @@ static int delete_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int delete_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Object *obedit= CTX_data_edit_object(C);
uiPopupMenu *pup;
@@ -5534,7 +5534,7 @@ void CURVE_OT_shade_flat(wmOperatorType *ot)
/************** join operator, to be used externally? ****************/
-int join_curve_exec(bContext *C, wmOperator *op)
+int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -5620,6 +5620,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
Nurb *nu = NULL;
BezTriple *bezt;
BPoint *bp;
+ Curve *cu= (Curve*)obedit->data;
float vec[3];
float fac, grid;
int a, b, cutype, stype;
@@ -5641,13 +5642,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
if (stype!=CU_PRIM_TUBE && stype!=CU_PRIM_DONUT) {
nu = (Nurb*)MEM_callocN(sizeof(Nurb), "addNurbprim");
nu->type= cutype;
- nu->resolu= 4;
- nu->resolv= 4;
+ nu->resolu= cu->resolu;
+ nu->resolv= cu->resolv;
}
switch(stype) {
case CU_PRIM_CURVE: /* curve */
- nu->resolu= 12; /* set as 4 above */
+ nu->resolu= cu->resolu;
if(newname) {
rename_id((ID *)obedit, "Curve");
rename_id((ID *)obedit->data, "Curve");
@@ -5724,7 +5725,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
nu->pntsv= 1;
nu->orderu= 5;
nu->flagu= CU_NURB_ENDPOINT; /* endpoint */
- nu->resolu= 8;
+ nu->resolu= cu->resolu;
nu->bp= callocstructN(BPoint, 5, "addNurbprim3");
bp= nu->bp;
@@ -5753,7 +5754,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
break;
case CU_PRIM_CIRCLE: /* circle */
- nu->resolu= 12; /* set as 4 above */
+ nu->resolu= cu->resolu;
if(newname) {
rename_id((ID *)obedit, "CurveCircle");
rename_id((ID *)obedit->data, "CurveCircle");
@@ -5870,7 +5871,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
}
nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */
- nu->resolu= 4;
+ nu->resolu= cu->resolu;
nu->flag= CU_SMOOTH;
BLI_addtail(editnurb, nu); /* temporal for extrude and translate */
vec[0]=vec[1]= 0.0;
@@ -5913,8 +5914,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
nu->pntsu= 5;
nu->pntsv= 1;
nu->orderu= 3;
- nu->resolu= 4;
- nu->resolv= 4;
+ nu->resolu= cu->resolu;
+ nu->resolv= cu->resolv;
nu->flag= CU_SMOOTH;
nu->bp= callocstructN(BPoint, 5, "addNurbprim6");
nu->flagu= 0;
@@ -5962,8 +5963,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
xzproj= 1;
nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */
xzproj= 0;
- nu->resolu= 4;
- nu->resolv= 4;
+ nu->resolu= cu->resolu;
+ nu->resolv= cu->resolv;
nu->flag= CU_SMOOTH;
BLI_addtail(editnurb, nu); /* temporal for spin */
@@ -6308,7 +6309,7 @@ void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
/***************** clear tilt operator ********************/
-static int clear_tilt_exec(bContext *C, wmOperator *op)
+static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index ae79c0b0053..44a664b5f30 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -271,7 +271,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re
/********************** insert lorem operator *********************/
-static int insert_lorem_exec(bContext *C, wmOperator *op)
+static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
char *p, *p2;
@@ -383,7 +383,7 @@ static int paste_file_exec(bContext *C, wmOperator *op)
return retval;
}
-static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if(RNA_property_is_set(op->ptr, "filepath"))
return paste_file_exec(C, op);
@@ -414,7 +414,7 @@ void FONT_OT_file_paste(wmOperatorType *ot)
/******************* paste buffer operator ********************/
-static int paste_buffer_exec(bContext *C, wmOperator *op)
+static int paste_buffer_exec(bContext *C, wmOperator *UNUSED(op))
{
char *filename;
@@ -714,7 +714,7 @@ static void copy_selection(Object *obedit)
}
}
-static int copy_text_exec(bContext *C, wmOperator *op)
+static int copy_text_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
@@ -737,7 +737,7 @@ void FONT_OT_text_copy(wmOperatorType *ot)
/******************* cut text operator ********************/
-static int cut_text_exec(bContext *C, wmOperator *op)
+static int cut_text_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
@@ -1367,7 +1367,7 @@ static int textbox_poll(bContext *C)
return 1;
}
-static int textbox_add_exec(bContext *C, wmOperator *op)
+static int textbox_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_active_object(C);
Curve *cu= obedit->data;
@@ -1585,7 +1585,7 @@ void FONT_OT_case_set(wmOperatorType *ot)
/********************** toggle case operator *********************/
-static int toggle_case_exec(bContext *C, wmOperator *op)
+static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
@@ -1633,7 +1633,7 @@ static void open_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int open_cancel(bContext *C, wmOperator *op)
+static int open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata= NULL;
@@ -1686,7 +1686,7 @@ static int open_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Object *ob = CTX_data_active_object(C);
Curve *cu;
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index e6a1f58096a..e19f774412b 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -199,7 +199,7 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl
}
/* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */
-static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
+static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short debug)
{
bGPDspoint *pt;
float oldpressure = 0.0f;
@@ -501,7 +501,7 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int
if (gps->totpoints == 1)
gp_draw_stroke_point(gps->points, lthick, gps->flag, offsx, offsy, winx, winy);
else if (dflag & GP_DRAWDATA_ONLY3D)
- gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
+ gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug);
else if (gps->totpoints > 1)
gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy);
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 083a90efb25..75156571cf4 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -662,7 +662,7 @@ static short gp_stroke_eraser_splitdel (bGPDframe *gpf, bGPDstroke *gps, int i)
}
/* eraser tool - check if part of stroke occurs within last segment drawn by eraser */
-static short gp_stroke_eraser_strokeinside (int mval[], int mvalo[], short rad, short x0, short y0, short x1, short y1)
+static short gp_stroke_eraser_strokeinside (int mval[], int UNUSED(mvalo[]), short rad, short x0, short y0, short x1, short y1)
{
/* simple within-radius check for now */
if (edge_inside_circle(mval[0], mval[1], rad, x0, y0, x1, y1))
@@ -1250,7 +1250,7 @@ static int gpencil_draw_cancel (bContext *C, wmOperator *op)
/* ------------------------------- */
/* create a new stroke point at the point indicated by the painting context */
-static void gpencil_draw_apply (bContext *C, wmOperator *op, tGPsdata *p)
+static void gpencil_draw_apply (wmOperator *op, tGPsdata *p)
{
/* handle drawing/erasing -> test for erasing first */
if (p->paintmode == GP_PAINTMODE_ERASER) {
@@ -1294,7 +1294,7 @@ static void gpencil_draw_apply (bContext *C, wmOperator *op, tGPsdata *p)
}
/* handle draw event */
-static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *event)
+static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event)
{
tGPsdata *p= op->customdata;
ARegion *ar= p->ar;
@@ -1343,7 +1343,7 @@ static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *even
RNA_float_set(&itemptr, "pressure", p->pressure);
/* apply the current latest drawing point */
- gpencil_draw_apply(C, op, p);
+ gpencil_draw_apply(op, p);
/* force refresh */
ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
@@ -1394,7 +1394,7 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op)
}
/* apply this data as necessary now (as per usual) */
- gpencil_draw_apply(C, op, p);
+ gpencil_draw_apply(op, p);
}
RNA_END;
@@ -1456,7 +1456,7 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event)
p->status= GP_STATUS_PAINTING;
/* handle the initial drawing - i.e. for just doing a simple dot */
- gpencil_draw_apply_event(C, op, event);
+ gpencil_draw_apply_event(op, event);
}
else {
/* toolbar invoked - don't start drawing yet... */
@@ -1516,7 +1516,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
if (p->status == GP_STATUS_PAINTING) {
/* handle drawing event */
//printf("\t\tGP - add point\n");
- gpencil_draw_apply_event(C, op, event);
+ gpencil_draw_apply_event(op, event);
/* finish painting operation if anything went wrong just now */
if (p->status == GP_STATUS_ERROR) {
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 6055b9eecb3..32fe10783a7 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -27,6 +27,10 @@
#ifndef ED_ARMATURE_H
#define ED_ARMATURE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct bArmature;
struct Base;
struct bContext;
@@ -38,6 +42,7 @@ struct ListBase;
struct MeshDeformModifierData;
struct Object;
struct RegionView3D;
+struct ReportList;
struct Scene;
struct SK_Sketch;
struct View3D;
@@ -128,7 +133,7 @@ void ED_armature_apply_transform(struct Object *ob, float mat[4][4]);
#define ARM_GROUPS_ENVELOPE 2
#define ARM_GROUPS_AUTO 3
-void create_vgroups_from_armature(struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror);
+void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror);
void auto_align_armature(struct Scene *scene, struct View3D *v3d, short mode);
void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */
@@ -137,11 +142,12 @@ void ED_armature_bone_rename(struct bArmature *arm, char *oldnamep, char *newnam
void undo_push_armature(struct bContext *C, char *name);
/* poseobject.c */
+struct Object *ED_object_pose_armature(struct Object *ob);
void ED_armature_exit_posemode(struct bContext *C, struct Base *base);
void ED_armature_enter_posemode(struct bContext *C, struct Base *base);
int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan);
void ED_pose_deselectall(struct Object *ob, int test);
-void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob);
+void ED_pose_recalculate_paths(struct Scene *scene, struct Object *ob);
/* sketch */
@@ -168,6 +174,10 @@ int BDR_drawSketchNames(struct ViewContext *vc);
void mesh_deform_bind(struct Scene *scene,
struct MeshDeformModifierData *mmd,
float *vertexcos, int totvert, float cagemat[][4]);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* ED_ARMATURE_H */
diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h
index 78a645d6b50..ec74ea6123b 100644
--- a/source/blender/editors/include/ED_keyframes_draw.h
+++ b/source/blender/editors/include/ED_keyframes_draw.h
@@ -136,7 +136,7 @@ void scene_to_keylist(struct bDopeSheet *ads, struct Scene *sce, struct DLRBT_Tr
void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks);
/* Grease Pencil Layer */
// XXX not restored
-void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks);
+void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys);
/* ActKeyColumn API ---------------- */
/* Comparator callback used for ActKeyColumns and cframe float-value pointer */
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index 8718d39dd18..2650005a489 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -28,6 +28,10 @@
#ifndef ED_KEYFRAMING_H
#define ED_KEYFRAMING_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct ListBase;
struct ID;
struct Scene;
@@ -179,7 +183,7 @@ struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, con
KeyingSetInfo *ANIM_keyingset_info_find_named(const char name[]);
/* for RNA type registrations... */
-void ANIM_keyingset_info_register(const struct bContext *C, KeyingSetInfo *ksi);
+void ANIM_keyingset_info_register(KeyingSetInfo *ksi);
void ANIM_keyingset_info_unregister(const struct bContext *C, KeyingSetInfo *ksi);
/* cleanup on exit */
@@ -280,4 +284,8 @@ typedef enum eAnimFilterFlags {
ANIMFILTER_KEYS_NOSKEY = (1<<10), /* don't include shape keys (for geometry) */
} eAnimFilterFlags;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ED_KEYFRAMING_H */
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 26ed5201e08..c866b12ed22 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -28,6 +28,10 @@
#ifndef ED_MESH_H
#define ED_MESH_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct ID;
struct View3D;
struct ARegion;
@@ -156,6 +160,8 @@ void EM_solidify(struct EditMesh *em, float dist);
int EM_deselect_nth(struct EditMesh *em, int nth);
+void EM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct EditMesh *em);
+
/* editmesh_mods.c */
extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs;
@@ -224,12 +230,16 @@ void ED_mesh_calc_normals(struct Mesh *me);
void ED_mesh_material_link(struct Mesh *me, struct Material *ma);
void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges);
-int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
+int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set);
int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
int ED_mesh_layers_poll(struct bContext *C);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ED_MESH_H */
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 6e42b772bef..d287066828f 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -40,7 +40,7 @@ void ED_init_node_butfuncs(void);
/* node_draw.c */
void ED_node_changed_update(struct ID *id, struct bNode *node);
-void ED_node_generic_update(struct Main *bmain, struct Scene *scene, struct bNodeTree *ntree, struct bNode *node);
+void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node);
/* node_edit.c */
void ED_node_shader_default(struct Material *ma);
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index f243b4cc497..63af7c5abd3 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -28,6 +28,10 @@
#ifndef ED_OBJECT_H
#define ED_OBJECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct Base;
struct bConstraint;
struct bContext;
@@ -105,7 +109,7 @@ int object_is_libdata(struct Object *ob);
int object_data_is_libdata(struct Object *ob);
/* object motion paths */
-void ED_objects_clear_paths(struct bContext *C, struct Scene *scene);
+void ED_objects_clear_paths(struct bContext *C);
void ED_objects_recalculate_paths(struct bContext *C, struct Scene *scene);
/* constraints */
@@ -141,5 +145,9 @@ int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, s
int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md, int mode);
int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ED_OBJECT_H */
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 7059e607218..62243a0e53e 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -69,7 +69,7 @@ void ED_spacetypes_keymap(struct wmKeyConfig *keyconf);
int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco);
int ED_area_header_standardbuttons(const struct bContext *C, struct uiBlock *block, int yco);
void ED_area_overdraw(struct bContext *C);
-void ED_area_overdraw_flush(struct bContext *C, struct ScrArea *sa, struct ARegion *ar);
+void ED_area_overdraw_flush(struct ScrArea *sa, struct ARegion *ar);
/* areas */
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index c5abd5465d7..18d6a1a48cc 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -38,6 +38,7 @@ typedef struct ScreenAnimData {
short refresh;
short flag; /* flags for playback */
int sfra; /* frame that playback was started from */
+ int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */
} ScreenAnimData;
/* for animplayer */
@@ -50,6 +51,8 @@ enum {
ANIMPLAY_FLAG_SYNC = (1<<2),
/* don't drop frames (and ignore SCE_FRAME_DROP flag) */
ANIMPLAY_FLAG_NO_SYNC = (1<<3),
+ /* use nextfra at next timer update */
+ ANIMPLAY_FLAG_USE_NEXT_FRAME,
};
/* ----------------------------------------------------- */
diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h
index 96a5d5857fa..1887a97e635 100644
--- a/source/blender/editors/include/ED_types.h
+++ b/source/blender/editors/include/ED_types.h
@@ -35,11 +35,6 @@
#define SELECT 1
#define ACTIVE 2
-/* nonstandard define, sometimes in math.h */
-#ifndef MAXFLOAT
-#define MAXFLOAT ((float)3.40282347e+38)
-#endif
-
/* buttons */
#define XIC 20
#define YIC 20
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 1710a8439d1..737d124b494 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -41,7 +41,6 @@ void ED_operatortypes_uvedit(void);
void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma);
-void ED_uvedit_set_tile(struct bContext *C, struct Scene *scene, struct Object *obedit, struct Image *ima, int curtile, int dotile);
int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
int ED_uvedit_test_silent(struct Object *obedit);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 54a627da2da..2a1527b670d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -77,17 +77,18 @@ typedef struct uiLayout uiLayout;
#define UI_EMBOSST 3 /* Table */
/* uiBlock->direction */
+#define UI_DIRECTION (UI_TOP|UI_DOWN|UI_LEFT|UI_RIGHT)
#define UI_TOP 1
#define UI_DOWN 2
#define UI_LEFT 4
#define UI_RIGHT 8
-#define UI_DIRECTION 15
+
#define UI_CENTER 16
#define UI_SHIFT_FLIPPED 32
/* uiBlock->autofill (not yet used) */
-#define UI_BLOCK_COLLUMNS 1
-#define UI_BLOCK_ROWS 2
+// #define UI_BLOCK_COLLUMNS 1
+// #define UI_BLOCK_ROWS 2
/* uiBlock->flag (controls) */
#define UI_BLOCK_LOOP 1
@@ -316,7 +317,7 @@ void uiDrawBlock(const struct bContext *C, struct uiBlock *block);
uiBlock *uiGetBlock(char *name, struct ARegion *ar);
-void uiBlockSetEmboss(uiBlock *block, short dt);
+void uiBlockSetEmboss(uiBlock *block, char dt);
void uiFreeBlock(const struct bContext *C, uiBlock *block);
void uiFreeBlocks(const struct bContext *C, struct ListBase *lb);
@@ -491,7 +492,7 @@ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxle
void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2);
-void uiDefAutoButsRNA(const struct bContext *C, uiLayout *layout, struct PointerRNA *ptr, int columns);
+void uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int columns);
/* Links
*
@@ -679,17 +680,17 @@ void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA
char *newop, char *openop, char *unlinkop);
void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname,
char *newop, char *openop, char *unlinkop, int rows, int cols);
-void uiTemplateAnyID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname,
+void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, char *propname,
char *proptypename, char *text);
-void uiTemplatePathBuilder(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname,
+void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, char *propname,
struct PointerRNA *root_ptr, char *text);
uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
void uiTemplatePreview(uiLayout *layout, struct ID *id, struct ID *parent, struct MTex *slot);
void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
-void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
-void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
-void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
+void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname);
+void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname);
+void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname);
void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, char *propname, int type, int levels, int brush);
void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname,
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index bf4a3de9cc6..9afa7dd012a 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -156,14 +156,14 @@ void UI_view2d_totRect_set_resize(struct View2D *v2d, int width, int height, int
int UI_view2d_tab_set(struct View2D *v2d, int tab);
/* view matrix operations */
-void UI_view2d_view_ortho(const struct bContext *C, struct View2D *v2d);
-void UI_view2d_view_orthoSpecial(const struct bContext *C, struct View2D *v2d, short xaxis);
+void UI_view2d_view_ortho(struct View2D *v2d);
+void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, short xaxis);
void UI_view2d_view_restore(const struct bContext *C);
/* grid drawing */
-View2DGrid *UI_view2d_grid_calc(const struct bContext *C, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy);
-void UI_view2d_grid_draw(const struct bContext *C, struct View2D *v2d, View2DGrid *grid, int flag);
-void UI_view2d_constant_grid_draw(const struct bContext *C, struct View2D *v2d);
+View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy);
+void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag);
+void UI_view2d_constant_grid_draw(struct View2D *v2d);
void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy);
void UI_view2d_grid_free(View2DGrid *grid);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index b7ec5565d80..f65b10eaaea 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -67,7 +67,7 @@
#define MENU_SEP_HEIGHT 6
/*
- * a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt
+ * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt
*
* uiBlahBlah() external function
* ui_blah_blah() internal function
@@ -441,7 +441,7 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval)
/* link line drawing is not part of buttons or theme.. so we stick with it here */
-static void ui_draw_linkline(uiBut *but, uiLinkLine *line)
+static void ui_draw_linkline(uiLinkLine *line)
{
rcti rect;
@@ -470,7 +470,7 @@ static void ui_draw_links(uiBlock *block)
if(but->type==LINK && but->link) {
line= but->link->lines.first;
while(line) {
- ui_draw_linkline(but, line);
+ ui_draw_linkline(line);
line= line->next;
}
}
@@ -748,7 +748,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
if(block->flag & UI_BLOCK_LOOP)
ui_draw_menu_back(&style, block, &rect);
else if(block->panel)
- ui_draw_aligned_panel(ar, &style, block, &rect);
+ ui_draw_aligned_panel(&style, block, &rect);
/* widgets */
for(but= block->buttons.first; but; but= but->next) {
@@ -835,7 +835,7 @@ static void ui_is_but_sel(uiBut *but)
/* XXX 2.50 no links supported yet */
-static int uibut_contains_pt(uiBut *but, short *mval)
+static int uibut_contains_pt(uiBut *UNUSED(but), short *UNUSED(mval))
{
return 0;
@@ -937,7 +937,7 @@ void uiComposeLinks(uiBlock *block)
void uiBlockSetButLock(uiBlock *block, int val, char *lockstr)
{
if(val) {
- block->lock |= val;
+ block->lock= val ? 1:0;
block->lockstr= lockstr;
}
}
@@ -1093,12 +1093,12 @@ static void ui_do_active_linklines(uiBlock *block, short *mval)
if(line==act) {
if((line->flag & UI_SELECT)==0) {
line->flag |= UI_SELECT;
- ui_draw_linkline(but, line);
+ ui_draw_linkline(line);
}
}
else if(line->flag & UI_SELECT) {
line->flag &= ~UI_SELECT;
- ui_draw_linkline(but, line);
+ ui_draw_linkline(line);
}
line= line->next;
}
@@ -1947,7 +1947,7 @@ uiBlock *uiGetBlock(char *name, ARegion *ar)
return NULL;
}
-void uiBlockSetEmboss(uiBlock *block, short dt)
+void uiBlockSetEmboss(uiBlock *block, char dt)
{
block->dt= dt;
}
@@ -2136,11 +2136,6 @@ void ui_check_but(uiBut *but)
case HSVCUBE:
case HSVCIRCLE:
- {
- float rgb[3];
- ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], but->hsv, but->hsv+1, but->hsv+2);
- }
break;
default:
strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
@@ -2187,7 +2182,7 @@ int ui_but_can_align(uiBut *but)
return !ELEM3(but->type, LABEL, OPTION, OPTIONN);
}
-static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr)
+static void ui_block_do_align_but(uiBut *first, int nr)
{
uiBut *prev, *but=NULL, *next;
int flag= 0, cols=0, rows=0;
@@ -2321,7 +2316,7 @@ void ui_block_do_align(uiBlock *block)
for(but=block->buttons.first; but;) {
if(but->alignnr) {
nr= but->alignnr;
- ui_block_do_align_but(block, but, nr);
+ ui_block_do_align_but(but, nr);
/* skip with same number */
for(; but && but->alignnr == nr; but=but->next);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index cf6970dc59f..81b04fea062 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -460,7 +460,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel)
/* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */
-void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect)
+void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect)
{
extern char datatoc_splash_png[];
extern int datatoc_splash_png_size;
@@ -564,7 +564,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
int err;
strcpy(tmpStr, G.selfont->name);
- BLI_path_abs(tmpStr, G.sce);
+ BLI_path_abs(tmpStr, G.main->name);
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
}
}
@@ -747,7 +747,7 @@ void histogram_draw_one(float r, float g, float b, float alpha, float x, float y
glDisable(GL_LINE_SMOOTH);
}
-void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti)
+void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
{
Histogram *hist = (Histogram *)but->poin;
int res = hist->x_resolution;
@@ -800,7 +800,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *
draw_scope_end(&rect, scissor);
}
-void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti)
+void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
{
Scopes *scopes = (Scopes *)but->poin;
rctf rect;
@@ -1023,7 +1023,7 @@ void vectorscope_draw_target(float centerx, float centery, float diam, float r,
glEnd();
}
-void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti)
+void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
{
Scopes *scopes = (Scopes *)but->poin;
rctf rect;
@@ -1105,7 +1105,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti
glDisable(GL_BLEND);
}
-void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
+void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
{
ColorBand *coba;
CBData *cbd;
@@ -1404,7 +1404,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
if (but->a1 != -1) {
if (but->a1 == UI_GRAD_H) {
rcti grid;
- float col[3];
+ float col[3]= {0.0f, 0.0f, 0.0f}; /* dummy arg */
grid.xmin = rect->xmin + zoomx*(-offsx);
grid.xmax = rect->xmax + zoomx*(-offsx);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index c789c721aea..ab8fda85ff2 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -429,7 +429,7 @@ static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data
data->applied= 1;
}
-static void ui_apply_but_TOG(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
+static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
{
double value;
int w, lvalue, push;
@@ -896,7 +896,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case BUT_TOGDUAL:
case OPTION:
case OPTIONN:
- ui_apply_but_TOG(C, block, but, data);
+ ui_apply_but_TOG(C, but, data);
break;
case ROW:
case LISTROW:
@@ -1816,6 +1816,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
/* only update when typing for TAB key */
if(update && data->interactive) ui_apply_button(C, block, but, data, 1);
else ui_check_but(but);
+ but->changed= TRUE;
if(data->searchbox)
ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */
@@ -2829,17 +2830,18 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
}
else if(but->type==COL) {
if( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
+ float *hsv= ui_block_hsv_get(but->block);
float col[3];
ui_get_but_vectorf(but, col);
- rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2);
+ rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
if(event->type==WHEELDOWNMOUSE)
- but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f);
+ hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
else
- but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f);
+ hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
- hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], data->vec, data->vec+1, data->vec+2);
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2);
ui_set_but_vectorf(but, data->vec);
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -2969,7 +2971,8 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my)
{
- float rgb[3], hsv[3];
+ float rgb[3];
+ float *hsv= ui_block_hsv_get(but->block);
float x, y;
int changed= 1;
int color_profile = but->block->color_profile;
@@ -2978,10 +2981,11 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = BLI_PR_NONE;
}
-
+
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
-
+
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+
/* relative position within box */
x= ((float)mx-but->x1)/(but->x2-but->x1);
y= ((float)my-but->y1)/(but->y2-but->y1);
@@ -3058,21 +3062,22 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
}
else if (event->type == ZEROKEY && event->val == KM_PRESS) {
if (but->a1==9){
- float rgb[3], hsv[3], def_hsv[3];
- float *def;
int len;
/* reset only value */
len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
if (len >= 3) {
+ float rgb[3], def_hsv[3];
+ float *def;
+ float *hsv= ui_block_hsv_get(but->block);
def= MEM_callocN(sizeof(float)*len, "reset_defaults - float");
RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def);
rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2);
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
hsv_to_rgb(hsv[0], hsv[1], def_hsv[2], rgb, rgb+1, rgb+2);
ui_set_but_vectorf(but, rgb);
@@ -3110,13 +3115,15 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
{
rcti rect;
int changed= 1;
- float rgb[3], hsv[3];
+ float rgb[3];
+ float hsv[3];
rect.xmin= but->x1; rect.xmax= but->x2;
rect.ymin= but->y1; rect.ymax= but->y2;
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ copy_v3_v3(hsv, ui_block_hsv_get(but->block));
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
/* exception, when using color wheel in 'locked' value state:
* allow choosing a hue for black values, by giving a tiny increment */
@@ -3175,21 +3182,22 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
else if (event->type == ZEROKEY && event->val == KM_PRESS) {
- float rgb[3], hsv[3], def_hsv[3];
- float *def;
int len;
/* reset only saturation */
len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
if (len >= 3) {
+ float rgb[3], def_hsv[3];
+ float *def;
+ float *hsv= ui_block_hsv_get(but->block);
def= MEM_callocN(sizeof(float)*len, "reset_defaults - float");
RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def);
rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2);
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
hsv_to_rgb(hsv[0], def_hsv[1], hsv[2], rgb, rgb+1, rgb+2);
ui_set_but_vectorf(but, rgb);
@@ -3209,12 +3217,14 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
/* XXX hardcoded keymap check.... */
else if(event->type == WHEELDOWNMOUSE) {
- but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f);
+ float *hsv= ui_block_hsv_get(but->block);
+ hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_numedit_apply(C, block, but, data);
}
else if(event->type == WHEELUPMOUSE) {
- but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f);
+ float *hsv= ui_block_hsv_get(but->block);
+ hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
ui_set_but_hsv(but); // converts to rgb
ui_numedit_apply(C, block, but, data);
}
@@ -3557,7 +3567,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
return WM_UI_HANDLER_CONTINUE;
}
-static int in_scope_resize_zone(uiBut *but, int x, int y)
+static int in_scope_resize_zone(uiBut *but, int UNUSED(x), int y)
{
// bottom corner return (x > but->x2 - SCOPE_RESIZE_PAD) && (y < but->y1 + SCOPE_RESIZE_PAD);
return (y < but->y1 + SCOPE_RESIZE_PAD);
@@ -3796,7 +3806,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
}
#ifdef INTERNATIONAL
-static int ui_do_but_CHARTAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event))
{
/* XXX 2.50 bad global and state access */
#if 0
@@ -3934,18 +3944,19 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
return WM_UI_HANDLER_CONTINUE;
}
-static void but_shortcut_name_func(bContext *C, void *arg1, int event)
+static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
{
uiBut *but = (uiBut *)arg1;
-
- char buf[512], *butstr, *cpoin;
-
+
if (but->optype) {
+ char buf[512], *butstr, *cpoin;
+
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
/* complex code to change name of button */
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
-
+ wmKeyMap *km= NULL;
+
butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps");
// XXX but->str changed... should not, remove the hotkey from it
@@ -3961,6 +3972,11 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int event)
MEM_freeN(butstr);
ui_check_but(but);
+
+ /* set the keymap editable else the key wont save */
+ WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
+ WM_keymap_copy_to_user(km);
+
} else {
/* shortcut was removed */
cpoin= strchr(but->str, '|');
@@ -4023,7 +4039,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
uiBlockSetHandleFunc(block, but_shortcut_name_func, but);
uiBlockSetFlag(block, UI_BLOCK_RET_1);
uiBlockSetDirection(block, UI_CENTER);
-
+
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style);
uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", 0);
@@ -4034,14 +4050,14 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
return block;
}
-static void popup_change_shortcut_func(bContext *C, void *arg1, void *arg2)
+static void popup_change_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
{
uiBut *but = (uiBut *)arg1;
button_timers_tooltip_remove(C, but);
uiPupBlock(C, menu_change_shortcut, but);
}
-static void remove_shortcut_func(bContext *C, void *arg1, void *arg2)
+static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
{
uiBut *but = (uiBut *)arg1;
wmKeyMap *km;
@@ -4055,7 +4071,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *arg2)
but_shortcut_name_func(C, but, 0);
}
-static void popup_add_shortcut_func(bContext *C, void *arg1, void *arg2)
+static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
{
uiBut *but = (uiBut *)arg1;
button_timers_tooltip_remove(C, but);
@@ -4265,7 +4281,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
if(but->flag & UI_BUT_DISABLED)
return WM_UI_HANDLER_CONTINUE;
- if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if(data->state == BUTTON_STATE_HIGHLIGHT && event->prevval != KM_PRESS) { /* check prevval because of modal operators [#24016] */
/* handle copy-paste */
if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) {
ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v');
@@ -4563,7 +4579,7 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
return 1;
}
-static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
+static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
{
uiBlock *block;
uiBut *but, *butover= NULL;
@@ -4595,7 +4611,7 @@ static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
return butover;
}
-static uiBut *ui_list_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y)
+static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y)
{
uiBlock *block;
uiBut *but;
@@ -5016,11 +5032,10 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
{
- wmWindow *win= CTX_wm_window(C);
uiBut *but;
if(event->type == MOUSEMOVE) {
- but= ui_but_find_mouse_over(win, ar, event->x, event->y);
+ but= ui_but_find_mouse_over(ar, event->x, event->y);
if(but)
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
}
@@ -5098,7 +5113,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if(ui_but_find_mouse_over(data->window, ar, event->x, event->y) != but) {
+ else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@@ -5196,7 +5211,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
else if(data->state == BUTTON_STATE_MENU_OPEN) {
switch(event->type) {
case MOUSEMOVE: {
- uiBut *bt= ui_but_find_mouse_over(data->window, ar, event->x, event->y);
+ uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y);
if(bt && bt->active != data) {
if(but->type != COL) /* exception */
@@ -5231,8 +5246,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
{
- wmWindow *win= CTX_wm_window(C);
- uiBut *but= ui_list_find_mouse_over(win, ar, event->x, event->y);
+ uiBut *but= ui_list_find_mouse_over(ar, event->x, event->y);
int retval= WM_UI_HANDLER_CONTINUE;
int value, min, max;
@@ -5419,7 +5433,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
return menu->dotowards;
}
-int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int topmenu)
+int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu))
{
ARegion *ar;
uiBlock *block;
@@ -5525,16 +5539,20 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) ||
((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP))
) {
- if(ui_but_first(block)->type & BUT)
+ if((bt= ui_but_first(block)) && (bt->type & BUT)) {
bt= ui_but_last(block);
- else
- bt= ui_but_first(block);
+ }
+ else {
+ /* keep ui_but_first() */
+ }
}
else {
- if(ui_but_first(block)->type & BUT)
- bt= ui_but_first(block);
- else
+ if((bt= ui_but_first(block)) && (bt->type & BUT)) {
+ /* keep ui_but_first() */
+ }
+ else {
bt= ui_but_last(block);
+ }
}
if(bt)
@@ -5779,7 +5797,7 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa
/* *************** UI event handlers **************** */
-static int ui_handler_region(bContext *C, wmEvent *event, void *userdata)
+static int ui_handler_region(bContext *C, wmEvent *event, void *UNUSED(userdata))
{
ARegion *ar;
uiBut *but;
@@ -5817,7 +5835,7 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *userdata)
return retval;
}
-static void ui_handler_remove_region(bContext *C, void *userdata)
+static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata))
{
bScreen *sc;
ARegion *ar;
@@ -5837,7 +5855,7 @@ static void ui_handler_remove_region(bContext *C, void *userdata)
ui_apply_but_funcs_after(C);
}
-static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata)
+static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(userdata))
{
ARegion *ar;
uiBut *but;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 482eece42f6..0ade3e6199f 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -28,6 +28,7 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#ifndef WIN32
#include <unistd.h>
@@ -331,7 +332,7 @@ static void vicon_editmode_hlt_draw(int x, int y, int w, int h, float alpha)
viconutil_draw_points(pts, 3, 1);
}
-static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha)
+static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float UNUSED(alpha))
{
GLint pts[3][2];
@@ -346,7 +347,7 @@ static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha)
viconutil_draw_points(pts, 3, 1);
}
-static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float alpha)
+static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha)
{
GLint pts[3][2];
int cx = x+w/2;
@@ -371,7 +372,7 @@ static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float al
viconutil_draw_lineloop_smooth(pts, 3);
}
-static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha)
+static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha)
{
GLint pts[3][2];
int cx = x+w/2-4;
@@ -393,7 +394,7 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha)
glShadeModel(GL_FLAT);
}
-static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alpha)
+static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), float alpha)
{
GLint pts[3][2];
int cx = x+w/2;
@@ -418,7 +419,7 @@ static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alp
viconutil_draw_lineloop_smooth(pts, 3);
}
-static void vicon_move_up_draw(int x, int y, int w, int h, float alpha)
+static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha))
{
int d=-2;
@@ -436,7 +437,7 @@ static void vicon_move_up_draw(int x, int y, int w, int h, float alpha)
glDisable(GL_LINE_SMOOTH);
}
-static void vicon_move_down_draw(int x, int y, int w, int h, float alpha)
+static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha))
{
int d=2;
@@ -622,20 +623,30 @@ static void init_iconfile_list(struct ListBase *list)
char *filename = dir[i].relname;
if(BLI_testextensie(filename, ".png")) {
-
+
/* check to see if the image is the right size, continue if not */
/* copying strings here should go ok, assuming that we never get back
a complete path to file longer than 256 chars */
sprintf(iconfilestr, "%s/%s", icondirstr, filename);
- if(BLI_exists(iconfilestr)) bbuf = IMB_loadiffname(iconfilestr, IB_rect);
-
- ifilex = bbuf->x;
- ifiley = bbuf->y;
- IMB_freeImBuf(bbuf);
+ if(BLI_exists(iconfilestr))
+ bbuf= IMB_loadiffname(iconfilestr, IB_rect);
+ else
+ bbuf= NULL;
+
+
+ if(bbuf) {
+ ifilex = bbuf->x;
+ ifiley = bbuf->y;
+ IMB_freeImBuf(bbuf);
+ }
+ else {
+ ifilex= ifiley= 0;
+ }
+ /* bad size or failed to load */
if ((ifilex != ICON_IMAGE_W) || (ifiley != ICON_IMAGE_H))
continue;
-
+
/* found a potential icon file, so make an entry for it in the cache list */
ifile = MEM_callocN(sizeof(IconFile), "IconFile");
@@ -833,8 +844,17 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple
prv_img->w[miplevel], prv_img->h[miplevel]);
}
-static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, int rh, unsigned int *rect, float alpha, float *rgb)
+static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview)
{
+ ImBuf *ima= NULL;
+
+ /* sanity check */
+ if(w<=0 || h<=0 || w>2000 || h>2000) {
+ printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h);
+ assert(!"invalid icon size");
+ return;
+ }
+
/* modulate color */
if(alpha != 1.0f)
glPixelTransferf(GL_ALPHA_SCALE, alpha);
@@ -844,35 +864,27 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw,
glPixelTransferf(GL_GREEN_SCALE, rgb[1]);
glPixelTransferf(GL_BLUE_SCALE, rgb[2]);
}
-
- /* draw */
- if((w<1 || h<1)) {
- // XXX - TODO 2.5 verify whether this case can happen
- if (G.f & G_DEBUG)
- printf("what the heck! - icons are %i x %i pixels?\n", w, h);
- }
- /* rect contains image in 'rendersize', we only scale if needed */
- else if(rw!=w && rh!=h) {
- if(w>2000 || h>2000) { /* something has gone wrong! */
- if (G.f & G_DEBUG)
- printf("insane icon size w=%d h=%d\n",w,h);
- }
- else {
- ImBuf *ima;
- /* first allocate imbuf for scaling and copy preview into it */
- ima = IMB_allocImBuf(rw, rh, 32, IB_rect, 0);
- memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));
-
- /* scale it */
- IMB_scaleImBuf(ima, w, h);
- glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect);
-
- IMB_freeImBuf(ima);
- }
+ /* rect contains image in 'rendersize', we only scale if needed */
+ if(rw!=w && rh!=h) {
+ /* first allocate imbuf for scaling and copy preview into it */
+ ima = IMB_allocImBuf(rw, rh, 32, IB_rect);
+ memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));
+ IMB_scaleImBuf(ima, w, h); /* scale it */
+ rect= ima->rect;
}
- else
+
+ /* draw */
+ if(is_preview) {
glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+ }
+ else {
+ glRasterPos2f(x, y);
+ glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+ }
+
+ if(ima)
+ IMB_freeImBuf(ima);
/* restore color */
if(alpha != 0.0f)
@@ -885,7 +897,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw,
}
}
-static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int iw, int ih, float alpha, float *rgb)
+static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, float *rgb)
{
float x1, x2, y1, y2;
@@ -928,7 +940,7 @@ static int preview_size(int miplevel)
return 0;
}
-static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int nocreate)
+static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate), int is_preview)
{
Icon *icon = NULL;
DrawInfo *di = NULL;
@@ -971,7 +983,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
if(!iimg->rect) return; /* something has gone wrong! */
- icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb);
+ icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview);
}
else if(di->type == ICON_TYPE_PREVIEW) {
PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj);
@@ -982,7 +994,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
/* preview images use premul alpha ... */
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL);
+ icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL, is_preview);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
@@ -1072,7 +1084,7 @@ int ui_id_icon_get(bContext *C, ID *id, int preview)
static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, float alpha, int miplevel, int nocreate)
{
int draw_size = preview_size(miplevel);
- icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate);
+ icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate, FALSE);
}
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha)
@@ -1083,7 +1095,7 @@ void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alph
void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb)
{
int draw_size = preview_size(PREVIEW_MIPMAP_ZERO);
- icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, 0);
+ icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, FALSE, FALSE);
}
void UI_icon_draw(float x, float y, int icon_id)
@@ -1093,7 +1105,7 @@ void UI_icon_draw(float x, float y, int icon_id)
void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha)
{
- icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, 0, size, 1);
+ icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, PREVIEW_MIPMAP_ZERO, size, TRUE, FALSE);
}
void UI_icon_draw_preview(float x, float y, int icon_id)
@@ -1108,6 +1120,6 @@ void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect)
void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size)
{
- icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, 0);
+ icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, FALSE, TRUE);
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 3873c5c9092..7a0f69fc838 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -171,8 +171,9 @@ struct uiBut {
char *poin;
float hardmin, hardmax, softmin, softmax;
- float a1, a2, hsv[3]; // hsv is temp memory for hsv buttons
+ float a1, a2;
float aspect;
+ char col[4];
uiButHandleFunc func;
void *func_arg1;
@@ -206,10 +207,11 @@ struct uiBut {
char *tip, *lockstr;
BIFIconID icon;
- short but_align; /* aligning buttons, horiz/vertical */
- short lock;
+ char lock;
+ char dt;
+ short changed; /* could be made into a single flag */
short modifier_key;
- short iconadd, dt;
+ short iconadd;
/* IDPOIN data */
uiIDPoinFuncFP idpoin_func;
@@ -296,32 +298,33 @@ struct uiBlock {
void *drawextra_arg1;
void *drawextra_arg2;
- int afterval, flag;
-
- short direction, dt;
- short auto_open, in_use;
+ int flag;
+ char direction, dt;
+ short auto_open;
double auto_open_last;
- int lock;
char *lockstr;
+
+ char lock;
+ char active; // to keep blocks while drawing and free them afterwards
+ char tooltipdisabled; // to avoid tooltip after click
+ char endblock; // uiEndBlock done?
float xofs, yofs; // offset to parent button
int dobounds, mx, my; // for doing delayed
int bounds, minbounds; // for doing delayed
- int endblock; // uiEndBlock done?
rctf safety; // pulldowns, to detect outside, can differ per case how it is created
ListBase saferct; // uiSafetyRct list
uiPopupBlockHandle *handle; // handle
- int tooltipdisabled; // to avoid tooltip after click
- int active; // to keep blocks while drawing and free them afterwards
int puphash; // popup menu hash for memory
- int color_profile; // color profile for correcting linear colors for display
-
void *evil_C; // XXX hack for dynamic operator enums
+
+ float _hsv[3]; // XXX, only access via ui_block_hsv_get()
+ char color_profile; // color profile for correcting linear colors for display
};
typedef struct uiSafetyRct {
@@ -408,6 +411,8 @@ void ui_tooltip_free(struct bContext *C, struct ARegion *ar);
uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but);
+float *ui_block_hsv_get(uiBlock *block);
+
/* searchbox for string button */
ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
int ui_searchbox_inside(struct ARegion *ar, int x, int y);
@@ -436,12 +441,12 @@ void autocomplete_end(struct AutoComplete *autocpl, char *autoname);
/* interface_panel.c */
extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event);
-extern void ui_draw_aligned_panel(struct ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect);
+extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect);
/* interface_draw.c */
extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
-void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha);
+void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha);
void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index e268120fa07..f729124e405 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -434,7 +434,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon
uiBlockSetCurLayout(block, layout);
}
-static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only)
+static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int h, int icon_only)
{
uiBut *but;
EnumPropertyItem *item;
@@ -472,7 +472,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
}
/* callback for keymap item change button */
-static void ui_keymap_but_cb(bContext *C, void *but_v, void *key_v)
+static void ui_keymap_but_cb(bContext *UNUSED(C), void *but_v, void *UNUSED(key_v))
{
uiBut *but= but_v;
@@ -956,7 +956,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
}
/* expanded enum */
else if(type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
- ui_item_enum_expand(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
+ ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only);
/* property with separate label */
else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
@@ -1026,7 +1026,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, char *propname
for(a=0; item[a].identifier; a++) {
if(item[a].value == ivalue) {
- uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, (char*)item[a].name, item[a].icon);
+ uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : (char*)item[a].name, icon ? icon : item[a].icon);
break;
}
}
@@ -1109,6 +1109,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui
int i=0, iconid=0, flag= RNA_property_flag(but->rnaprop);
ListBase *items_list= MEM_callocN(sizeof(ListBase), "items_list");
CollItemSearch *cis;
+ const int skip_filter= !but->changed;
/* build a temporary list of relevant items first */
RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) {
@@ -1140,7 +1141,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui
}
if(name) {
- if(BLI_strcasestr(name, str)) {
+ if(skip_filter || BLI_strcasestr(name, str)) {
cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
cis->name = MEM_dupallocN(name);
cis->index = i;
@@ -1323,7 +1324,7 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun
}
}
-void uiItemM(uiLayout *layout, bContext *C, char *menuname, char *name, int icon)
+void uiItemM(uiLayout *layout, bContext *UNUSED(C), char *menuname, char *name, int icon)
{
MenuType *mt;
@@ -1433,7 +1434,7 @@ typedef struct MenuItemLevel {
PointerRNA rnapoin;
} MenuItemLevel;
-static void menu_item_enum_opname_menu(bContext *C, uiLayout *layout, void *arg)
+static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)
{
MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
@@ -1464,7 +1465,7 @@ void uiItemMenuEnumO(uiLayout *layout, char *opname, char *propname, char *name,
ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl);
}
-static void menu_item_enum_rna_menu(bContext *C, uiLayout *layout, void *arg)
+static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)
{
MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
@@ -1673,7 +1674,7 @@ static void ui_litem_layout_column(uiLayout *litem)
}
/* root layout */
-static void ui_litem_estimate_root(uiLayout *litem)
+static void ui_litem_estimate_root(uiLayout *UNUSED(litem))
{
/* nothing to do */
}
@@ -2168,6 +2169,7 @@ uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align)
split->litem.enabled= 1;
split->litem.context= layout->context;
split->litem.space= layout->root->style->columnspace;
+ split->litem.w= layout->w;
split->percentage= percentage;
BLI_addtail(&layout->items, split);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index bcde54f473a..10458a763e6 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -134,7 +134,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event)
}
/* Modal Operator init */
-static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
/* init */
if (eyedropper_init(C, op)) {
@@ -195,7 +195,7 @@ void UI_OT_eyedropper(wmOperatorType *ot)
/* Reset Default Theme ------------------------ */
-static int reset_default_theme_exec(bContext *C, wmOperator *op)
+static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
{
ui_theme_init_default();
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -219,7 +219,7 @@ void UI_OT_reset_default_theme(wmOperatorType *ot)
/* Copy Data Path Operator ------------------------ */
-static int copy_data_path_button_exec(bContext *C, wmOperator *op)
+static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr;
PropertyRNA *prop;
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 9d22f3c5212..d6cb8161916 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -25,7 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/* a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt */
+/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */
#include <math.h>
#include <stdlib.h>
@@ -316,7 +316,7 @@ void uiPanelPush(uiBlock *block)
glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0);
}
-void uiPanelPop(uiBlock *block)
+void uiPanelPop(uiBlock *UNUSED(block))
{
glPopMatrix();
}
@@ -425,7 +425,7 @@ static void ui_draw_panel_dragwidget(rctf *rect)
}
-static void ui_draw_aligned_panel_header(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect, char dir)
+static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *rect, char dir)
{
Panel *panel= block->panel;
rcti hrect;
@@ -468,7 +468,7 @@ static void rectf_scale(rctf *rect, float scale)
}
/* panel integrated in buttonswindow, tool/property lists etc */
-void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect)
+void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
{
Panel *panel= block->panel;
rcti headrect;
@@ -499,7 +499,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re
/* horizontal title */
if(!(panel->flag & PNL_CLOSEDX)) {
- ui_draw_aligned_panel_header(ar, style, block, &headrect, 'h');
+ ui_draw_aligned_panel_header(style, block, &headrect, 'h');
/* itemrect smaller */
itemrect.xmax= headrect.xmax - 5.0f/block->aspect;
@@ -518,7 +518,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re
}
else if(panel->flag & PNL_CLOSEDX) {
/* draw vertical title */
- ui_draw_aligned_panel_header(ar, style, block, &headrect, 'v');
+ ui_draw_aligned_panel_header(style, block, &headrect, 'v');
}
/* an open panel */
else {
@@ -772,7 +772,7 @@ static void ui_do_animate(const bContext *C, Panel *panel)
}
}
-void uiBeginPanels(const bContext *C, ARegion *ar)
+void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar)
{
Panel *pa;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 50b85360196..5f8d604817a 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -27,6 +27,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "MEM_guardedalloc.h"
@@ -300,12 +301,12 @@ typedef struct uiTooltipData {
rcti bbox;
uiFontStyle fstyle;
char lines[MAX_TOOLTIP_LINES][512];
- int linedark[MAX_TOOLTIP_LINES];
+ unsigned int color[MAX_TOOLTIP_LINES];
int totline;
int toth, spaceh, lineh;
} uiTooltipData;
-static void ui_tooltip_region_draw(const bContext *C, ARegion *ar)
+static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
{
uiTooltipData *data= ar->regiondata;
rcti bbox= data->bbox;
@@ -320,16 +321,14 @@ static void ui_tooltip_region_draw(const bContext *C, ARegion *ar)
bbox.ymin= bbox.ymax - data->lineh;
for(a=0; a<data->totline; a++) {
- if(!data->linedark[a]) glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
- else glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
-
+ cpack(data->color[a]);
uiStyleFontDraw(&data->fstyle, &bbox, data->lines[a]);
bbox.ymin -= data->lineh + data->spaceh;
bbox.ymax -= data->lineh + data->spaceh;
}
}
-static void ui_tooltip_region_free(ARegion *ar)
+static void ui_tooltip_region_free_cb(ARegion *ar)
{
uiTooltipData *data;
@@ -358,6 +357,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if(but->tip && strlen(but->tip)) {
BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0]));
+ data->color[data->totline]= 0xFFFFFF;
data->totline++;
}
@@ -367,7 +367,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Shortcut: %s", buf);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
@@ -377,7 +377,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
ui_get_but_string(but, buf, sizeof(buf));
if(buf[0]) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Value: %s", buf);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
@@ -388,7 +388,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if (unit_type == PROP_UNIT_ROTATION) {
if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex));
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
@@ -397,21 +397,21 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if(ui_but_anim_expression_get(but, buf, sizeof(buf))) {
/* expression */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Expression: %s", buf);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
/* rna info */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
if(but->rnapoin.id.data) {
ID *id= but->rnapoin.id.data;
if(id->lib && id->lib->name) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Library: %s", id->lib->name);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
}
}
@@ -425,12 +425,27 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* operator info */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str);
- data->linedark[data->totline]= 1;
+ data->color[data->totline]= 0x888888;
data->totline++;
MEM_freeN(str);
+
+ /* second check if we are disabled - why */
+ if(but->flag & UI_BUT_DISABLED) {
+ const char *poll_msg;
+ CTX_wm_operator_poll_msg_set(C, NULL);
+ WM_operator_poll(C, but->optype);
+ poll_msg= CTX_wm_operator_poll_msg_get(C);
+ if(poll_msg) {
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Disabled: %s", poll_msg);
+ data->color[data->totline]= 0x6666ff; /* alert */
+ data->totline++;
+ }
+ }
}
+ assert(data->totline < MAX_TOOLTIP_LINES);
+
if(data->totline == 0) {
MEM_freeN(data);
return NULL;
@@ -440,8 +455,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
ar= ui_add_temporary_region(CTX_wm_screen(C));
memset(&type, 0, sizeof(ARegionType));
- type.draw= ui_tooltip_region_draw;
- type.free= ui_tooltip_region_free;
+ type.draw= ui_tooltip_region_draw_cb;
+ type.free= ui_tooltip_region_free_cb;
ar->type= &type;
/* set font, get bb */
@@ -817,7 +832,7 @@ void ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
}
}
-static void ui_searchbox_region_draw(const bContext *C, ARegion *ar)
+static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
{
uiSearchboxData *data= ar->regiondata;
@@ -825,7 +840,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar)
wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
if(!data->noback)
- ui_draw_search_back(U.uistyles.first, NULL, &data->bbox);
+ ui_draw_search_back(NULL, NULL, &data->bbox); /* style not used yet */
/* draw text */
if(data->items.totitem) {
@@ -884,7 +899,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar)
}
}
-static void ui_searchbox_region_free(ARegion *ar)
+static void ui_searchbox_region_free_cb(ARegion *ar)
{
uiSearchboxData *data= ar->regiondata;
int a;
@@ -916,8 +931,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
ar= ui_add_temporary_region(CTX_wm_screen(C));
memset(&type, 0, sizeof(ARegionType));
- type.draw= ui_searchbox_region_draw;
- type.free= ui_searchbox_region_free;
+ type.draw= ui_searchbox_region_draw_cb;
+ type.free= ui_searchbox_region_free_cb;
ar->type= &type;
/* create searchbox data */
@@ -1008,7 +1023,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
x2= winx;
}
}
- if(y1 < 0) {
+ if(y1 < 0) { /* XXX butregion NULL check?, there is one above */
int newy1;
UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->y2 + ofsy, 0, &newy1);
newy1 += butregion->winrct.ymin;
@@ -1116,6 +1131,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
if(but) {
int left=0, right=0, top=0, down=0;
int winx, winy;
+ int offscreen;
wm_window_get_size(window, &winx, &winy);
@@ -1206,6 +1222,12 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
// apply requested offset in the block
xof += block->xofs/block->aspect;
yof += block->yofs/block->aspect;
+
+ /* clamp to window bounds, could be made into an option if its ever annoying */
+ if( (offscreen= (block->miny+yof)) < 0) yof -= offscreen; /* bottom */
+ else if((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */
+ if( (offscreen= (block->minx+xof)) < 0) xof -= offscreen; /* left */
+ else if((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */
}
/* apply */
@@ -1396,7 +1418,7 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
/***************************** Menu Button ***************************/
-static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str)
+static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *arg_str)
{
uiBlock *block= uiLayoutGetBlock(layout);
uiPopupBlockHandle *handle= block->handle;
@@ -1478,7 +1500,7 @@ static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str)
menudata_free(md);
}
-void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but)
+void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
{
uiBlock *block= uiLayoutGetBlock(layout);
uiPopupBlockHandle *handle= block->handle;
@@ -1492,7 +1514,7 @@ void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but)
&handle->retvalue, (float)a, 0.0, 0, 0, "");
}
-void ui_block_func_ICONTEXTROW(bContext *C, uiLayout *layout, void *arg_but)
+void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
{
uiBlock *block= uiLayoutGetBlock(layout);
uiPopupBlockHandle *handle= block->handle;
@@ -1549,27 +1571,22 @@ static void ui_warp_pointer(short x, short y)
void ui_set_but_hsv(uiBut *but)
{
float col[3];
+ float *hsv= ui_block_hsv_get(but->block);
- hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2);
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
ui_set_but_vectorf(but, col);
}
/* also used by small picker, be careful with name checks below... */
-void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv)
+void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
{
uiBut *bt;
- float hsv[3];
+ float *hsv= ui_block_hsv_get(block);
/* this is to keep the H and S value when V is equal to zero
* and we are working in HSV mode, of course!
*/
- if (rhsv) {
- hsv[0]= rhsv[0];
- hsv[1]= rhsv[1];
- hsv[2]= rhsv[2];
- }
- else
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
// this updates button strings, is hackish... but button pointers are on stack of caller function
for(bt= block->buttons.first; bt; bt= bt->next) {
@@ -1625,7 +1642,7 @@ void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv)
}
}
-static void do_picker_rna_cb(bContext *C, void *bt1, void *unused)
+static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
{
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
@@ -1635,29 +1652,29 @@ static void do_picker_rna_cb(bContext *C, void *bt1, void *unused)
if (prop) {
RNA_property_float_get_array(&ptr, prop, rgb);
- ui_update_block_buts_rgb(but->block, rgb, NULL);
+ ui_update_block_buts_rgb(but->block, rgb);
}
if(popup)
popup->menuretval= UI_RETURN_UPDATE;
}
-static void do_hsv_rna_cb(bContext *C, void *bt1, void *hsv_arg)
+static void do_hsv_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
{
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
- float *hsv = (float *)hsv_arg;
float rgb[3];
+ float *hsv= ui_block_hsv_get(but->block);
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
- ui_update_block_buts_rgb(but->block, rgb, hsv);
+ ui_update_block_buts_rgb(but->block, rgb);
if(popup)
popup->menuretval= UI_RETURN_UPDATE;
}
-static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl)
+static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl)
{
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
@@ -1672,13 +1689,13 @@ static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl)
srgb_to_linearrgb_v3_v3(rgb, rgb);
}
- ui_update_block_buts_rgb(but->block, rgb, NULL);
+ ui_update_block_buts_rgb(but->block, rgb);
if(popup)
popup->menuretval= UI_RETURN_UPDATE;
}
-static void close_popup_cb(bContext *C, void *bt1, void *arg)
+static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
{
uiBut *but= (uiBut *)bt1;
uiPopupBlockHandle *popup= but->block->handle;
@@ -1718,7 +1735,7 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode)
}
}
-static void do_picker_new_mode_cb(bContext *C, void *bt1, void *colv)
+static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
{
uiBut *bt= bt1;
short colormode= ui_get_but_val(bt);
@@ -1772,11 +1789,13 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
uiBut *bt;
int width, butwidth;
static char tip[50];
- static float hsv[3];
static char hexcol[128];
float rgb_gamma[3];
float min, max, step, precision;
const char *propname = RNA_property_identifier(prop);
+ float *hsv= ui_block_hsv_get(block);
+
+ ui_block_hsv_get(block);
width= PICKER_TOTAL_W;
butwidth = width - UI_UNIT_X - 10;
@@ -1796,7 +1815,6 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision);
RNA_property_float_get_array(ptr, prop, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
switch (U.color_picker_type) {
case USER_CP_CIRCLE:
@@ -1816,11 +1834,11 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
/* mode */
uiBlockBeginAlign(block);
bt= uiDefButS(block, ROW, 0, "RGB", 0, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, "");
- uiButSetFunc(bt, do_picker_new_mode_cb, bt, rgb);
+ uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
bt= uiDefButS(block, ROW, 0, "HSV", width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, "");
- uiButSetFunc(bt, do_picker_new_mode_cb, bt, hsv);
+ uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
bt= uiDefButS(block, ROW, 0, "Hex", 2*width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, "");
- uiButSetFunc(bt, do_picker_new_mode_cb, bt, hexcol);
+ uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
uiBlockEndAlign(block);
bt= uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth+10, -60, UI_UNIT_X, UI_UNIT_Y, NULL);
@@ -1856,19 +1874,19 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
rgb[3]= 1.0f;
}
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
-
sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)");
uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol);
uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+
picker_new_hide_reveal(block, colormode);
}
-static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *event)
+static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, wmEvent *event)
{
float add= 0.0f;
@@ -1884,16 +1902,17 @@ static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *eve
if(but->type==HSVCUBE && but->active==NULL) {
uiPopupBlockHandle *popup= block->handle;
float col[3];
+ float *hsv= ui_block_hsv_get(block);
ui_get_but_vectorf(but, col);
- rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2);
- but->hsv[2]= CLAMPIS(but->hsv[2]+add, 0.0f, 1.0f);
- hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2);
+ rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
+ hsv[2]= CLAMPIS(hsv[2]+add, 0.0f, 1.0f);
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
ui_set_but_vectorf(but, col);
- ui_update_block_buts_rgb(block, col, NULL);
+ ui_update_block_buts_rgb(block, col);
if(popup)
popup->menuretval= UI_RETURN_UPDATE;
@@ -1920,12 +1939,13 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
VECCOPY(handle->retvec, but->editvec);
-
+
uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop);
+
block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN;
uiBoundsBlock(block, 10);
- block->block_event_func= ui_picker_small_wheel;
+ block->block_event_func= ui_picker_small_wheel_cb;
/* and lets go */
block->direction= UI_TOP;
@@ -2416,3 +2436,7 @@ void uiPupBlockClose(bContext *C, uiBlock *block)
}
}
+float *ui_block_hsv_get(uiBlock *block)
+{
+ return block->_hsv;
+}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 93424f365ea..c7edec09340 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -491,7 +491,7 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *p
* - propname: property identifier for property that ID-pointer gets stored to
* - proptypename: property identifier for property used to determine the type of ID-pointer that can be used
*/
-void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *proptypename, char *text)
+void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, char *propname, char *proptypename, char *text)
{
PropertyRNA *propID, *propType;
uiLayout *row;
@@ -536,7 +536,7 @@ void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
* - propname: property identifier for property that path gets stored to
* - root_ptr: struct that path gets built from
*/
-void uiTemplatePathBuilder(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, PointerRNA *root_ptr, char *text)
+void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, char *propname, PointerRNA *UNUSED(root_ptr), char *text)
{
PropertyRNA *propPath;
uiLayout *row;
@@ -817,7 +817,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
#define REMAKEIPO 8
#define B_DIFF 9
-void do_constraint_panels(bContext *C, void *arg, int event)
+void do_constraint_panels(bContext *C, void *UNUSED(arg), int event)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -853,7 +853,7 @@ void do_constraint_panels(bContext *C, void *arg, int event)
// XXX allqueue(REDRAWBUTSEDIT, 0);
}
-static void constraint_active_func(bContext *C, void *ob_v, void *con_v)
+static void constraint_active_func(bContext *UNUSED(C), void *ob_v, void *con_v)
{
ED_object_constraint_set_active(ob_v, con_v);
}
@@ -1142,7 +1142,7 @@ typedef struct RNAUpdateCb {
PropertyRNA *prop;
} RNAUpdateCb;
-static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused)
+static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
{
RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb;
@@ -1319,7 +1319,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int
/********************* Histogram Template ************************/
-void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int expand)
+void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
@@ -1358,7 +1358,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int
/********************* Waveform Template ************************/
-void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int expand)
+void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
@@ -1394,7 +1394,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int e
/********************* Vectorscope Template ************************/
-void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, int expand)
+void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
@@ -1432,7 +1432,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, in
/********************* CurveMapping Template ************************/
-static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused)
+static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(arg))
{
CurveMapping *cumap = cumap_v;
float d;
@@ -1450,7 +1450,7 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused)
ED_region_tag_redraw(CTX_wm_region(C));
}
-static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused)
+static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(unused))
{
CurveMapping *cumap = cumap_v;
float d, d1;
@@ -1487,7 +1487,7 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused)
ED_region_tag_redraw(CTX_wm_region(C));
}
-static void curvemap_buttons_setclip(bContext *C, void *cumap_v, void *unused)
+static void curvemap_buttons_setclip(bContext *UNUSED(C), void *cumap_v, void *UNUSED(arg))
{
CurveMapping *cumap = cumap_v;
@@ -1607,7 +1607,7 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void
return block;
}
-static void curvemap_buttons_redraw(bContext *C, void *arg1, void *arg2)
+static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
ED_region_tag_redraw(CTX_wm_region(C));
}
@@ -2205,7 +2205,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propna
/************************* Operator Search Template **************************/
-static void operator_call_cb(bContext *C, void *arg1, void *arg2)
+static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2)
{
wmOperatorType *ot= arg2;
@@ -2213,7 +2213,7 @@ static void operator_call_cb(bContext *C, void *arg1, void *arg2)
WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
}
-static void operator_search_cb(const bContext *C, void *arg, char *str, uiSearchItems *items)
+static void operator_search_cb(const bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items)
{
wmOperatorType *ot = WM_operatortype_first();
@@ -2260,7 +2260,7 @@ void uiTemplateOperatorSearch(uiLayout *layout)
#define B_STOPANIM 3
#define B_STOPCOMPO 4
-static void do_running_jobs(bContext *C, void *arg, int event)
+static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
{
switch(event) {
case B_STOPRENDER:
@@ -2332,7 +2332,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiBut *but;
uiStyle *style= U.uistyles.first;
int width;
- float hsv[3];
/* if the report display has timed out, don't show */
if (!reports->reporttimer) return;
@@ -2343,8 +2342,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
abs = uiLayoutAbsolute(layout, 0);
block= uiLayoutGetBlock(abs);
-
- rgb_to_hsv(rti->col[0], rti->col[1], rti->col[2], hsv+0, hsv+1, hsv+2);
width = BLF_width(style->widget.uifont_id, report->message);
width = MIN2(rti->widthfac*width, width);
@@ -2353,11 +2350,16 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
/* make a box around the report to make it stand out */
uiBlockBeginAlign(block);
but= uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X+10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
- copy_v3_v3(but->hsv, hsv); /* set the report's bg colour in but->hsv - ROUNDBOX feature */
-
+ /* set the report's bg colour in but->col - ROUNDBOX feature */
+ but->col[0]= FTOCHAR(rti->col[0]);
+ but->col[1]= FTOCHAR(rti->col[1]);
+ but->col[2]= FTOCHAR(rti->col[2]);
+ but->col[3]= 255;
+
but= uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
- but->hsv[0] = but->hsv[1] = 0.0; /* set a greyscale bg colour in but->hsv - ROUNDBOX feature */
- but->hsv[2] = rti->greyscale;
+ but->col[0]= but->col[1]= but->col[2]= FTOCHAR(rti->greyscale);
+ but->col[3]= 255;
+
uiBlockEndAlign(block);
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 37278340275..6d8aa89afb0 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -131,7 +131,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
return but;
}
-void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int columns)
+void uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int columns)
{
uiLayout *split, *col;
int flag;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index b892ce1ca6d..ed7284bf264 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -27,6 +27,7 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "DNA_screen_types.h"
@@ -284,8 +285,10 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
float facxi= (maxxi!=minxi) ? 1.0f/(maxxi-minxi) : 0.0f; /* for uv, can divide by zero */
float facyi= (maxyi!=minyi) ? 1.0f/(maxyi-minyi) : 0.0f;
int a, tot= 0, minsize;
+ const int hnum= ((roundboxalign & (1|2))==(1|2) || (roundboxalign & (4|8))==(4|8)) ? 1 : 2;
+ const int vnum= ((roundboxalign & (1|8))==(1|8) || (roundboxalign & (2|4))==(2|4)) ? 1 : 2;
- minsize= MIN2(rect->xmax-rect->xmin, rect->ymax-rect->ymin);
+ minsize= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum);
if(2.0f*rad > minsize)
rad= 0.5f*minsize;
@@ -742,7 +745,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
#define PREVIEW_PAD 4
-static void widget_draw_preview(BIFIconID icon, float aspect, float alpha, rcti *rect)
+static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha), rcti *rect)
{
int w, h, x, y, size;
@@ -1490,7 +1493,7 @@ static void widget_state_label(uiWidgetType *wt, int state)
}
-static void widget_state_nothing(uiWidgetType *wt, int state)
+static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state))
{
wt->wcol= *(wt->wcol_theme);
}
@@ -1644,7 +1647,7 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* gouraud triangle fan */
float radstep, ang= 0.0f;
float centx, centy, radius;
- float rgb[3], hsv[3], hsvo[3], col[3], colcent[3];
+ float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
int a, tot= 32;
int color_profile = but->block->color_profile;
@@ -1662,7 +1665,8 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* color */
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+ copy_v3_v3(hsv, ui_block_hsv_get(but->block));
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
copy_v3_v3(hsvo, hsv);
/* exception: if 'lock' is set
@@ -1722,16 +1726,14 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* ************ custom buttons, old stuff ************** */
/* draws in resolution of 20x4 colors */
-void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha)
+void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha)
{
int a;
- float h, s, v;
+ float h= hsv[0], s= hsv[1], v= hsv[0];
float dx, dy, sx1, sx2, sy;
float col0[4][3]; // left half, rect bottom to top
float col1[4][3]; // right half, rect bottom to top
-
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v);
-
+
/* draw series of gouraud rects */
glShadeModel(GL_SMOOTH);
@@ -1772,6 +1774,12 @@ void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha)
VECCOPY(col1[1], col1[2]);
VECCOPY(col1[3], col1[2]);
break;
+ default:
+ assert(!"invalid 'type' argument");
+ hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]);
+ VECCOPY(col1[0], col1[2]);
+ VECCOPY(col1[1], col1[2]);
+ VECCOPY(col1[3], col1[2]);
}
/* old below */
@@ -1856,11 +1864,21 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
{
float rgb[3], h,s,v;
float x=0.0f, y=0.0f;
+ float *hsv= ui_block_hsv_get(but->block);
+ float hsvn[3];
+
+ h= hsv[0];
+ s= hsv[1];
+ v= hsv[2];
ui_get_but_vectorf(but, rgb);
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v);
+
+ hsvn[0]= h;
+ hsvn[1]= s;
+ hsvn[2]= v;
- ui_draw_gradient(rect, rgb, but->a1, 1.f);
+ ui_draw_gradient(rect, hsvn, but->a1, 1.f);
switch((int)but->a1) {
case UI_GRAD_SV:
@@ -1938,7 +1956,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
/* ************ separator, for menus etc ***************** */
-static void ui_draw_separator(uiBut *but, rcti *rect, uiWidgetColors *wcol)
+static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol)
{
int y = rect->ymin + (rect->ymax - rect->ymin)/2 - 1;
unsigned char col[4];
@@ -2110,7 +2128,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
}
}
-static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
rcti rect1;
double value;
@@ -2171,7 +2189,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
uiWidgetScrollDraw(wcol, rect, &rect1, state);
}
-static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
rcti rect_prog = *rect, rect_bar = *rect;
float value = but->a1;
@@ -2197,7 +2215,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
rect->xmin -= 6;
}
-static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
if(but->flag & UI_SELECT) {
@@ -2219,7 +2237,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
uiWidgetBase wtb, wtb1;
rcti rect1;
double value;
- float offs, fac;
+ float offs, toffs, fac;
char outline[3];
widget_init(&wtb);
@@ -2229,6 +2247,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
/* fully rounded */
offs= 0.5f*(rect->ymax - rect->ymin);
+ toffs = offs*0.75f;
round_box_edges(&wtb, roundboxalign, rect, offs);
wtb.outline= 0;
@@ -2274,8 +2293,8 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
widgetbase_draw(&wtb, wcol);
/* text space */
- rect->xmin += offs*0.75f;
- rect->xmax -= offs*0.75f;
+ rect->xmin += toffs;
+ rect->xmax -= toffs;
}
/* I think 3 is sufficient border to indicate keyed status */
@@ -2350,7 +2369,7 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun
}
-static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
@@ -2368,7 +2387,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roun
rect->xmax -= (rect->ymax-rect->ymin);
}
-static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
@@ -2381,7 +2400,7 @@ static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int
widgetbase_draw(&wtb, wcol);
}
-static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
if(state & UI_ACTIVE) {
uiWidgetBase wtb;
@@ -2396,7 +2415,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int
}
}
-static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
uiWidgetBase wtb;
@@ -2409,7 +2428,7 @@ static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int
widgetbase_draw(&wtb, wcol);
}
-static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
uiWidgetBase wtb;
@@ -2422,7 +2441,7 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int
widgetbase_draw(&wtb, wcol);
}
-static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
uiWidgetBase wtb;
rcti recttemp= *rect;
@@ -2455,7 +2474,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int ro
}
-static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
@@ -2468,7 +2487,7 @@ static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int rou
}
-static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
char old_col[3];
@@ -2478,12 +2497,10 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state,
VECCOPY(old_col, wcol->inner);
/* abuse but->hsv - if it's non-zero, use this colour as the box's background */
- if ((but->hsv[0] != 0.0) || (but->hsv[1] != 0.0) || (but->hsv[2] != 0.0)) {
- float rgb[3];
- hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], rgb+0, rgb+1, rgb+2);
- wcol->inner[0] = rgb[0] * 255;
- wcol->inner[1] = rgb[1] * 255;
- wcol->inner[2] = rgb[2] * 255;
+ if (but->col[3]) {
+ wcol->inner[0] = but->col[0];
+ wcol->inner[1] = but->col[1];
+ wcol->inner[2] = but->col[2];
}
/* half rounded */
@@ -2498,7 +2515,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state,
VECCOPY(wcol->inner, old_col);
}
-static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
@@ -2511,7 +2528,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundbox
}
-static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
float rad= 5.0f; //0.5f*(rect->ymax - rect->ymin);
@@ -2776,7 +2793,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
break;
case SEPR:
- ui_draw_separator(but, rect, &tui->wcol_menu_item);
+ ui_draw_separator(rect, &tui->wcol_menu_item);
break;
default:
@@ -2962,7 +2979,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
}
}
-void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect)
+void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
{
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_BACK);
@@ -2974,7 +2991,7 @@ void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect)
}
-void ui_draw_search_back(uiStyle *style, uiBlock *block, rcti *rect)
+void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
{
uiWidgetType *wt= widget_type(UI_WTYPE_BOX);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 14ec7c6d0d6..a17d578fc06 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -967,7 +967,7 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
}
/* Set view matrices to use 'cur' rect as viewing frame for View2D drawing */
-void UI_view2d_view_ortho(const bContext *C, View2D *v2d)
+void UI_view2d_view_ortho(View2D *v2d)
{
rctf curmasked;
float xofs, yofs;
@@ -997,9 +997,8 @@ void UI_view2d_view_ortho(const bContext *C, View2D *v2d)
/* Set view matrices to only use one axis of 'cur' only
* - xaxis = if non-zero, only use cur x-axis, otherwise use cur-yaxis (mostly this will be used for x)
*/
-void UI_view2d_view_orthoSpecial(const bContext *C, View2D *v2d, short xaxis)
+void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis)
{
- ARegion *ar= CTX_wm_region(C);
rctf curmasked;
float xofs, yofs;
@@ -1098,12 +1097,12 @@ static void step_to_grid(float *step, int *power, int unit)
*
* - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames
* - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals
- * - winx = width of region we're drawing to
+ * - winx = width of region we're drawing to, note: not used but keeping for completeness.
* - winy = height of region we're drawing into
*/
-View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy)
+View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy)
{
- Scene *scene= CTX_data_scene(C);
+
View2DGrid *grid;
float space, pixels, seconddiv;
int secondgrid;
@@ -1174,7 +1173,7 @@ View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, sh
}
/* Draw gridlines in the given 2d-region */
-void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int flag)
+void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
{
float vec1[2], vec2[2];
int a, step;
@@ -1283,7 +1282,7 @@ void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int f
}
/* Draw a constant grid in given 2d-region */
-void UI_view2d_constant_grid_draw(const bContext *C, View2D *v2d)
+void UI_view2d_constant_grid_draw(View2D *v2d)
{
float start, step= 25.0f;
@@ -1481,7 +1480,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
scrollers->yclamp= yclamp;
scrollers->yunits= yunits;
- scrollers->grid= UI_view2d_grid_calc(C, v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
+ scrollers->grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
}
/* return scrollers */
@@ -1489,7 +1488,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
}
/* Print scale marking along a time scrollbar */
-static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, float y, float val, int power, short unit, char dir)
+static void scroll_printstr(Scene *scene, float x, float y, float val, int power, short unit, char dir)
{
int len;
char str[32];
@@ -1614,16 +1613,16 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
switch (vs->xunits) {
case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/
- scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h');
+ scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h');
break;
case V2D_UNIT_FRAMESCALE: /* frames (not always as whole numbers) */
- scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h');
+ scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h');
break;
case V2D_UNIT_SECONDS: /* seconds */
fac2= val/(float)FPS;
- scroll_printstr(vs, scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h');
+ scroll_printstr(scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h');
break;
case V2D_UNIT_SECONDSSEQ: /* seconds with special calculations (only used for sequencer only) */
@@ -1634,13 +1633,13 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
time= (float)floor(fac2);
fac2= fac2-time;
- scroll_printstr(vs, scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h');
+ scroll_printstr(scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h');
}
break;
case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */
/* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */
- scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v');
+ scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v');
break;
}
}
@@ -1719,7 +1718,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
if(fac < vert.ymin+10)
continue;
- scroll_printstr(vs, scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v');
+ scroll_printstr(scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v');
}
BLF_disable_default(BLF_ROTATION);
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index de1b26e987b..48523ec1a5a 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -119,7 +119,7 @@ static int view_pan_init(bContext *C, wmOperator *op)
}
/* apply transform to view (i.e. adjust 'cur' rect) */
-static void view_pan_apply(bContext *C, wmOperator *op)
+static void view_pan_apply(wmOperator *op)
{
v2dViewPanData *vpd= op->customdata;
View2D *v2d= vpd->v2d;
@@ -146,7 +146,6 @@ static void view_pan_apply(bContext *C, wmOperator *op)
ED_region_tag_redraw(vpd->ar);
UI_view2d_sync(vpd->sc, vpd->sa, v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
/* exceptions */
if (vpd->sa->spacetype==SPACE_OUTLINER) {
@@ -157,7 +156,7 @@ static void view_pan_apply(bContext *C, wmOperator *op)
}
/* cleanup temp customdata */
-static void view_pan_exit(bContext *C, wmOperator *op)
+static void view_pan_exit(wmOperator *op)
{
if (op->customdata) {
MEM_freeN(op->customdata);
@@ -173,8 +172,8 @@ static int view_pan_exec(bContext *C, wmOperator *op)
if (!view_pan_init(C, op))
return OPERATOR_CANCELLED;
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -200,8 +199,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "deltax", event->prevx - event->x);
RNA_int_set(op->ptr, "deltay", event->prevy - event->y);
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -237,7 +236,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
vpd->lastx= event->x;
vpd->lasty= event->y;
- view_pan_apply(C, op);
+ view_pan_apply(op);
}
break;
@@ -248,7 +247,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
- view_pan_exit(C, op);
+ view_pan_exit(op);
WM_cursor_restore(CTX_wm_window(C));
WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL);
@@ -261,7 +260,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
- view_pan_exit(C, op);
+ view_pan_exit(op);
WM_cursor_restore(CTX_wm_window(C));
return OPERATOR_FINISHED;
@@ -272,9 +271,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int view_pan_cancel(bContext *C, wmOperator *op)
+static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op)
{
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_CANCELLED;
}
@@ -313,7 +312,7 @@ static int view_scrollright_exec(bContext *C, wmOperator *op)
/* also, check if can pan in horizontal axis */
vpd= op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
@@ -322,8 +321,8 @@ static int view_scrollright_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltay", 0);
/* apply movement, then we're done */
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -357,7 +356,7 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op)
/* also, check if can pan in horizontal axis */
vpd= op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
@@ -366,8 +365,8 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltay", 0);
/* apply movement, then we're done */
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -400,7 +399,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
/* also, check if can pan in vertical axis */
vpd= op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
@@ -409,8 +408,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltay", -40);
/* apply movement, then we're done */
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -444,7 +443,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
/* also, check if can pan in vertical axis */
vpd= op->customdata;
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
- view_pan_exit(C, op);
+ view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
}
@@ -453,8 +452,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltay", 40);
/* apply movement, then we're done */
- view_pan_apply(C, op);
- view_pan_exit(C, op);
+ view_pan_apply(op);
+ view_pan_exit(op);
return OPERATOR_FINISHED;
}
@@ -628,13 +627,12 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(vzd->ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
}
/* --------------- Individual Operators ------------------- */
/* cleanup temp customdata */
-static void view_zoomstep_exit(bContext *C, wmOperator *op)
+static void view_zoomstep_exit(wmOperator *op)
{
if (op->customdata) {
MEM_freeN(op->customdata);
@@ -656,7 +654,7 @@ static int view_zoomin_exec(bContext *C, wmOperator *op)
/* apply movement, then we're done */
view_zoomstep_apply(C, op);
- view_zoomstep_exit(C, op);
+ view_zoomstep_exit(op);
return OPERATOR_FINISHED;
}
@@ -713,7 +711,7 @@ static int view_zoomout_exec(bContext *C, wmOperator *op)
/* apply movement, then we're done */
view_zoomstep_apply(C, op);
- view_zoomstep_exit(C, op);
+ view_zoomstep_exit(op);
return OPERATOR_FINISHED;
}
@@ -822,11 +820,10 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(vzd->ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
}
/* cleanup temp customdata */
-static void view_zoomdrag_exit(bContext *C, wmOperator *op)
+static void view_zoomdrag_exit(wmOperator *op)
{
if (op->customdata) {
MEM_freeN(op->customdata);
@@ -841,7 +838,7 @@ static int view_zoomdrag_exec(bContext *C, wmOperator *op)
return OPERATOR_PASS_THROUGH;
view_zoomdrag_apply(C, op);
- view_zoomdrag_exit(C, op);
+ view_zoomdrag_exit(op);
return OPERATOR_FINISHED;
}
@@ -876,7 +873,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_float_set(op->ptr, "deltay", dy);
view_zoomdrag_apply(C, op);
- view_zoomdrag_exit(C, op);
+ view_zoomdrag_exit(op);
return OPERATOR_FINISHED;
}
@@ -988,7 +985,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
RNA_float_set(op->ptr, "deltay", 0);
/* free customdata */
- view_zoomdrag_exit(C, op);
+ view_zoomdrag_exit(op);
WM_cursor_restore(CTX_wm_window(C));
return OPERATOR_FINISHED;
@@ -1095,7 +1092,6 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
return OPERATOR_FINISHED;
}
@@ -1355,7 +1351,6 @@ static void scroller_activate_apply(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(vsm->ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
}
/* handle user input for scrollers - calculations of mouse-movement need to be done here, not in the apply callback! */
@@ -1517,7 +1512,7 @@ void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
/* ********************************************************* */
/* RESET */
-static int reset_exec(bContext *C, wmOperator *op)
+static int reset_exec(bContext *C, wmOperator *UNUSED(op))
{
uiStyle *style= U.uistyles.first;
ARegion *ar= CTX_wm_region(C);
@@ -1560,7 +1555,6 @@ static int reset_exec(bContext *C, wmOperator *op)
/* request updates to be done... */
ED_region_tag_redraw(ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- WM_event_add_mousemove(C);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index fc92598591a..e33e24a75ce 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -68,7 +68,7 @@
#include "mesh_intern.h"
/* ***************** XXX **************** */
-static int pupmenu(const char *dummy) {return 0;}
+static int pupmenu(const char *UNUSED(dummy)) {return 0;}
/* ***************** XXX **************** */
@@ -343,7 +343,7 @@ void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index)
// object_tface_flags_changed(OBACT, 0);
}
-void select_linked_tfaces(bContext *C, Object *ob, short mval[2], int mode)
+void select_linked_tfaces(bContext *UNUSED(C), Object *ob, short UNUSED(mval[2]), int mode)
{
Mesh *me;
unsigned int index=0;
@@ -464,7 +464,7 @@ int minmax_tface(Object *ob, float *min, float *max)
#define ME_SEAM_DONE 2 /* reuse this flag */
-static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert)
+static float edgetag_cut_cost(int e1, int e2, int vert)
{
EditVert *v = EM_get_vert_for_index(vert);
EditEdge *eed1 = EM_get_edge_for_index(e1), *eed2 = EM_get_edge_for_index(e2);
@@ -483,7 +483,7 @@ static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert)
return cost;
}
-static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost)
+static void edgetag_add_adjacent(Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost)
{
int startadj, endadj = nedges[vertnum+1];
@@ -495,7 +495,7 @@ static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertn
if (eedadj->f2 & ME_SEAM_DONE)
continue;
- newcost = cost[mednum] + edgetag_cut_cost(em, mednum, adjnum, vertnum);
+ newcost = cost[mednum] + edgetag_cut_cost(mednum, adjnum, vertnum);
if (cost[adjnum] > newcost) {
cost[adjnum] = newcost;
@@ -621,8 +621,8 @@ int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge
eed->f2 |= ME_SEAM_DONE;
- edgetag_add_adjacent(em, heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost);
- edgetag_add_adjacent(em, heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost);
+ edgetag_add_adjacent(heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost);
+ edgetag_add_adjacent(heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost);
}
@@ -819,7 +819,7 @@ void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select, i
view3d_validate_backbuf(&vc);
- ibuf = IMB_allocImBuf(sx,sy,32,IB_rect,0);
+ ibuf = IMB_allocImBuf(sx,sy,32,IB_rect);
rt = ibuf->rect;
glReadPixels(rect->xmin+vc.ar->winrct.xmin, rect->ymin+vc.ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index ff2fad3f551..80df034552d 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -78,8 +78,8 @@ editmesh.c:
*/
/* XXX */
-static void BIF_undo_push(const char *dummy) {}
-static void error(const char *dummy) {}
+static void BIF_undo_push(const char *UNUSED(arg)) {}
+static void error(const char *UNUSED(arg)) {}
/* ***************** HASH ********************* */
@@ -91,7 +91,7 @@ static void error(const char *dummy) {}
/* ************ ADD / REMOVE / FIND ****************** */
-static void *calloc_em(EditMesh *em, size_t size, size_t nr)
+static void *calloc_em(EditMesh *UNUSED(em), size_t size, size_t nr)
{
return calloc(size, nr);
}
@@ -447,19 +447,19 @@ int editface_containsEdge(EditFace *efa, EditEdge *eed)
/* ************************ stuct EditMesh manipulation ***************************** */
/* fake callocs for fastmalloc below */
-static void *calloc_fastvert(EditMesh *em, size_t size, size_t nr)
+static void *calloc_fastvert(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr))
{
EditVert *eve= em->curvert++;
eve->fast= 1;
return eve;
}
-static void *calloc_fastedge(EditMesh *em, size_t size, size_t nr)
+static void *calloc_fastedge(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr))
{
EditEdge *eed= em->curedge++;
eed->fast= 1;
return eed;
}
-static void *calloc_fastface(EditMesh *em, size_t size, size_t nr)
+static void *calloc_fastface(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr))
{
EditFace *efa= em->curface++;
efa->fast= 1;
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 7dac8a465fa..89991015419 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -110,57 +110,95 @@ static short icoface[20][3] = {
static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
{
ViewContext vc;
- EditVert *eve, *v1;
+ EditVert *eve;
float min[3], max[3];
int done= 0;
-
+ short use_proj;
+printf("%d\n", event->val);
em_setup_viewcontext(C, &vc);
+
+ use_proj= (vc.scene->toolsettings->snap_flag & SCE_SNAP) && (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE);
+
+ invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
INIT_MINMAX(min, max);
- for(v1= vc.em->verts.first;v1; v1=v1->next) {
- if(v1->f & SELECT) {
- DO_MINMAX(v1->co, min, max);
+ for(eve= vc.em->verts.first; eve; eve= eve->next) {
+ if(eve->f & SELECT) {
+ DO_MINMAX(eve->co, min, max);
done= 1;
}
}
/* call extrude? */
if(done) {
+ short rot_src= RNA_boolean_get(op->ptr, "rotate_source");
EditEdge *eed;
float vec[3], cent[3], mat[3][3];
float nor[3]= {0.0, 0.0, 0.0};
- /* check for edges that are half selected, use for rotation */
+ /* 2D normal calc */
+ float mval_f[2]= {(float)event->mval[0], (float)event->mval[1]};
+
done= 0;
+
+ /* calculate the normal for selected edges */
for(eed= vc.em->edges.first; eed; eed= eed->next) {
- if( (eed->v1->f & SELECT)+(eed->v2->f & SELECT) == SELECT ) {
- if(eed->v1->f & SELECT) sub_v3_v3v3(vec, eed->v1->co, eed->v2->co);
- else sub_v3_v3v3(vec, eed->v2->co, eed->v1->co);
- add_v3_v3(nor, vec);
+ if(eed->f & SELECT) {
+ float co1[3], co2[3];
+ mul_v3_m4v3(co1, vc.obedit->obmat, eed->v1->co);
+ mul_v3_m4v3(co2, vc.obedit->obmat, eed->v2->co);
+ project_float_noclip(vc.ar, co1, co1);
+ project_float_noclip(vc.ar, co2, co2);
+
+ /* 2D rotate by 90d while adding.
+ * (x, y) = (y, -x)
+ *
+ * accumulate the screenspace normal in 2D,
+ * with screenspace edge length weighting the result. */
+ if(line_point_side_v2(co1, co2, mval_f) >= 0.0f) {
+ nor[0] += (co1[1] - co2[1]);
+ nor[1] += -(co1[0] - co2[0]);
+ }
+ else {
+ nor[0] += (co2[1] - co1[1]);
+ nor[1] += -(co2[0] - co1[0]);
+ }
done= 1;
}
}
- if(done) normalize_v3(nor);
+
+ if(done) {
+ float view_vec[3], cross[3];
+
+ /* convert the 2D nomal into 3D */
+ mul_mat3_m4_v3(vc.rv3d->viewinv, nor); /* worldspace */
+ mul_mat3_m4_v3(vc.obedit->imat, nor); /* local space */
+
+ /* correct the normal to be aligned on the view plane */
+ copy_v3_v3(view_vec, vc.rv3d->viewinv[2]);
+ mul_mat3_m4_v3(vc.obedit->imat, view_vec);
+ cross_v3_v3v3(cross, nor, view_vec);
+ cross_v3_v3v3(nor, view_vec, cross);
+ normalize_v3(nor);
+ }
/* center */
- add_v3_v3v3(cent, min, max);
- mul_v3_fl(cent, 0.5f);
- VECCOPY(min, cent);
+ mid_v3_v3v3(cent, min, max);
+ copy_v3_v3(min, cent);
mul_m4_v3(vc.obedit->obmat, min); // view space
view3d_get_view_aligned_coordinate(&vc, min, event->mval);
- invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
mul_m4_v3(vc.obedit->imat, min); // back in object space
- sub_v3_v3v3(min, min, cent);
+ sub_v3_v3(min, cent);
/* calculate rotation */
unit_m3(mat);
if(done) {
float dot;
- VECCOPY(vec, min);
+ copy_v3_v3(vec, min);
normalize_v3(vec);
dot= INPR(vec, nor);
@@ -170,16 +208,26 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
cross_v3_v3v3(cross, nor, vec);
normalize_v3(cross);
dot= 0.5f*saacos(dot);
+
+ /* halve the rotation if its applied twice */
+ if(rot_src) dot *= 0.5f;
+
si= (float)sin(dot);
q1[0]= (float)cos(dot);
q1[1]= cross[0]*si;
q1[2]= cross[1]*si;
- q1[3]= cross[2]*si;
-
+ q1[3]= cross[2]*si;
quat_to_mat3( mat,q1);
}
}
+ if(rot_src) {
+ rotateflag(vc.em, SELECT, cent, mat);
+ /* also project the source, for retopo workflow */
+ if(use_proj)
+ EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em);
+ }
+
extrudeflag(vc.obedit, vc.em, SELECT, nor, 0);
rotateflag(vc.em, SELECT, cent, mat);
translateflag(vc.em, SELECT, min);
@@ -190,7 +238,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
float mat[3][3],imat[3][3];
float *curs= give_cursor(vc.scene, vc.v3d);
- VECCOPY(min, curs);
+ copy_v3_v3(min, curs);
view3d_get_view_aligned_coordinate(&vc, min, event->mval);
eve= addvertlist(vc.em, 0, NULL);
@@ -198,14 +246,16 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
copy_m3_m4(mat, vc.obedit->obmat);
invert_m3_m3(imat, mat);
- VECCOPY(eve->co, min);
+ copy_v3_v3(eve->co, min);
mul_m3_v3(imat, eve->co);
sub_v3_v3v3(eve->co, eve->co, vc.obedit->obmat[3]);
eve->f= SELECT;
}
-
- //retopo_do_all();
+
+ if(use_proj)
+ EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em);
+
WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data);
DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA);
@@ -225,6 +275,8 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "rotate_source", 1, "Rotate Source", "Rotate initial selection giving better shape");
}
@@ -997,15 +1049,13 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
/* one segment first: the X axis */
phi = (2*dia)/(float)(tot-1);
phid = (2*dia)/(float)(seg-1);
- for(a=0;a<tot;a++) {
+ for(a=tot-1;a>=0;a--) {
vec[0] = (phi*a) - dia;
vec[1]= - dia;
vec[2]= 0.0f;
eve= addvertlist(em, vec, NULL);
eve->f= 1+2+4;
- if (a) {
- addedgelist(em, eve->prev, eve, NULL);
- }
+ addedgelist(em, eve->prev, eve, NULL);
}
/* extrude and translate */
vec[0]= vec[2]= 0.0;
@@ -1657,7 +1707,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
/****************** add duplicate operator ***************/
-static int mesh_duplicate_exec(bContext *C, wmOperator *op)
+static int mesh_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(ob->data);
@@ -1672,7 +1722,7 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
WM_cursor_wait(1);
mesh_duplicate_exec(C, op);
diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c
index d34cca0d358..b632cb2a842 100644
--- a/source/blender/editors/mesh/editmesh_lib.c
+++ b/source/blender/editors/mesh/editmesh_lib.c
@@ -58,6 +58,7 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_view3d.h"
+#include "ED_transform.h"
#include "mesh_intern.h"
@@ -214,7 +215,7 @@ static int EM_check_selection(EditMesh *em, void *data)
return 0;
}
-void EM_remove_selection(EditMesh *em, void *data, int type)
+void EM_remove_selection(EditMesh *em, void *data, int UNUSED(type))
{
EditSelection *ese;
for(ese=em->selected.first; ese; ese = ese->next){
@@ -1050,7 +1051,7 @@ static void set_edge_directions_f2(EditMesh *em, int val)
/* individual face extrude */
/* will use vertex normals for extrusion directions, so *nor is unaffected */
-short extrudeflag_face_indiv(EditMesh *em, short flag, float *nor)
+short extrudeflag_face_indiv(EditMesh *em, short UNUSED(flag), float *UNUSED(nor))
{
EditVert *eve, *v1, *v2, *v3, *v4;
EditEdge *eed;
@@ -1204,7 +1205,7 @@ short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor)
}
/* extrudes individual vertices */
-short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor)
+short extrudeflag_verts_indiv(EditMesh *em, short flag, float *UNUSED(nor))
{
EditVert *eve;
@@ -1230,7 +1231,7 @@ short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor)
/* this is actually a recode of extrudeflag(), using proper edge/face select */
/* hurms, doesnt use 'flag' yet, but its not called by primitive making stuff anyway */
-static short extrudeflag_edge(Object *obedit, EditMesh *em, short flag, float *nor, int all)
+static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag), float *nor, int all)
{
/* all select edges/faces: extrude */
/* old select is cleared, in new ones it is set */
@@ -2765,3 +2766,18 @@ int EM_deselect_nth(EditMesh *em, int nth)
return 0;
}
+void EM_project_snap_verts(bContext *C, ARegion *ar, Object *obedit, EditMesh *em)
+{
+ EditVert *eve;
+ for(eve= em->verts.first;eve; eve=eve->next) {
+ if(eve->f & SELECT) {
+ float mval[2], vec[3], no_dummy[3];
+ int dist_dummy;
+ mul_v3_m4v3(vec, obedit->obmat, eve->co);
+ project_float_noclip(ar, vec, mval);
+ if(snapObjectsContext(C, mval, &dist_dummy, vec, no_dummy, SNAP_NOT_OBEDIT)) {
+ mul_v3_m4v3(eve->co, obedit->imat, vec);
+ }
+ }
+ }
+}
diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c
index 682fbca5072..7595e0d2fe1 100644
--- a/source/blender/editors/mesh/editmesh_loop.c
+++ b/source/blender/editors/mesh/editmesh_loop.c
@@ -69,9 +69,9 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv
#include "mesh_intern.h"
/* **** XXX ******** */
-static void BIF_undo_push(const char *dummy) {}
+static void BIF_undo_push(const char *UNUSED(arg)) {}
static void BIF_undo() {}
-static void error(const char *dummy) {}
+static void error(const char *UNUSED(arg)) {}
static int qtest() {return 0;}
/* **** XXX ******** */
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index f8018c686f5..ab01a773020 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -83,8 +83,8 @@ editmesh_mods.c, UI level access, no geometry changes
#include "BLO_sys_types.h" // for intptr_t support
/* XXX */
-static void waitcursor(int val) {}
-static int pupmenu(const char *dummy) {return 0;}
+static void waitcursor(int UNUSED(val)) {}
+static int pupmenu(const char *UNUSED(arg)) {return 0;}
/* ****************************** MIRROR **************** */
@@ -475,7 +475,7 @@ static float labda_PdistVL2Dfl( float *v1, float *v2, float *v3)
}
/* note; uses v3d, so needs active 3d window */
-static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
+static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index))
{
struct { ViewContext vc; float mval[2]; int dist; EditEdge *closest; } *data = userData;
float v1[2], v2[2];
@@ -544,7 +544,7 @@ EditEdge *findnearestedge(ViewContext *vc, int *dist)
}
}
-static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int index)
+static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
{
struct { short mval[2]; int dist; EditFace *toFace; } *data = userData;
@@ -1252,7 +1252,7 @@ static int select_similar_exec(bContext *C, wmOperator *op)
return similar_face_select_exec(C, op);
}
-static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
Object *obedit= CTX_data_edit_object(C);
EnumPropertyItem *item= NULL;
@@ -2113,7 +2113,7 @@ void MESH_OT_loop_select(wmOperatorType *ot)
/* api callbacks */
ot->invoke= mesh_select_loop_invoke;
- ot->poll= ED_operator_editmesh_region_view3d;
+ ot->poll= ED_operator_editmesh_view3d;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2207,7 +2207,7 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2])
}
-static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
view3d_operator_needs_opengl(C);
@@ -2618,7 +2618,7 @@ static int select_linked_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
linked_limit_default(C, op);
return select_linked_exec(C, op);
@@ -2815,7 +2815,7 @@ void EM_reveal_mesh(EditMesh *em)
// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
-static int reveal_mesh_exec(bContext *C, wmOperator *op)
+static int reveal_mesh_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
@@ -3360,7 +3360,7 @@ void EM_select_swap(EditMesh *em) /* exported for UV */
}
-static int select_inverse_mesh_exec(bContext *C, wmOperator *op)
+static int select_inverse_mesh_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
@@ -3493,7 +3493,7 @@ void EM_select_more(EditMesh *em)
}
}
-static int select_more(bContext *C, wmOperator *op)
+static int select_more(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)) ;
@@ -3584,7 +3584,7 @@ void EM_select_less(EditMesh *em)
}
}
-static int select_less(bContext *C, wmOperator *op)
+static int select_less(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
@@ -4490,7 +4490,7 @@ void flipface(EditMesh *em, EditFace *efa)
}
-static int flip_normals(bContext *C, wmOperator *op)
+static int flip_normals(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index eadf0ca120f..66090f14fff 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -80,7 +80,7 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise
#include "mesh_intern.h"
/* XXX */
-static void waitcursor(int val) {}
+static void waitcursor(int UNUSED(val)) {}
#define add_numbut(a, b, c, d, e, f, g) {}
/* XXX */
@@ -511,7 +511,7 @@ void MESH_OT_remove_doubles(wmOperatorType *ot)
// XXX is this needed?
/* called from buttons */
-static void xsortvert_flag__doSetX(void *userData, EditVert *eve, int x, int y, int index)
+static void xsortvert_flag__doSetX(void *userData, EditVert *UNUSED(eve), int x, int UNUSED(y), int index)
{
xvertsort *sortblock = userData;
@@ -616,7 +616,7 @@ void hashvert_flag(EditMesh *em, int flag)
}
/* generic extern called extruder */
-void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, short type)
+static void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op, short type)
{
float nor[3]= {0.0, 0.0, 0.0};
short transmode= 0;
@@ -664,13 +664,12 @@ void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, sh
}
// XXX should be a menu item
-static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
- extrude_mesh(scene, obedit, em, op, RNA_int_get(op->ptr, "type"));
+ extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type"));
BKE_mesh_end_editmesh(obedit->data, em);
@@ -683,11 +682,10 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* extrude without transform */
static int mesh_extrude_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
- extrude_mesh(scene, obedit, em, op, RNA_int_get(op->ptr, "type"));
+ extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type"));
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -704,7 +702,7 @@ EnumPropertyItem extrude_items[] = {
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
EnumPropertyItem *item= NULL;
Object *obedit= CTX_data_edit_object(C);
@@ -796,7 +794,7 @@ void MESH_OT_extrude(wmOperatorType *ot)
ot->prop= prop;
}
-static int split_mesh(bContext *C, wmOperator *op)
+static int split_mesh(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -1000,7 +998,7 @@ static int spin_mesh_exec(bContext *C, wmOperator *op)
}
/* get center and axis, in global coords */
-static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -1108,7 +1106,7 @@ static int screw_mesh_exec(bContext *C, wmOperator *op)
}
/* get center and axis, in global coords */
-static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -1189,7 +1187,7 @@ static void erase_vertices(EditMesh *em, ListBase *l)
}
}
-void delete_mesh(Object *obedit, EditMesh *em, wmOperator *op, int event)
+static void delete_mesh(EditMesh *em, wmOperator *op, int event)
{
EditFace *efa, *nextvl;
EditVert *eve,*nextve;
@@ -1347,7 +1345,7 @@ static int delete_mesh_exec(bContext *C, wmOperator *op)
if(type==6)
return WM_operator_name_call(C, "MESH_OT_delete_edgeloop", WM_OP_EXEC_DEFAULT, NULL);
- delete_mesh(obedit, em, op, type);
+ delete_mesh(em, op, type);
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4703,7 +4701,7 @@ useless:
}
#endif // END OF XXX
-int EdgeLoopDelete(EditMesh *em, wmOperator *op)
+int EdgeLoopDelete(EditMesh *UNUSED(em), wmOperator *UNUSED(op))
{
#if 0 //XXX won't work with new edgeslide
@@ -5185,7 +5183,7 @@ static int blend_from_shape_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
Object *obedit= CTX_data_edit_object(C);
Mesh *me= (obedit) ? obedit->data : NULL;
@@ -5884,7 +5882,7 @@ static EnumPropertyItem merge_type_items[]= {
{5, "COLLAPSE", 0, "Collapse", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
Object *obedit= CTX_data_edit_object(C);
EnumPropertyItem *item= NULL;
@@ -6144,7 +6142,7 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot)
/********************** Region/Loop Operators *************************/
-static int region_to_loop(bContext *C, wmOperator *op)
+static int region_to_loop(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -6325,7 +6323,7 @@ static int loop_bisect(EditMesh *em, Collection *edgecollection){
else return(2);
}
-static int loop_to_region(bContext *C, wmOperator *op)
+static int loop_to_region(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -7003,7 +7001,7 @@ static void fill_mesh(EditMesh *em)
}
}
- if(BLI_edgefill(0, em->mat_nr)) {
+ if(BLI_edgefill(em->mat_nr)) {
efa= fillfacebase.first;
while(efa) {
/* normals default pointing up */
@@ -7022,7 +7020,7 @@ static void fill_mesh(EditMesh *em)
}
-static int fill_mesh_exec(bContext *C, wmOperator *op)
+static int fill_mesh_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -7053,7 +7051,7 @@ void MESH_OT_fill(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int beautify_fill_exec(bContext *C, wmOperator *op)
+static int beautify_fill_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -7263,7 +7261,7 @@ void MESH_OT_sort_faces(wmOperatorType *ot)
/********************** Quad/Tri Operators *************************/
-static int quads_convert_to_tris_exec(bContext *C, wmOperator *op)
+static int quads_convert_to_tris_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -7292,7 +7290,7 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int tris_convert_to_quads_exec(bContext *C, wmOperator *op)
+static int tris_convert_to_quads_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -7321,7 +7319,7 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int edge_flip_exec(bContext *C, wmOperator *op)
+static int edge_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -7366,7 +7364,7 @@ static void mesh_set_smooth_faces(EditMesh *em, short smooth)
}
}
-static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op)
+static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -7396,7 +7394,7 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *op)
+static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c
index 7f1a7d0e1fc..ac65a3c21d3 100644
--- a/source/blender/editors/mesh/loopcut.c
+++ b/source/blender/editors/mesh/loopcut.c
@@ -94,7 +94,7 @@ typedef struct tringselOpData {
} tringselOpData;
/* modal loop selection drawing callback */
-static void ringsel_draw(const bContext *C, ARegion *ar, void *arg)
+static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
{
int i;
tringselOpData *lcd = arg;
@@ -248,7 +248,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
lcd->totedge = tot;
}
-static void ringsel_find_edge(tringselOpData *lcd, const bContext *C, ARegion *ar, int cuts)
+static void ringsel_find_edge(tringselOpData *lcd, int cuts)
{
if (lcd->eed) {
edgering_sel(lcd, cuts, 0);
@@ -293,7 +293,7 @@ static void ringsel_finish(bContext *C, wmOperator *op)
}
/* called when modal loop selection is done... */
-static void ringsel_exit (bContext *C, wmOperator *op)
+static void ringsel_exit(wmOperator *op)
{
tringselOpData *lcd= op->customdata;
@@ -332,10 +332,10 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut)
return 1;
}
-static int ringcut_cancel (bContext *C, wmOperator *op)
+static int ringcut_cancel (bContext *UNUSED(C), wmOperator *op)
{
/* this is just a wrapper around exit() */
- ringsel_exit(C, op);
+ ringsel_exit(op);
return OPERATOR_CANCELLED;
}
@@ -353,7 +353,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt)
lcd = op->customdata;
if (lcd->em->selectmode == SCE_SELECT_FACE) {
- ringsel_exit(C, op);
+ ringsel_exit(op);
WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, NULL);
return OPERATOR_CANCELLED;
}
@@ -363,15 +363,15 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt)
edge = findnearestedge(&lcd->vc, &dist);
if(!edge) {
- ringsel_exit(C, op);
+ ringsel_exit(op);
return OPERATOR_CANCELLED;
}
lcd->eed = edge;
- ringsel_find_edge(lcd, C, lcd->ar, 1);
+ ringsel_find_edge(lcd, 1);
ringsel_finish(C, op);
- ringsel_exit(C, op);
+ ringsel_exit(op);
return OPERATOR_FINISHED;
}
@@ -397,7 +397,7 @@ static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt)
edge = findnearestedge(&lcd->vc, &dist);
if (edge != lcd->eed) {
lcd->eed = edge;
- ringsel_find_edge(lcd, C, lcd->ar, 1);
+ ringsel_find_edge(lcd, 1);
}
return OPERATOR_RUNNING_MODAL;
@@ -418,7 +418,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event)
ED_region_tag_redraw(lcd->ar);
ringsel_finish(C, op);
- ringsel_exit(C, op);
+ ringsel_exit(op);
return OPERATOR_FINISHED;
}
@@ -441,7 +441,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event)
if (event->val == KM_PRESS) {
cuts++;
RNA_int_set(op->ptr, "number_cuts",cuts);
- ringsel_find_edge(lcd, C, lcd->ar, cuts);
+ ringsel_find_edge(lcd, cuts);
ED_region_tag_redraw(lcd->ar);
}
@@ -451,7 +451,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event)
if (event->val == KM_PRESS) {
cuts=MAX2(cuts-1,1);
RNA_int_set(op->ptr,"number_cuts",cuts);
- ringsel_find_edge(lcd, C, lcd->ar,cuts);
+ ringsel_find_edge(lcd, cuts);
ED_region_tag_redraw(lcd->ar);
}
@@ -466,7 +466,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event)
if (edge != lcd->eed) {
lcd->eed = edge;
- ringsel_find_edge(lcd, C, lcd->ar, cuts);
+ ringsel_find_edge(lcd, cuts);
}
ED_region_tag_redraw(lcd->ar);
@@ -506,7 +506,7 @@ void MESH_OT_loopcut (wmOperatorType *ot)
ot->invoke= ringcut_invoke;
ot->modal= ringcut_modal;
ot->cancel= ringcut_cancel;
- ot->poll= ED_operator_editmesh_region_view3d;
+ ot->poll= ED_operator_editmesh_view3d;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 14934bf8127..39489dc7264 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -159,7 +159,7 @@ void ED_mesh_delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *l
}
}
-int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set)
+int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set)
{
EditMesh *em;
int layernum;
@@ -288,13 +288,12 @@ int ED_mesh_layers_poll(bContext *C)
return (ob && !ob->id.lib && ob->type==OB_MESH && data && !data->lib);
}
-static int uv_texture_add_exec(bContext *C, wmOperator *op)
+static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Mesh *me= ob->data;
- if(!ED_mesh_uv_texture_add(C, scene, ob, me, NULL, TRUE))
+ if(!ED_mesh_uv_texture_add(C, me, NULL, TRUE))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -336,8 +335,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
char path[FILE_MAX];
RNA_string_get(op->ptr, "filepath", path);
- ima= BKE_add_image_file(path,
- scene ? scene->r.cfra : 1);
+ ima= BKE_add_image_file(path);
}
else {
RNA_string_get(op->ptr, "name", name);
@@ -394,7 +392,7 @@ void MESH_OT_drop_named_image(wmOperatorType *ot)
RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file");
}
-static int uv_texture_remove_exec(bContext *C, wmOperator *op)
+static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Mesh *me= ob->data;
@@ -453,7 +451,7 @@ static int vertex_color_multires_toggle(Object *ob)
return 1;
}
-static int vertex_color_add_exec(bContext *C, wmOperator *op)
+static int vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -484,7 +482,7 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int vertex_color_remove_exec(bContext *C, wmOperator *op)
+static int vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Mesh *me= ob->data;
@@ -535,7 +533,7 @@ void MESH_OT_vertex_color_multiresolution_toggle(wmOperatorType *ot)
/*********************** sticky operators ************************/
-static int sticky_add_exec(bContext *C, wmOperator *op)
+static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
View3D *v3d= CTX_wm_view3d(C);
@@ -568,7 +566,7 @@ void MESH_OT_sticky_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int sticky_remove_exec(bContext *C, wmOperator *op)
+static int sticky_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Mesh *me= ob->data;
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 71baffca31d..5eb6fea362f 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -252,7 +252,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
/* selection mode */
- WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_selection_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
/* hide */
WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);
@@ -263,7 +263,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1);
- WM_keymap_add_item(keymap, "view3d.edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */
WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_individual_move", EKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0);
@@ -293,7 +293,8 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
/* use KM_CLICK because same key is used for tweaks */
WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
-
+ RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT|KM_CTRL, 0)->ptr, "rotate_source", 0);
+
WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index e8c787b168f..d8b34311e76 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -84,7 +84,7 @@
/* join selected meshes into the active mesh, context sensitive
return 0 if no join is made (error) and 1 of the join is done */
-int join_mesh_exec(bContext *C, wmOperator *op)
+int join_mesh_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -1104,14 +1104,14 @@ static EditVert *editmesh_get_x_mirror_vert_topo(Object *ob, struct EditMesh *em
if(poinval != -1)
return (EditVert *)(poinval);
return NULL;
-}
+}
EditVert *editmesh_get_x_mirror_vert(Object *ob, struct EditMesh *em, EditVert *eve, float *co, int index)
{
if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) {
return editmesh_get_x_mirror_vert_topo(ob, em, eve, index);
} else {
- return editmesh_get_x_mirror_vert_spacial(ob, em, eve->co);
+ return editmesh_get_x_mirror_vert_spacial(ob, em, co);
}
}
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 80cea4eea1c..ec727d7d82b 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -84,12 +84,12 @@ void make_editMball(Object *obedit)
/* This function is called, when MetaBall Object switched from
* edit mode to object mode. List od MetaElements is copied
* from object->data->edit_elems to object->data->elems. */
-void load_editMball(Object *obedit)
+void load_editMball(Object *UNUSED(obedit))
{
}
/* Add metaelem primitive to metaball object (which is in edit mode) */
-MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int newname)
+MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNUSED(newname))
{
Object *obedit= CTX_data_edit_object(C);
MetaBall *mball = (MetaBall*)obedit->data;
@@ -177,7 +177,7 @@ void MBALL_OT_select_all(wmOperatorType *ot)
/***************************** Select inverse operator *****************************/
/* Invert metaball selection */
-static int select_inverse_metaelems_exec(bContext *C, wmOperator *op)
+static int select_inverse_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
MetaBall *mb = (MetaBall*)obedit->data;
@@ -266,7 +266,7 @@ void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot)
/***************************** Duplicate operator *****************************/
/* Duplicate selected MetaElements */
-static int duplicate_metaelems_exec(bContext *C, wmOperator *op)
+static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
MetaBall *mb = (MetaBall*)obedit->data;
@@ -290,7 +290,7 @@ static int duplicate_metaelems_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
int retv= duplicate_metaelems_exec(C, op);
@@ -325,7 +325,7 @@ void MBALL_OT_duplicate_metaelems(wmOperatorType *ot)
/***************************** Delete operator *****************************/
/* Delete all selected MetaElems (not MetaBall) */
-static int delete_metaelems_exec(bContext *C, wmOperator *op)
+static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
MetaBall *mb= (MetaBall*)obedit->data;
@@ -420,7 +420,7 @@ void MBALL_OT_hide_metaelems(wmOperatorType *ot)
/***************************** Unhide operator *****************************/
/* Unhide all edited MetaElems */
-static int reveal_metaelems_exec(bContext *C, wmOperator *op)
+static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
MetaBall *mb= (MetaBall*)obedit->data;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index e0608f03274..56af4ce1b1c 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -161,11 +161,6 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, fl
/********************* Add Object Operator ********************/
-void add_object_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */
-{
- /* keep here to get things compile, remove later */
-}
-
void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
{
PropertyRNA *prop;
@@ -218,7 +213,7 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op)
}
}
-int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *event)
+int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
object_add_generic_invoke_options(C, op);
return op->type->exec(C, op);
@@ -363,11 +358,6 @@ static EnumPropertyItem field_type_items[] = {
{PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", ""},
{0, NULL, 0, NULL, NULL}};
-void add_effector_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */
-{
- /* keep here to get things compile, remove later */
-}
-
/* for effector add primitive operators */
static Object *effector_add_type(bContext *C, wmOperator *op, int type)
{
@@ -537,7 +527,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Object *obedit= CTX_data_edit_object(C);
uiPopupMenu *pup;
@@ -805,7 +795,7 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base)
MEM_freeN(base);
}
-static int object_delete_exec(bContext *C, wmOperator *op)
+static int object_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -817,6 +807,10 @@ static int object_delete_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
if(base->object->type==OB_LAMP) islamp= 1;
+
+ /* deselect object -- it could be used in other scenes */
+ base->object->flag &= ~SELECT;
+
/* remove from current scene only */
ED_base_object_free_and_unlink(bmain, scene, base);
}
@@ -851,7 +845,7 @@ void OBJECT_OT_delete(wmOperatorType *ot)
/**************************** Copy Utilities ******************************/
-static void copy_object__forwardModifierLinks(void *userData, Object *ob,
+static void copy_object__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob),
ID **idpoin)
{
/* this is copied from ID_NEW; it might be better to have a macro */
@@ -1001,7 +995,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base)
base->object->transflag &= ~OB_DUPLI;
}
-static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
+static int object_duplicates_make_real_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -1010,6 +1004,9 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
make_object_duplilist_real(C, scene, base);
+
+ /* dependencies were changed */
+ WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, base->object);
}
CTX_DATA_END;
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index f81e73faf73..0c28d4a608b 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -69,7 +69,7 @@
/* ****************** render BAKING ********************** */
/* threaded break test */
-static int thread_break(void *unused)
+static int thread_break(void *UNUSED(arg))
{
return G.afbreek;
}
@@ -241,7 +241,7 @@ static void bake_freejob(void *bkv)
}
/* catch esc */
-static int objects_bake_render_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running blender, remove handler and pass through */
if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
@@ -256,7 +256,7 @@ static int objects_bake_render_modal(bContext *C, wmOperator *op, wmEvent *event
return OPERATOR_PASS_THROUGH;
}
-static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_event)
+static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(_event))
{
Scene *scene= CTX_data_scene(C);
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index f5d87df10a1..02c88d4149b 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -65,6 +65,7 @@
#include "RNA_enum_types.h"
#include "ED_object.h"
+#include "ED_armature.h"
#include "ED_screen.h"
#include "UI_interface.h"
@@ -510,7 +511,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op)
return 0;
}
-static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Object *ob, int type)
+static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type)
{
char constraint_name[32];
int owner = RNA_enum_get(op->ptr, "owner");
@@ -546,7 +547,7 @@ static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Ob
static int stretchto_reset_exec (bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_STRETCHTO);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO);
bStretchToConstraint *data= (con) ? (bStretchToConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
@@ -561,7 +562,7 @@ static int stretchto_reset_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_constraint_invoke_properties(C, op))
return stretchto_reset_exec(C, op);
@@ -589,7 +590,7 @@ void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot)
static int limitdistance_reset_exec (bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_DISTLIMIT);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT);
bDistLimitConstraint *data= (con) ? (bDistLimitConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
@@ -604,7 +605,7 @@ static int limitdistance_reset_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_constraint_invoke_properties(C, op))
return limitdistance_reset_exec(C, op);
@@ -635,7 +636,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
bPoseChannel *pchan= NULL;
@@ -691,7 +692,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_constraint_invoke_properties(C, op))
return childof_set_inverse_exec(C, op);
@@ -719,7 +720,7 @@ void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot)
static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
/* simply clear the matrix */
@@ -730,7 +731,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_constraint_invoke_properties(C, op))
return childof_clear_inverse_exec(C, op);
@@ -793,7 +794,7 @@ static int constraint_poll(bContext *C)
return (ptr.id.data && ptr.data);
}
-static int constraint_delete_exec (bContext *C, wmOperator *op)
+static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
Object *ob= ptr.id.data;
@@ -836,7 +837,7 @@ void CONSTRAINT_OT_delete (wmOperatorType *ot)
static int constraint_move_down_exec (bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(C, op, ob, 0);
+ bConstraint *con = edit_constraint_property_get(op, ob, 0);
if (con && con->next) {
ListBase *conlist= get_constraint_lb(ob, con, NULL);
@@ -854,7 +855,7 @@ static int constraint_move_down_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_constraint_invoke_properties(C, op))
return constraint_move_down_exec(C, op);
@@ -884,7 +885,7 @@ void CONSTRAINT_OT_move_down (wmOperatorType *ot)
static int constraint_move_up_exec (bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(C, op, ob, 0);
+ bConstraint *con = edit_constraint_property_get(op, ob, 0);
if (con && con->prev) {
ListBase *conlist= get_constraint_lb(ob, con, NULL);
@@ -902,7 +903,7 @@ static int constraint_move_up_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_constraint_invoke_properties(C, op))
return constraint_move_up_exec(C, op);
@@ -931,11 +932,11 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot)
/************************ remove constraint operators *********************/
-static int pose_constraints_clear_exec(bContext *C, wmOperator *op)
+static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
/* free constraints for all selected bones */
CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
@@ -968,7 +969,7 @@ void POSE_OT_constraints_clear(wmOperatorType *ot)
}
-static int object_constraints_clear_exec(bContext *C, wmOperator *op)
+static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -1046,7 +1047,7 @@ void POSE_OT_constraints_copy(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int object_constraint_copy_exec(bContext *C, wmOperator *op)
+static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -1364,7 +1365,7 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op)
/* dummy operator callback */
static int pose_constraint_add_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_active_context(C);
+ Object *ob= ED_object_pose_armature(ED_object_active_context(C));
int type= RNA_enum_get(op->ptr, "type");
short with_targets= 0;
@@ -1465,9 +1466,9 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
// TODO: should these be here, or back in editors/armature/poseobject.c again?
/* present menu with options + validation for targets to use */
-static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
bPoseChannel *pchan= get_active_posechannel(ob);
bConstraint *con= NULL;
@@ -1549,9 +1550,9 @@ void POSE_OT_ik_add(wmOperatorType *ot)
/* ------------------ */
/* remove IK constraints from selected bones */
-static int pose_ik_clear_exec(bContext *C, wmOperator *op)
+static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
/* only remove IK Constraints */
CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index b7f05a2e332..32e49ce3f71 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -97,9 +97,9 @@
#include "object_intern.h" // own include
/* ************* XXX **************** */
-static void error(const char *dummy) {}
-static void waitcursor(int val) {}
-static int pupmenu(const char *msg) {return 0;}
+static void error(const char *UNUSED(arg)) {}
+static void waitcursor(int UNUSED(val)) {}
+static int pupmenu(const char *UNUSED(msg)) {return 0;}
/* port over here */
static bContext *C;
@@ -120,7 +120,7 @@ Object *ED_object_active_context(bContext *C)
/* ********* clear/set restrict view *********/
-static int object_hide_view_clear_exec(bContext *C, wmOperator *op)
+static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
ScrArea *sa= CTX_wm_area(C);
@@ -219,7 +219,7 @@ void OBJECT_OT_hide_view_set(wmOperatorType *ot)
}
/* 99% same as above except no need for scene refreshing (TODO, update render preview) */
-static int object_hide_render_clear_exec(bContext *C, wmOperator *op)
+static int object_hide_render_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
short changed= 0;
@@ -433,7 +433,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
if(ob->type==OB_MESH) {
Mesh *me= ob->data;
- if(me->pv) mesh_pmv_off(ob, me);
+ if(me->pv) mesh_pmv_off(me);
ok= 1;
scene->obedit= ob; // context sees this
@@ -506,7 +506,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
if(flag & EM_WAITCURSOR) waitcursor(0);
}
-static int editmode_toggle_exec(bContext *C, wmOperator *op)
+static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
if(!CTX_data_edit_object(C))
ED_object_enter_editmode(C, EM_WAITCURSOR);
@@ -549,7 +549,7 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot)
/* *************************** */
-static int posemode_exec(bContext *C, wmOperator *op)
+static int posemode_exec(bContext *C, wmOperator *UNUSED(op))
{
Base *base= CTX_data_active_base(C);
@@ -1525,7 +1525,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene)
/* For the object with pose/action: create path curves for selected bones
* This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
*/
-static int object_calculate_paths_exec (bContext *C, wmOperator *op)
+static int object_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
@@ -1565,7 +1565,7 @@ void OBJECT_OT_paths_calculate (wmOperatorType *ot)
/* --------- */
/* for the object with pose/action: clear path curves for selected bones only */
-void ED_objects_clear_paths(bContext *C, Scene *scene)
+void ED_objects_clear_paths(bContext *C)
{
/* loop over objects in scene */
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
@@ -1580,12 +1580,10 @@ void ED_objects_clear_paths(bContext *C, Scene *scene)
}
/* operator callback for this */
-static int object_clear_paths_exec (bContext *C, wmOperator *op)
-{
- Scene *scene= CTX_data_scene(C);
-
+static int object_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
+{
/* use the backend function for this */
- ED_objects_clear_paths(C, scene);
+ ED_objects_clear_paths(C);
/* notifiers for updates */
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
@@ -1838,7 +1836,7 @@ void rand_timeoffs(Scene *scene, View3D *v3d)
}
-static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
EnumPropertyItem *input = object_mode_items;
EnumPropertyItem *item= NULL;
@@ -1890,7 +1888,7 @@ static const char *object_mode_op_string(int mode)
/* checks the mode to be set is compatible with the object
* should be made into a generic function */
-static int object_mode_set_compat(bContext *C, wmOperator *op, Object *ob)
+static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *ob)
{
ObjectMode mode = RNA_enum_get(op->ptr, "mode");
@@ -1999,7 +1997,7 @@ void ED_object_toggle_modes(bContext *C, int mode)
/************************ Game Properties ***********************/
-static int game_property_new(bContext *C, wmOperator *op)
+static int game_property_new(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_active_object(C);
bProperty *prop;
@@ -2082,7 +2080,7 @@ static EnumPropertyItem game_properties_copy_operations[] ={
static EnumPropertyItem gameprops_items[]= {
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
Object *ob= ED_object_active_context(C);
EnumPropertyItem tmp = {0, "", 0, "", ""};
@@ -2164,7 +2162,7 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot)
ot->prop=prop;
}
-static int game_property_clear_exec(bContext *C, wmOperator *op)
+static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
free_properties(&ob_iter->prop);
@@ -2190,7 +2188,7 @@ void OBJECT_OT_game_property_clear(wmOperatorType *ot)
/************************ Copy Logic Bricks ***********************/
-static int logicbricks_copy_exec(bContext *C, wmOperator *op)
+static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob=ED_object_active_context(C);
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index f000485466f..99e27d8a286 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -149,7 +149,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int group_objects_remove_exec(bContext *C, wmOperator *op)
+static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -224,7 +224,7 @@ void GROUP_OT_create(wmOperatorType *ot)
/****************** properties window operators *********************/
-static int group_add_exec(bContext *C, wmOperator *op)
+static int group_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -293,7 +293,7 @@ void OBJECT_OT_group_link(wmOperatorType *ot)
ot->prop= prop;
}
-static int group_remove_exec(bContext *C, wmOperator *op)
+static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 75e22d5356f..3c3e7f1df76 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -504,7 +504,7 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int object_add_hook_newob_exec(bContext *C, wmOperator *op)
+static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -557,7 +557,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
Object *ob = CTX_data_edit_object(C);
EnumPropertyItem tmp = {0, "", 0, "", ""};
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 9f82a1209cf..708aa38d3ea 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -259,7 +259,7 @@ int make_regular_poll(bContext *C)
return (ob && ob->type==OB_LATTICE);
}
-int make_regular_exec(bContext *C, wmOperator *op)
+int make_regular_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_edit_object(C);
Lattice *lt;
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 517040d47b7..0eb2d89061a 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -250,7 +250,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *
return 1;
}
-int ED_object_modifier_convert(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md)
+int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *scene, Object *ob, ModifierData *md)
{
Object *obn;
ParticleSystem *psys;
@@ -365,7 +365,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes");
return 0;
}
- mesh_pmv_off(ob, me);
+ mesh_pmv_off(me);
dm = mesh_create_derived_for_modifier(scene, ob, md);
if (!dm) {
@@ -413,7 +413,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
return 0;
}
- mesh_pmv_off(ob, me);
+ mesh_pmv_off(me);
/* Multires: ensure that recent sculpting is applied */
if(md->type == eModifierType_Multires)
@@ -511,7 +511,7 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
return 1;
}
-int ED_object_modifier_copy(ReportList *reports, Object *ob, ModifierData *md)
+int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierData *md)
{
ModifierData *nmd;
@@ -540,7 +540,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
Object *ob= ED_object_active_context(C);
EnumPropertyItem *item= NULL, *md_item;
@@ -636,7 +636,7 @@ static int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
return 0;
}
-static ModifierData *edit_modifier_property_get(bContext *C, wmOperator *op, Object *ob, int type)
+static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
{
char modifier_name[32];
ModifierData *md;
@@ -657,7 +657,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- ModifierData *md = edit_modifier_property_get(C, op, ob, 0);
+ ModifierData *md = edit_modifier_property_get(op, ob, 0);
if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
return OPERATOR_CANCELLED;
@@ -667,7 +667,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return modifier_remove_exec(C, op);
@@ -695,7 +695,7 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot)
static int modifier_move_up_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- ModifierData *md = edit_modifier_property_get(C, op, ob, 0);
+ ModifierData *md = edit_modifier_property_get(op, ob, 0);
if(!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md))
return OPERATOR_CANCELLED;
@@ -706,7 +706,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return modifier_move_up_exec(C, op);
@@ -734,7 +734,7 @@ void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
static int modifier_move_down_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- ModifierData *md = edit_modifier_property_get(C, op, ob, 0);
+ ModifierData *md = edit_modifier_property_get(op, ob, 0);
if(!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md))
return OPERATOR_CANCELLED;
@@ -745,7 +745,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return modifier_move_down_exec(C, op);
@@ -774,7 +774,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- ModifierData *md = edit_modifier_property_get(C, op, ob, 0);
+ ModifierData *md = edit_modifier_property_get(op, ob, 0);
int apply_as= RNA_enum_get(op->ptr, "apply_as");
if(!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
@@ -787,7 +787,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return modifier_apply_exec(C, op);
@@ -824,7 +824,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- ModifierData *md = edit_modifier_property_get(C, op, ob, 0);
+ ModifierData *md = edit_modifier_property_get(op, ob, 0);
if(!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md))
return OPERATOR_CANCELLED;
@@ -835,7 +835,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return modifier_convert_exec(C, op);
@@ -863,7 +863,7 @@ void OBJECT_OT_modifier_convert(wmOperatorType *ot)
static int modifier_copy_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- ModifierData *md = edit_modifier_property_get(C, op, ob, 0);
+ ModifierData *md = edit_modifier_property_get(op, ob, 0);
if(!ob || !md || !ED_object_modifier_copy(op->reports, ob, md))
return OPERATOR_CANCELLED;
@@ -874,7 +874,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return modifier_copy_exec(C, op);
@@ -907,7 +907,7 @@ static int multires_poll(bContext *C)
static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires);
+ MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
@@ -919,7 +919,7 @@ static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return multires_higher_levels_delete_exec(C, op);
@@ -946,7 +946,7 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot)
static int multires_subdivide_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires);
+ MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
@@ -959,7 +959,7 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return multires_subdivide_exec(C, op);
@@ -988,7 +988,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
{
Object *ob= ED_object_active_context(C), *secondob= NULL;
Scene *scene= CTX_data_scene(C);
- MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires);
+ MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
@@ -1017,7 +1017,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return multires_reshape_exec(C, op);
@@ -1058,7 +1058,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
if(relative)
- BLI_path_rel(path, G.sce);
+ BLI_path_rel(path, G.main->name);
CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path);
CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0);
@@ -1066,7 +1066,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Object *ob = ED_object_active_context(C);
MultiresModifierData *mmd;
@@ -1076,7 +1076,7 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *e
if (!edit_modifier_invoke_properties(C, op))
return OPERATOR_CANCELLED;
- mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires);
+ mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
@@ -1120,7 +1120,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
/****************** multires pack operator *********************/
-static int multires_external_pack_exec(bContext *C, wmOperator *op)
+static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_object_active_context(C);
Mesh *me= ob->data;
@@ -1151,7 +1151,7 @@ void OBJECT_OT_multires_external_pack(wmOperatorType *ot)
static int multires_base_apply_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires);
+ MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
@@ -1164,7 +1164,7 @@ static int multires_base_apply_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int multires_base_apply_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int multires_base_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return multires_base_apply_exec(C, op);
@@ -1199,7 +1199,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_MeshDeform);
+ MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(op, ob, eModifierType_MeshDeform);
if (!mmd)
return OPERATOR_CANCELLED;
@@ -1251,7 +1251,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return meshdeform_bind_exec(C, op);
@@ -1286,7 +1286,7 @@ static int explode_poll(bContext *C)
static int explode_refresh_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- ExplodeModifierData *emd = (ExplodeModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Explode);
+ ExplodeModifierData *emd = (ExplodeModifierData *)edit_modifier_property_get(op, ob, eModifierType_Explode);
if (!emd)
return OPERATOR_CANCELLED;
@@ -1299,7 +1299,7 @@ static int explode_refresh_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_modifier_invoke_properties(C, op))
return explode_refresh_exec(C, op);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 692b7302cc5..d09cc9a7626 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -379,7 +379,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
ED_object_generic_keymap(keyconf, keymap, 2);
}
-void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet)
+void ED_object_generic_keymap(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap, int do_pet)
{
wmKeyMapItem *kmi;
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 11175958fba..14f88c6d99e 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -353,7 +353,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
}
/* Generic itemf's for operators that take library args */
-static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
EnumPropertyItem *item= NULL, item_tmp;
int totitem= 0;
@@ -641,11 +641,11 @@ static int parent_set_exec(bContext *C, wmOperator *op)
}
else if(pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) {
if(partype == PAR_ARMATURE_NAME)
- create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_NAME, 0);
+ create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_NAME, 0);
else if(partype == PAR_ARMATURE_ENVELOPE)
- create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_ENVELOPE, 0);
+ create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_ENVELOPE, 0);
else if(partype == PAR_ARMATURE_AUTO)
- create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_AUTO, 0);
+ create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_AUTO, 0);
/* get corrected inverse */
ob->partype= PAROBJECT;
@@ -672,7 +672,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
Object *ob= CTX_data_active_object(C);
uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", 0);
@@ -779,7 +779,7 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
/************************ Clear Slow Parent Operator *********************/
-static int object_slow_parent_clear_exec(bContext *C, wmOperator *op)
+static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -821,7 +821,7 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot)
/********************** Make Slow Parent Operator *********************/
-static int object_slow_parent_set_exec(bContext *C, wmOperator *op)
+static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -1140,7 +1140,7 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot)
/************************** Link to Scene Operator *****************************/
-void link_to_scene(Main *bmain, unsigned short nr)
+void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
{
#if 0
Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1);
@@ -1344,7 +1344,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
/**************************** Make Single User ********************************/
-static void single_object_users__forwardModifierLinks(void *userData, Object *ob, Object **obpoin)
+static void single_object_users__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob), Object **obpoin)
{
ID_NEW(*obpoin);
}
@@ -1538,7 +1538,7 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag)
}
}
-void single_ipo_users(Scene *scene, int flag)
+void single_ipo_users(Scene *UNUSED(scene), int UNUSED(flag))
{
#if 0 // XXX old animation system
Object *ob;
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 818bb50a1fb..a3c65851d3a 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -660,7 +660,7 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op)
void OBJECT_OT_select_by_layer(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "select by layer";
+ ot->name= "Select by Layer";
ot->description = "Select all visible objects on a layer";
ot->idname= "OBJECT_OT_select_by_layer";
@@ -679,7 +679,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot)
/************************** Select Inverse *************************/
-static int object_select_inverse_exec(bContext *C, wmOperator *op)
+static int object_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
if (base->flag & SELECT)
@@ -809,7 +809,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "select same group";
+ ot->name= "Select Same Group";
ot->description = "Select object in the same group";
ot->idname= "OBJECT_OT_select_same_group";
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 7b1ab933e28..0aefb09ee9e 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -53,6 +53,7 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_object.h"
+#include "BKE_curve.h"
#include "BLO_sys_types.h" // for intptr_t support
@@ -100,8 +101,25 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
BLI_remlink(&key->block, kb);
key->totkey--;
- if(key->refkey== kb)
+ if(key->refkey== kb) {
key->refkey= key->block.first;
+
+ if(key->refkey) {
+ /* apply new basis key on original data */
+ switch(ob->type) {
+ case OB_MESH:
+ key_to_mesh(key->refkey, ob->data);
+ break;
+ case OB_CURVE:
+ case OB_SURF:
+ key_to_curve(key->refkey, ob->data, BKE_curve_nurbs(ob->data));
+ break;
+ case OB_LATTICE:
+ key_to_latt(key->refkey, ob->data);
+ break;
+ }
+ }
+ }
if(kb->data) MEM_freeN(kb->data);
MEM_freeN(kb);
@@ -143,7 +161,7 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
return 1;
}
-static int ED_object_shape_key_mirror(bContext *C, Scene *scene, Object *ob)
+static int object_shape_key_mirror(bContext *C, Object *ob)
{
KeyBlock *kb;
Key *key;
@@ -249,7 +267,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "from_mix", 1, "From Mix", "Create the new shape key from the existing mix of keys.");
}
-static int shape_key_remove_exec(bContext *C, wmOperator *op)
+static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -274,7 +292,7 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int shape_key_clear_exec(bContext *C, wmOperator *op)
+static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Key *key= ob_get_key(ob);
@@ -307,12 +325,11 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int shape_key_mirror_exec(bContext *C, wmOperator *op)
+static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- if(!ED_object_shape_key_mirror(C, scene, ob))
+ if(!object_shape_key_mirror(C, ob))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index d4644847a5c..66c5ab4ec4b 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -64,7 +64,7 @@
/*************************** Clear Transformation ****************************/
-static int object_location_clear_exec(bContext *C, wmOperator *op)
+static int object_location_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -125,7 +125,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int object_rotation_clear_exec(bContext *C, wmOperator *op)
+static int object_rotation_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -270,7 +270,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int object_scale_clear_exec(bContext *C, wmOperator *op)
+static int object_scale_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -336,7 +336,7 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int object_origin_clear_exec(bContext *C, wmOperator *op)
+static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
float *v1, *v3, mat[3][3];
@@ -457,8 +457,18 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
object_to_mat3(ob, rsmat);
else if(apply_scale)
object_scale_to_mat3(ob, rsmat);
- else if(apply_rot)
+ else if(apply_rot) {
+ float tmat[3][3], timat[3][3];
+
+ /* simple rotation matrix */
object_rot_to_mat3(ob, rsmat);
+
+ /* correct for scale, note mul_m3_m3m3 has swapped args! */
+ object_scale_to_mat3(ob, tmat);
+ invert_m3_m3(timat, tmat);
+ mul_m3_m3m3(rsmat, timat, rsmat);
+ mul_m3_m3m3(rsmat, rsmat, tmat);
+ }
else
unit_m3(rsmat);
@@ -557,7 +567,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
return OPERATOR_FINISHED;
}
-static int visual_transform_apply_exec(bContext *C, wmOperator *op)
+static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
int change = 0;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 76af8feda82..015fab05828 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1438,7 +1438,7 @@ static int vertex_group_poll_edit(bContext *C)
return vgroup_object_in_edit_mode(ob);
}
-static int vertex_group_add_exec(bContext *C, wmOperator *op)
+static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -1561,7 +1561,7 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups.");
}
-static int vertex_group_select_exec(bContext *C, wmOperator *op)
+static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_edit_object(C);
@@ -1588,7 +1588,7 @@ void OBJECT_OT_vertex_group_select(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int vertex_group_deselect_exec(bContext *C, wmOperator *op)
+static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_edit_object(C);
@@ -1612,7 +1612,7 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int vertex_group_copy_exec(bContext *C, wmOperator *op)
+static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -1671,7 +1671,7 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot)
RNA_def_float(ot->srna, "gain", 1.f, 0.f, FLT_MAX, "Gain", "Value to multiply weights by.", 0.0f, 10.f);
}
-static int vertex_group_normalize_exec(bContext *C, wmOperator *op)
+static int vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -1760,7 +1760,7 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot)
}
-static int vertex_group_blend_exec(bContext *C, wmOperator *op)
+static int vertex_group_blend_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -1860,7 +1860,7 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
}
-static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *op)
+static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -1901,7 +1901,7 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
+static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obact= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -1947,7 +1947,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
EnumPropertyItem tmp = {0, "", 0, "", ""};
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index a18890881a8..0ba76bbe34c 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -98,7 +98,7 @@ void BOID_OT_rule_add(wmOperatorType *ot)
ot->prop= RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", "");
}
-static int rule_del_exec(bContext *C, wmOperator *op)
+static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -149,7 +149,7 @@ void BOID_OT_rule_del(wmOperatorType *ot)
}
/************************ move up/down boid rule operators *********************/
-static int rule_move_up_exec(bContext *C, wmOperator *op)
+static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
@@ -187,7 +187,7 @@ void BOID_OT_rule_move_up(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int rule_move_down_exec(bContext *C, wmOperator *op)
+static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
@@ -227,7 +227,7 @@ void BOID_OT_rule_move_down(wmOperatorType *ot)
/************************ add/del boid state operators *********************/
-static int state_add_exec(bContext *C, wmOperator *op)
+static int state_add_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
@@ -266,7 +266,7 @@ void BOID_OT_state_add(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int state_del_exec(bContext *C, wmOperator *op)
+static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -322,7 +322,7 @@ void BOID_OT_state_del(wmOperatorType *ot)
}
/************************ move up/down boid state operators *********************/
-static int state_move_up_exec(bContext *C, wmOperator *op)
+static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
@@ -359,7 +359,7 @@ void BOID_OT_state_move_up(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int state_move_down_exec(bContext *C, wmOperator *op)
+static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 132533fc123..57867fdc441 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1125,7 +1125,7 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit)
}
}
}
-static void update_velocities(Object *ob, PTCacheEdit *edit)
+static void update_velocities(PTCacheEdit *edit)
{
/*TODO: get frs_sec properly */
float vec1[3], vec2[3], frs_sec, dfra;
@@ -1208,7 +1208,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag)
if(edit->psys)
update_world_cos(ob, edit);
if(pset->flag & PE_AUTO_VELOCITY)
- update_velocities(ob, edit);
+ update_velocities(edit);
PE_hide_keys_time(scene, edit, CFRA);
/* regenerate path caches */
@@ -1243,7 +1243,7 @@ static void select_key(PEData *data, int point_index, int key_index)
point->flag |= PEP_EDIT_RECALC;
}
-static void select_keys(PEData *data, int point_index, int key_index)
+static void select_keys(PEData *data, int point_index, int UNUSED(key_index))
{
PTCacheEdit *edit = data->edit;
PTCacheEditPoint *point = edit->points + point_index;
@@ -1387,7 +1387,7 @@ static void select_root(PEData *data, int point_index)
data->edit->points[point_index].flag |= PEP_EDIT_RECALC; /* redraw selection only */
}
-static int select_roots_exec(bContext *C, wmOperator *op)
+static int select_roots_exec(bContext *C, wmOperator *UNUSED(op))
{
PEData data;
@@ -1427,7 +1427,7 @@ static void select_tip(PEData *data, int point_index)
point->flag |= PEP_EDIT_RECALC; /* redraw selection only */
}
-static int select_tips_exec(bContext *C, wmOperator *op)
+static int select_tips_exec(bContext *C, wmOperator *UNUSED(op))
{
PEData data;
@@ -1690,7 +1690,7 @@ void PARTICLE_OT_hide(wmOperatorType *ot)
/*************************** reveal operator **************************/
-static int reveal_exec(bContext *C, wmOperator *op)
+static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_active_object(C);
Scene *scene= CTX_data_scene(C);
@@ -1758,7 +1758,7 @@ static void select_less_keys(PEData *data, int point_index)
}
}
-static int select_less_exec(bContext *C, wmOperator *op)
+static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
PEData data;
@@ -1819,7 +1819,7 @@ static void select_more_keys(PEData *data, int point_index)
}
}
-static int select_more_exec(bContext *C, wmOperator *op)
+static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
PEData data;
@@ -1846,7 +1846,7 @@ void PARTICLE_OT_select_more(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int select_inverse_exec(bContext *C, wmOperator *op)
+static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
PEData data;
PTCacheEdit *edit;
@@ -2022,7 +2022,7 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float
/************************* utilities **************************/
-static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psys, int mirror)
+static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
{
PTCacheEdit *edit = psys->edit;
ParticleData *pa, *npa=0, *new_pars=0;
@@ -2092,7 +2092,7 @@ static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psy
return removed;
}
-static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys)
+static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
{
PTCacheEdit *edit= psys->edit;
ParticleData *pa;
@@ -2123,7 +2123,7 @@ static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys)
if(new_totkey < 2)
point->flag |= PEP_TAG;
}
- remove_tagged_particles(scene, ob, psys, pe_x_mirror(ob));
+ remove_tagged_particles(ob, psys, pe_x_mirror(ob));
LOOP_POINTS {
pa = psys->particles + p;
@@ -2260,7 +2260,7 @@ static void subdivide_particle(PEData *data, int pa_index)
pa->flag &= ~PARS_REKEY;
}
-static int subdivide_exec(bContext *C, wmOperator *op)
+static int subdivide_exec(bContext *C, wmOperator *UNUSED(op))
{
PEData data;
@@ -2347,7 +2347,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
BLI_kdtree_free(tree);
/* remove tagged particles - don't do mirror here! */
- remove_tagged_particles(scene, ob, psys, 0);
+ remove_tagged_particles(ob, psys, 0);
totremoved += removed;
} while(removed);
@@ -2430,7 +2430,7 @@ void PARTICLE_OT_weight_set(wmOperatorType *ot)
/************************ cursor drawing *******************************/
-static void brush_drawcursor(bContext *C, int x, int y, void *customdata)
+static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata))
{
ParticleEditSettings *pset= PE_settings(CTX_data_scene(C));
ParticleBrushData *brush;
@@ -2574,12 +2574,12 @@ static int delete_exec(bContext *C, wmOperator *op)
if(type == DEL_KEY) {
foreach_selected_key(&data, set_delete_particle_key);
- remove_tagged_keys(data.scene, data.ob, data.edit->psys);
+ remove_tagged_keys(data.ob, data.edit->psys);
recalc_lengths(data.edit);
}
else if(type == DEL_PARTICLE) {
foreach_selected_point(&data, set_delete_particle);
- remove_tagged_particles(data.scene, data.ob, data.edit->psys, pe_x_mirror(data.ob));
+ remove_tagged_particles(data.ob, data.edit->psys, pe_x_mirror(data.ob));
recalc_lengths(data.edit);
}
@@ -2734,7 +2734,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
MEM_freeN(mirrorfaces);
}
-static int mirror_exec(bContext *C, wmOperator *op)
+static int mirror_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@@ -2765,7 +2765,7 @@ void PARTICLE_OT_mirror(wmOperatorType *ot)
/************************* brush edit callbacks ********************/
-static void brush_comb(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key)
+static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key)
{
ParticleEditSettings *pset= PE_settings(data->scene);
float cvec[3], fac;
@@ -3034,7 +3034,7 @@ static void brush_puff(PEData *data, int point_index)
}
-static void brush_weight(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key)
+static void brush_weight(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat[][4]), int point_index, int key_index, PTCacheEditKey *UNUSED(key))
{
/* roots have full weight allways */
if(key_index) {
@@ -3048,7 +3048,7 @@ static void brush_weight(PEData *data, float mat[][4], float imat[][4], int poin
}
}
-static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key)
+static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4]), int UNUSED(point_index), int key_index, PTCacheEditKey *key)
{
if(key_index) {
float dvec[3];
@@ -3060,7 +3060,7 @@ static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int
}
}
-static void brush_smooth_do(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key)
+static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key)
{
float vec[3], dvec[3];
@@ -3401,7 +3401,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
else
foreach_point(&data, brush_cut);
- removed= remove_tagged_particles(scene, ob, edit->psys, pe_x_mirror(ob));
+ removed= remove_tagged_particles(ob, edit->psys, pe_x_mirror(ob));
if(pset->flag & PE_KEEP_LENGTHS)
recalc_lengths(edit);
}
@@ -3538,7 +3538,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
pset->flag |= lock_root;
}
-static void brush_edit_exit(bContext *C, wmOperator *op)
+static void brush_edit_exit(wmOperator *op)
{
BrushEdit *bedit= op->customdata;
@@ -3555,7 +3555,7 @@ static int brush_edit_exec(bContext *C, wmOperator *op)
}
RNA_END;
- brush_edit_exit(C, op);
+ brush_edit_exit(op);
return OPERATOR_FINISHED;
}
@@ -3597,7 +3597,7 @@ static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event)
case LEFTMOUSE:
case MIDDLEMOUSE:
case RIGHTMOUSE: // XXX hardcoded
- brush_edit_exit(C, op);
+ brush_edit_exit(op);
return OPERATOR_FINISHED;
case MOUSEMOVE:
brush_edit_apply_event(C, op, event);
@@ -3607,9 +3607,9 @@ static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int brush_edit_cancel(bContext *C, wmOperator *op)
+static int brush_edit_cancel(bContext *UNUSED(C), wmOperator *op)
{
- brush_edit_exit(C, op);
+ brush_edit_exit(op);
return OPERATOR_CANCELLED;
}
@@ -4084,7 +4084,7 @@ static int particle_edit_toggle_poll(bContext *C)
return (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody));
}
-static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
+static int particle_edit_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@@ -4130,7 +4130,7 @@ void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot)
/************************ set editable operator ************************/
-static int clear_edited_exec(bContext *C, wmOperator *op)
+static int clear_edited_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_active_object(C);
ParticleSystem *psys = psys_get_current(ob);
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index e364a881601..428d8ce6b82 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -60,7 +60,7 @@
/********************** particle system slot operators *********************/
-static int particle_system_add_exec(bContext *C, wmOperator *op)
+static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Scene *scene = CTX_data_scene(C);
@@ -91,7 +91,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int particle_system_remove_exec(bContext *C, wmOperator *op)
+static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Scene *scene = CTX_data_scene(C);
@@ -138,7 +138,7 @@ static int psys_poll(bContext *C)
return (ptr.data != NULL);
}
-static int new_particle_settings_exec(bContext *C, wmOperator *op)
+static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Main *bmain= CTX_data_main(C);
@@ -191,7 +191,7 @@ void PARTICLE_OT_new(wmOperatorType *ot)
/********************** keyed particle target operators *********************/
-static int new_particle_target_exec(bContext *C, wmOperator *op)
+static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -237,7 +237,7 @@ void PARTICLE_OT_new_target(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int remove_particle_target_exec(bContext *C, wmOperator *op)
+static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -288,7 +288,7 @@ void PARTICLE_OT_target_remove(wmOperatorType *ot)
/************************ move up particle target operator *********************/
-static int target_move_up_exec(bContext *C, wmOperator *op)
+static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
@@ -327,7 +327,7 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot)
/************************ move down particle target operator *********************/
-static int target_move_down_exec(bContext *C, wmOperator *op)
+static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
@@ -365,7 +365,7 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot)
/************************ move up particle dupliweight operator *********************/
-static int dupliob_move_up_exec(bContext *C, wmOperator *op)
+static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
@@ -403,7 +403,7 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot)
/********************** particle dupliweight operators *********************/
-static int copy_particle_dupliob_exec(bContext *C, wmOperator *op)
+static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
@@ -442,7 +442,7 @@ void PARTICLE_OT_dupliob_copy(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int remove_particle_dupliob_exec(bContext *C, wmOperator *op)
+static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
@@ -487,7 +487,7 @@ void PARTICLE_OT_dupliob_remove(wmOperatorType *ot)
/************************ move down particle dupliweight operator *********************/
-static int dupliob_move_down_exec(bContext *C, wmOperator *op)
+static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index f411f92d395..b1c373e7a91 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -342,7 +342,7 @@ static void free_all_fluidobject_channels(ListBase *fobjects)
}
}
-static void fluid_init_all_channels(bContext *C, Object *fsDomain, FluidsimSettings *domainSettings, FluidAnimChannels *channels, ListBase *fobjects)
+static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), FluidsimSettings *domainSettings, FluidAnimChannels *channels, ListBase *fobjects)
{
Scene *scene = CTX_data_scene(C);
Base *base;
@@ -639,7 +639,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
// prepare names...
strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR);
strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR);
- BLI_path_abs(targetDir, G.sce); // fixed #frame-no
+ BLI_path_abs(targetDir, G.main->name); // fixed #frame-no
strcpy(targetFile, targetDir);
strcat(targetFile, suffixConfig);
@@ -663,7 +663,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
char blendFile[FILE_MAXDIR+FILE_MAXFILE];
// invalid dir, reset to current/previous
- strcpy(blendDir, G.sce);
+ strcpy(blendDir, G.main->name);
BLI_splitdirstring(blendDir, blendFile);
if(strlen(blendFile)>6){
int len = strlen(blendFile);
@@ -694,7 +694,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
if(selection<1) return 0; // 0 from menu, or -1 aborted
strcpy(targetDir, newSurfdataPath);
strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
- BLI_path_abs(targetDir, G.sce); // fixed #frame-no
+ BLI_path_abs(targetDir, G.main->name); // fixed #frame-no
}
#endif
return outStringsChanged;
@@ -720,7 +720,7 @@ static void fluidbake_free(void *customdata)
}
/* called by fluidbake, only to check job 'stop' value */
-static int fluidbake_breakjob(void *customdata)
+static int fluidbake_breakjob(void *UNUSED(customdata))
{
//FluidBakeJob *fb= (FluidBakeJob *)customdata;
//return *(fb->stop);
@@ -1047,7 +1047,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
return 1;
}
-void fluidsimFreeBake(Object *ob)
+void fluidsimFreeBake(Object *UNUSED(ob))
{
/* not implemented yet */
}
@@ -1056,27 +1056,27 @@ void fluidsimFreeBake(Object *ob)
/* compile dummy functions for disabled fluid sim */
-FluidsimSettings *fluidsimSettingsNew(Object *srcob)
+FluidsimSettings *fluidsimSettingsNew(Object *UNUSED(srcob))
{
return NULL;
}
-void fluidsimSettingsFree(FluidsimSettings *fss)
+void fluidsimSettingsFree(FluidsimSettings *UNUSED(fss))
{
}
-FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss)
+FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *UNUSED(fss))
{
return NULL;
}
/* only compile dummy functions */
-int fluidsimBake(bContext *C, ReportList *reports, Object *ob)
+int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object *UNUSED(ob))
{
return 0;
}
-void fluidsimFreeBake(Object *ob)
+void fluidsimFreeBake(Object *UNUSED(ob))
{
}
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 35f86a49aa7..9e39862cf5d 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -56,7 +56,7 @@
#include "physics_intern.h"
-static int cache_break_test(void *cbd) {
+static int cache_break_test(void *UNUSED(cbd)) {
return G.afbreek==1;
}
static int ptcache_bake_all_poll(bContext *C)
@@ -75,13 +75,13 @@ static int ptcache_poll(bContext *C)
return (ptr.data && ptr.id.data);
}
-void bake_console_progress(void *arg, int nr)
+void bake_console_progress(void *UNUSED(arg), int nr)
{
printf("\rbake: %3i%%", nr);
fflush(stdout);
}
-void bake_console_progress_end(void *arg)
+void bake_console_progress_end(void *UNUSED(arg))
{
printf("\n");
}
@@ -120,7 +120,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int ptcache_free_bake_all_exec(bContext *C, wmOperator *op)
+static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Base *base;
@@ -221,7 +221,7 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int ptcache_free_bake_exec(bContext *C, wmOperator *op)
+static int ptcache_free_bake_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
PointCache *cache= ptr.data;
@@ -241,7 +241,7 @@ static int ptcache_free_bake_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *op)
+static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
PointCache *cache= ptr.data;
@@ -295,7 +295,7 @@ void PTCACHE_OT_bake_from_cache(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int ptcache_add_new_exec(bContext *C, wmOperator *op)
+static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
@@ -320,7 +320,7 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int ptcache_remove_exec(bContext *C, wmOperator *op)
+static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
Scene *scene= CTX_data_scene(C);
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 083202e5a03..7f34e6fa333 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -596,7 +596,7 @@ static int render_breakjob(void *rjv)
}
/* catch esc */
-static int screen_render_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int screen_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running blender, remove handler and pass through */
if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
@@ -763,7 +763,7 @@ void RENDER_OT_render(wmOperatorType *ot)
/* *********************** cancel render viewer *************** */
-static int render_view_cancel_exec(bContext *C, wmOperator *unused)
+static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(unused))
{
wmWindow *win= CTX_wm_window(C);
ScrArea *sa= CTX_wm_area(C);
@@ -810,7 +810,7 @@ void RENDER_OT_view_cancel(struct wmOperatorType *ot)
/* *********************** show render viewer *************** */
-static int render_view_show_invoke(bContext *C, wmOperator *unused, wmEvent *event)
+static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(unused), wmEvent *event)
{
ScrArea *sa= find_area_showing_r_result(C);
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 71bee8c5b08..0e8587e4642 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -111,7 +111,7 @@ ImBuf* get_brush_icon(Brush *brush)
// first use the path directly to try and load the file
BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath));
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
brush->icon_imbuf= IMB_loadiffname(path, flags);
@@ -121,7 +121,7 @@ ImBuf* get_brush_icon(Brush *brush)
path[0]= 0;
- BLI_make_file_string(G.sce, path, folder, brush->icon_filepath);
+ BLI_make_file_string(G.main->name, path, folder, brush->icon_filepath);
if (path[0])
brush->icon_imbuf= IMB_loadiffname(path, flags);
@@ -190,7 +190,7 @@ void draw_tex_crop(Tex *tex)
}
/* temporal abuse; if id_code is -1 it only does texture.... solve! */
-void BIF_preview_changed(short id_code)
+void BIF_preview_changed(short UNUSED(id_code))
{
#if 0
ScrArea *sa;
@@ -571,7 +571,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
/* ******************************** Icon Preview **************************** */
-void ED_preview_icon_draw(const bContext *C, void *idp, void *arg1, void *arg2, rcti *rect)
+void ED_preview_icon_draw(const bContext *UNUSED(C), void *UNUSED(idp), void *UNUSED(arg1), void *UNUSED(arg2), rcti *UNUSED(rect))
{
}
@@ -603,7 +603,7 @@ void view3d_previewrender_progress(RenderResult *rr, volatile rcti *renrect)
}
-void BIF_view3d_previewrender_signal(ScrArea *sa, short signal)
+void BIF_view3d_previewrender_signal(ScrArea *UNUSED(sa), short UNUSED(signal))
{
#if 0
View3D *v3d= sa->spacedata.first;
@@ -625,7 +625,7 @@ void BIF_view3d_previewrender_signal(ScrArea *sa, short signal)
#endif
}
-void BIF_view3d_previewrender_free(View3D *v3d)
+void BIF_view3d_previewrender_free(View3D *UNUSED(v3d))
{
#if 0
if(v3d->ri) {
@@ -683,7 +683,7 @@ static int view3d_previewrender_get_rects(ScrArea *sa, rctf *viewplane, RenderIn
}
/* called before a panel gets moved/scaled, makes sure we can see through */
-void BIF_view3d_previewrender_clear(ScrArea *sa)
+void BIF_view3d_previewrender_clear(ScrArea *UNUSED(sa))
{
#if 0
View3D *v3d= sa->spacedata.first;
@@ -844,7 +844,7 @@ void BIF_view3d_previewrender(Main *bmain, Scene *scene, ScrArea *sa)
}
/* in panel space! */
-static void view3d_previewdraw_rect(ScrArea *sa, uiBlock *block, RenderInfo *ri)
+static void view3d_previewdraw_rect(ScrArea *UNUSED(sa), uiBlock *UNUSED(block), RenderInfo *ri)
{
// rctf dispf;
@@ -887,7 +887,7 @@ void BIF_view3d_previewdraw(struct ScrArea *sa, struct uiBlock *block)
/* **************************** new shader preview system ****************** */
/* inside thread, called by renderer, sets job update value */
-static void shader_preview_draw(void *spv, RenderResult *rr, volatile struct rcti *rect)
+static void shader_preview_draw(void *spv, RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect))
{
ShaderPreview *sp= spv;
@@ -903,7 +903,7 @@ static int shader_preview_break(void *spv)
}
/* outside thread, called before redraw notifiers, it moves finished preview over */
-static void shader_preview_updatejob(void *spv)
+static void shader_preview_updatejob(void *UNUSED(spv))
{
// ShaderPreview *sp= spv;
@@ -1141,7 +1141,7 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
/* use same function for icon & shader, so the job manager
does not run two of them at the same time. */
-static void common_preview_startjob(void *customdata, short *stop, short *do_update, float *progress)
+static void common_preview_startjob(void *customdata, short *stop, short *do_update, float *UNUSED(progress))
{
ShaderPreview *sp= customdata;
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index debd13c8d99..9db15ee43e5 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -116,7 +116,7 @@ static int nodes_use_tex(bNodeTree *ntree, Tex *tex)
return 0;
}
-static void material_changed(Main *bmain, Material *ma)
+static void material_changed(Main *UNUSED(bmain), Material *ma)
{
/* icons */
BKE_icon_changed(BKE_icon_getid(&ma->id));
@@ -208,7 +208,7 @@ static void image_changed(Main *bmain, Image *ima)
texture_changed(bmain, tex);
}
-static void scene_changed(Main *bmain, Scene *sce)
+static void scene_changed(Main *bmain, Scene *UNUSED(scene))
{
Object *ob;
Material *ma;
@@ -254,7 +254,7 @@ void ED_render_id_flush_update(Main *bmain, ID *id)
/********************** material slot operators *********************/
-static int material_slot_add_exec(bContext *C, wmOperator *op)
+static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -263,6 +263,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *op)
object_add_material_slot(ob);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob);
return OPERATOR_FINISHED;
}
@@ -288,8 +289,15 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op)
if(!ob)
return OPERATOR_CANCELLED;
+ /* Removing material slots in edit mode screws things up, see bug #21822.*/
+ if(ob == CTX_data_edit_object(C)) {
+ BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode.");
+ return OPERATOR_CANCELLED;
+ }
+
object_remove_material_slot(ob);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob);
return OPERATOR_FINISHED;
}
@@ -308,7 +316,7 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int material_slot_assign_exec(bContext *C, wmOperator *op)
+static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -432,7 +440,7 @@ static int material_slot_de_select(bContext *C, int select)
return OPERATOR_FINISHED;
}
-static int material_slot_select_exec(bContext *C, wmOperator *op)
+static int material_slot_select_exec(bContext *C, wmOperator *UNUSED(op))
{
return material_slot_de_select(C, 1);
}
@@ -451,7 +459,7 @@ void OBJECT_OT_material_slot_select(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int material_slot_deselect_exec(bContext *C, wmOperator *op)
+static int material_slot_deselect_exec(bContext *C, wmOperator *UNUSED(op))
{
return material_slot_de_select(C, 0);
}
@@ -471,7 +479,7 @@ void OBJECT_OT_material_slot_deselect(wmOperatorType *ot)
}
-static int material_slot_copy_exec(bContext *C, wmOperator *op)
+static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Material ***matar;
@@ -512,7 +520,7 @@ void OBJECT_OT_material_slot_copy(wmOperatorType *ot)
/********************** new material operator *********************/
-static int new_material_exec(bContext *C, wmOperator *op)
+static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
PointerRNA ptr, idptr;
@@ -558,7 +566,7 @@ void MATERIAL_OT_new(wmOperatorType *ot)
/********************** new texture operator *********************/
-static int new_texture_exec(bContext *C, wmOperator *op)
+static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
{
Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
PointerRNA ptr, idptr;
@@ -604,7 +612,7 @@ void TEXTURE_OT_new(wmOperatorType *ot)
/********************** new world operator *********************/
-static int new_world_exec(bContext *C, wmOperator *op)
+static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
{
World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data;
PointerRNA ptr, idptr;
@@ -650,7 +658,7 @@ void WORLD_OT_new(wmOperatorType *ot)
/********************** render layer operators *********************/
-static int render_layer_add_exec(bContext *C, wmOperator *op)
+static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
@@ -676,7 +684,7 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int render_layer_remove_exec(bContext *C, wmOperator *op)
+static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
SceneRenderLayer *rl;
@@ -826,7 +834,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int
dx= env->cube[1]->x;
if (env->type == ENV_CUBE) {
- ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat, 0);
+ ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat);
IMB_rectcpy(ibuf, env->cube[0], 0, 0, 0, 0, dx, dx);
IMB_rectcpy(ibuf, env->cube[1], dx, 0, 0, 0, dx, dx);
@@ -836,7 +844,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int
IMB_rectcpy(ibuf, env->cube[5], 2*dx, dx, 0, 0, dx, dx);
}
else if (env->type == ENV_PLANE) {
- ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat, 0);
+ ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat);
IMB_rectcpy(ibuf, env->cube[1], 0, 0, 0, 0, dx, dx);
}
@@ -844,7 +852,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int
ibuf->profile = IB_PROFILE_LINEAR_RGB;
/* to save, we first get absolute path */
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) {
retval = OPERATOR_FINISHED;
@@ -855,7 +863,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int
}
/* in case we were saving with relative paths, change back again */
if(relative)
- BLI_path_rel(str, G.sce);
+ BLI_path_rel(str, G.main->name);
IMB_freeImBuf(ibuf);
ibuf = NULL;
@@ -888,7 +896,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
//Scene *scene= CTX_data_scene(C);
@@ -900,7 +908,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *event)
//RNA_enum_set(op->ptr, "file_type", scene->r.imtype);
- RNA_string_set(op->ptr, "filepath", G.sce);
+ RNA_string_set(op->ptr, "filepath", G.main->name);
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -940,7 +948,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
}
-static int envmap_clear_exec(bContext *C, wmOperator *op)
+static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
@@ -980,7 +988,7 @@ void TEXTURE_OT_envmap_clear(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int envmap_clear_all_exec(bContext *C, wmOperator *op)
+static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Tex *tex;
@@ -1012,7 +1020,7 @@ void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot)
/********************** material operators *********************/
/* material copy/paste */
-static int copy_material_exec(bContext *C, wmOperator *op)
+static int copy_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
@@ -1040,7 +1048,7 @@ void MATERIAL_OT_copy(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int paste_material_exec(bContext *C, wmOperator *op)
+static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
@@ -1140,7 +1148,7 @@ void paste_mtex_copybuf(ID *id)
}
-static int copy_mtex_exec(bContext *C, wmOperator *op)
+static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op))
{
ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
@@ -1179,7 +1187,7 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int paste_mtex_exec(bContext *C, wmOperator *op)
+static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
{
ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 7f5485ae8b6..ae1388fb7f2 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -144,7 +144,7 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa)
/* based on screen region draw tags, set draw tags in azones, and future region tabs etc */
/* only exported for WM */
-void ED_area_overdraw_flush(bContext *C, ScrArea *sa, ARegion *ar)
+void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar)
{
AZone *az;
@@ -187,7 +187,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
}
-static void region_draw_azone(ScrArea *sa, AZone *az)
+static void region_draw_azone(AZone *az)
{
GLUquadricObj *qobj = NULL;
short midx = az->x1 + (az->x2 - az->x1)/2;
@@ -247,7 +247,7 @@ void ED_area_overdraw(bContext *C)
if(az->type==AZONE_AREA) {
area_draw_azone(az->x1, az->y1, az->x2, az->y2);
} else if(az->type==AZONE_REGION) {
- region_draw_azone(sa, az);
+ region_draw_azone(az);
}
az->do_draw= 0;
@@ -817,7 +817,7 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
/* used for area initialize below */
-static void region_subwindow(wmWindowManager *wm, wmWindow *win, ARegion *ar)
+static void region_subwindow(wmWindow *win, ARegion *ar)
{
if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
if(ar->swinid)
@@ -908,7 +908,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
/* region windows, default and own handlers */
for(ar= sa->regionbase.first; ar; ar= ar->next) {
- region_subwindow(wm, win, ar);
+ region_subwindow(win, ar);
if(ar->swinid) {
/* default region handlers */
@@ -931,7 +931,7 @@ void ED_region_init(bContext *C, ARegion *ar)
// ARegionType *at= ar->type;
/* refresh can be called before window opened */
- region_subwindow(CTX_wm_manager(C), CTX_wm_window(C), ar);
+ region_subwindow(CTX_wm_window(C), ar);
ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
@@ -1156,7 +1156,7 @@ static char *editortype_pup(void)
);
}
-static void spacefunc(struct bContext *C, void *arg1, void *arg2)
+static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
ED_area_newspace(C, CTX_wm_area(C), CTX_wm_area(C)->butspacetype);
ED_area_tag_redraw(CTX_wm_area(C));
@@ -1244,7 +1244,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
uiBeginPanels(C, ar);
/* set view2d view matrix for scrolling (without scrollers) */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
for(pt= ar->type->paneltypes.first; pt; pt= pt->next) {
/* verify context */
@@ -1365,7 +1365,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
UI_view2d_totRect_set(v2d, x+V2D_SCROLL_WIDTH, y+V2D_SCROLL_HEIGHT);
/* set the view */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* this does the actual drawing! */
uiEndPanels(C, ar);
@@ -1414,7 +1414,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
- UI_view2d_view_ortho(C, &ar->v2d);
+ UI_view2d_view_ortho(&ar->v2d);
xco= maxco= 8;
yco= HEADERY-3;
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 06da91c3e37..a6c4c77e468 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -527,7 +527,8 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *
glaDrawPixelsTexScaled(x, y, img_w, img_h, format, rect, 1.0f, 1.0f);
}
-void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf, int gamma_correct)
+/* row_w is unused but kept for completeness */
+void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int UNUSED(row_w), float *rectf, int gamma_correct)
{
unsigned char *rect32;
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index fbc83b1de65..b619398d985 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -209,14 +209,15 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if(CTX_data_equals(member, "visible_pose_bones")) {
- bArmature *arm= (obact) ? obact->data : NULL;
+ Object *obpose= ED_object_pose_armature(obact);
+ bArmature *arm= (obpose) ? obpose->data : NULL;
bPoseChannel *pchan;
- if (obact && obact->pose && arm) {
- for (pchan= obact->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if (obpose && obpose->pose && arm) {
+ for (pchan= obpose->pose->chanbase.first; pchan; pchan= pchan->next) {
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
if ((pchan->bone) && (arm->layer & pchan->bone->layer) && !(pchan->bone->flag & BONE_HIDDEN_P)) {
- CTX_data_list_add(result, &obact->id, &RNA_PoseBone, pchan);
+ CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
}
}
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -224,15 +225,16 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if(CTX_data_equals(member, "selected_pose_bones")) {
- bArmature *arm= (obact) ? obact->data : NULL;
+ Object *obpose= ED_object_pose_armature(obact);
+ bArmature *arm= (obpose) ? obpose->data : NULL;
bPoseChannel *pchan;
- if (obact && obact->pose && arm) {
- for (pchan= obact->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if (obpose && obpose->pose && arm) {
+ for (pchan= obpose->pose->chanbase.first; pchan; pchan= pchan->next) {
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
if ((pchan->bone) && (arm->layer & pchan->bone->layer) && !(pchan->bone->flag & BONE_HIDDEN_P)) {
if (pchan->bone->flag & BONE_SELECTED || pchan->bone == arm->act_bone)
- CTX_data_list_add(result, &obact->id, &RNA_PoseBone, pchan);
+ CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
}
}
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -258,10 +260,11 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if(CTX_data_equals(member, "active_pose_bone")) {
bPoseChannel *pchan;
+ Object *obpose= ED_object_pose_armature(obact);
- pchan= get_active_posechannel(obact);
+ pchan= get_active_posechannel(obpose);
if (pchan) {
- CTX_data_pointer_set(result, &obact->id, &RNA_PoseBone, pchan);
+ CTX_data_pointer_set(result, &obpose->id, &RNA_PoseBone, pchan);
return 1;
}
}
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 32e82571609..9d178a57465 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -309,7 +309,7 @@ static void screen_delarea(bContext *C, bScreen *sc, ScrArea *sa)
/* return 0: no split possible */
/* else return (integer) screencoordinate split point */
-static short testsplitpoint(wmWindow *win, ScrArea *sa, char dir, float fac)
+static short testsplitpoint(ScrArea *sa, char dir, float fac)
{
short x, y;
@@ -345,7 +345,7 @@ static short testsplitpoint(wmWindow *win, ScrArea *sa, char dir, float fac)
}
}
-ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac)
+ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac)
{
ScrArea *newa=NULL;
ScrVert *sv1, *sv2;
@@ -353,7 +353,7 @@ ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac
if(sa==NULL) return NULL;
- split= testsplitpoint(win, sa, dir, fac);
+ split= testsplitpoint(sa, dir, fac);
if(split==0) return NULL;
if(dir=='h') {
@@ -484,7 +484,7 @@ static void screen_copy(bScreen *to, bScreen *from)
/* with sa as center, sb is located at: 0=W, 1=N, 2=E, 3=S */
/* -1 = not valid check */
/* used with join operator */
-int area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb)
+int area_getorientation(ScrArea *sa, ScrArea *sb)
{
ScrVert *sav1, *sav2, *sav3, *sav4;
ScrVert *sbv1, *sbv2, *sbv3, *sbv4;
@@ -523,7 +523,7 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2)
{
int dir;
- dir = area_getorientation(scr, sa1, sa2);
+ dir = area_getorientation(sa1, sa2);
/*printf("dir is : %i \n", dir);*/
if (dir < 0)
@@ -861,7 +861,7 @@ static void scrarea_draw_shape_dark(ScrArea *sa, char dir)
}
/* draw screen area ligher with arrow shape ("eraser" of previous dark shape) */
-static void scrarea_draw_shape_light(ScrArea *sa, char dir)
+static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir))
{
glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
glEnable(GL_BLEND);
@@ -993,7 +993,7 @@ void ED_screen_draw(wmWindow *win)
/* blended join arrow */
if (sa1 && sa2) {
- dir = area_getorientation(win->screen, sa1, sa2);
+ dir = area_getorientation(sa1, sa2);
if (dir >= 0) {
switch(dir) {
case 0: /* W */
@@ -1613,7 +1613,7 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
oldscreen->animtimer= NULL;
/* returns the top small area */
- newa= area_split(win, sc, (ScrArea *)sc->areabase.first, 'h', 0.99f);
+ newa= area_split(sc, (ScrArea *)sc->areabase.first, 'h', 0.99f);
ED_area_newspace(C, newa, SPACE_INFO);
/* use random area when we have no active one, e.g. when the
@@ -1739,7 +1739,7 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh)
}
/* results in fully updated anim system */
-void ED_update_for_newframe(const bContext *C, int mute)
+void ED_update_for_newframe(const bContext *C, int UNUSED(mute))
{
Main *bmain= CTX_data_main(C);
bScreen *screen= CTX_wm_screen(C);
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index 79789b1876e..b20daf9a0c8 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -37,9 +37,9 @@ void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space);
/* screen_edit.c */
ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2);
-ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac);
+ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac);
int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2);
-int area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb);
+int area_getorientation(ScrArea *sa, ScrArea *sb);
void select_connected_scredge(bScreen *sc, ScrEdge *edge);
void removenotused_scrverts(bScreen *sc);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 7638d576d9d..5a6acd24c5f 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -56,6 +56,7 @@
#include "ED_util.h"
#include "ED_screen.h"
#include "ED_object.h"
+#include "ED_armature.h"
#include "ED_screen_types.h"
#include "ED_keyframes_draw.h"
@@ -243,7 +244,11 @@ int ED_operator_editmesh_view3d(bContext *C)
int ED_operator_editmesh_region_view3d(bContext *C)
{
- return ED_operator_editmesh(C) && CTX_wm_region_view3d(C);
+ if(ED_operator_editmesh(C) && CTX_wm_region_view3d(C))
+ return 1;
+
+ CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editmesh");
+ return 0;
}
int ED_operator_editarmature(bContext *C)
@@ -257,11 +262,16 @@ int ED_operator_editarmature(bContext *C)
int ED_operator_posemode(bContext *C)
{
Object *obact= CTX_data_active_object(C);
- Object *obedit= CTX_data_edit_object(C);
-
- if ((obact != obedit) && (obact) && (obact->type==OB_ARMATURE))
- return (obact->mode & OB_MODE_POSE)!=0;
-
+
+ if ((obact != CTX_data_edit_object(C))) {
+ Object *obpose;
+ if((obpose= ED_object_pose_armature(obact))) {
+ if((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
+ return 1;
+ }
+ }
+ }
+
return 0;
}
@@ -433,7 +443,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
}
-static void actionzone_exit(bContext *C, wmOperator *op)
+static void actionzone_exit(wmOperator *op)
{
if(op->customdata)
MEM_freeN(op->customdata);
@@ -479,7 +489,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* region azone directly reacts on mouse clicks */
if(sad->az->type==AZONE_REGION) {
actionzone_apply(C, op, AZONE_REGION);
- actionzone_exit(C, op);
+ actionzone_exit(op);
return OPERATOR_FINISHED;
}
else {
@@ -519,16 +529,16 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event)
sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
/* apply sends event */
actionzone_apply(C, op, sad->az->type);
- actionzone_exit(C, op);
+ actionzone_exit(op);
return OPERATOR_FINISHED;
}
break;
case ESCKEY:
- actionzone_exit(C, op);
+ actionzone_exit(op);
return OPERATOR_CANCELLED;
case LEFTMOUSE:
- actionzone_exit(C, op);
+ actionzone_exit(op);
return OPERATOR_CANCELLED;
}
@@ -579,7 +589,7 @@ typedef struct sAreaSwapData {
ScrArea *sa1, *sa2;
} sAreaSwapData;
-static int area_swap_init(bContext *C, wmOperator *op, wmEvent *event)
+static int area_swap_init(wmOperator *op, wmEvent *event)
{
sAreaSwapData *sd= NULL;
sActionzoneData *sad= event->customdata;
@@ -613,7 +623,7 @@ static int area_swap_cancel(bContext *C, wmOperator *op)
static int area_swap_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!area_swap_init(C, op, event))
+ if(!area_swap_init(op, event))
return OPERATOR_PASS_THROUGH;
/* add modal handler */
@@ -699,7 +709,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* poll() checks area context, but we don't accept full-area windows */
if(sc->full != SCREENNORMAL) {
if(event->type==EVT_ACTIONZONE_AREA)
- actionzone_exit(C, op);
+ actionzone_exit(op);
return OPERATOR_CANCELLED;
}
@@ -721,7 +731,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
if(event->type==EVT_ACTIONZONE_AREA)
- actionzone_exit(C, op);
+ actionzone_exit(op);
return OPERATOR_FINISHED;
}
@@ -1115,7 +1125,7 @@ static int area_split_apply(bContext *C, wmOperator *op)
fac= RNA_float_get(op->ptr, "factor");
dir= RNA_enum_get(op->ptr, "direction");
- sd->narea= area_split(CTX_wm_window(C), sc, sd->sarea, dir, fac);
+ sd->narea= area_split(sc, sd->sarea, dir, fac);
if(sd->narea) {
ScrVert *sv;
@@ -1548,15 +1558,32 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot)
static int frame_jump_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
-
- if (RNA_boolean_get(op->ptr, "end"))
- CFRA= PEFRA;
- else
- CFRA= PSFRA;
-
- sound_seek_scene(C);
+ wmTimer *animtimer= CTX_wm_screen(C)->animtimer;
+
+ /* Don't change CFRA directly if animtimer is running as this can cause
+ * first/last frame not to be actually shown (bad since for example physics
+ * simulations aren't reset properly).
+ */
+ if(animtimer) {
+ ScreenAnimData *sad = animtimer->customdata;
+
+ sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME;
+
+ if (RNA_boolean_get(op->ptr, "end"))
+ sad->nextfra= PEFRA;
+ else
+ sad->nextfra= PSFRA;
+ }
+ else {
+ if (RNA_boolean_get(op->ptr, "end"))
+ CFRA= PEFRA;
+ else
+ CFRA= PSFRA;
+
+ sound_seek_scene(C);
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ }
return OPERATOR_FINISHED;
}
@@ -1714,7 +1741,7 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot)
/* function to be called outside UI context, or for redo */
-static int screen_full_area_exec(bContext *C, wmOperator *op)
+static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op))
{
ED_screen_full_toggle(C, CTX_wm_window(C), CTX_wm_area(C));
return OPERATOR_FINISHED;
@@ -1921,7 +1948,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
if (sa) {
if (jd->sa1 != sa) {
- dir = area_getorientation(sc, jd->sa1, sa);
+ dir = area_getorientation(jd->sa1, sa);
if (dir >= 0) {
if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
jd->sa2 = sa;
@@ -1932,7 +1959,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
we check if area has common border with the one marked for removal
in this case we can swap areas.
*/
- dir = area_getorientation(sc, sa, jd->sa2);
+ dir = area_getorientation(sa, jd->sa2);
if (dir >= 0) {
if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
@@ -1958,13 +1985,13 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
jd->sa2 = sa;
if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
- dir = area_getorientation(sc, jd->sa1, jd->sa2);
+ dir = area_getorientation(jd->sa1, jd->sa2);
if (dir < 0) {
printf("oops, didn't expect that!\n");
}
}
else {
- dir = area_getorientation(sc, jd->sa1, sa);
+ dir = area_getorientation(jd->sa1, sa);
if (dir >= 0) {
if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
jd->sa2 = sa;
@@ -2021,7 +2048,7 @@ static void SCREEN_OT_area_join(wmOperatorType *ot)
/* ************** repeat last operator ***************************** */
-static int repeat_last_exec(bContext *C, wmOperator *op)
+static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
{
wmOperator *lastop= CTX_wm_manager(C)->operators.last;
@@ -2045,7 +2072,7 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot)
}
-static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
wmWindowManager *wm= CTX_wm_manager(C);
wmOperator *lastop;
@@ -2102,7 +2129,7 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot)
/* ********************** redo operator ***************************** */
-static int redo_last_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
wmWindowManager *wm= CTX_wm_manager(C);
wmOperator *lastop;
@@ -2230,7 +2257,7 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot)
/* ************** region flip operator ***************************** */
/* flip a region alignment */
-static int region_flip_exec(bContext *C, wmOperator *op)
+static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
ARegion *ar= CTX_wm_region(C);
@@ -2268,7 +2295,7 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot)
/* ************** header flip operator ***************************** */
/* flip a header region alignment */
-static int header_flip_exec(bContext *C, wmOperator *op)
+static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
ARegion *ar= CTX_wm_region(C);
@@ -2322,7 +2349,7 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot)
/* ************** header tools operator ***************************** */
-static int header_toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
@@ -2436,7 +2463,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
return 0;
}
-static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event)
+static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
bScreen *screen= CTX_wm_screen(C);
@@ -2508,6 +2535,13 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event)
}
}
}
+
+ /* next frame overriden by user action (pressed jump to first/last frame) */
+ if(sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
+ scene->r.cfra = sad->nextfra;
+ sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME;
+ sad->flag |= ANIMPLAY_FLAG_JUMPED;
+ }
if (sad->flag & ANIMPLAY_FLAG_JUMPED)
sound_seek_scene(C);
@@ -2638,7 +2672,7 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate");
}
-static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
+static int screen_animation_cancel_exec(bContext *C, wmOperator *UNUSED(op))
{
bScreen *screen= CTX_wm_screen(C);
@@ -2766,7 +2800,7 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
/* *********** show user pref window ****** */
-static int userpref_show_invoke(bContext *C, wmOperator *unused, wmEvent *event)
+static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
ScrArea *sa;
rcti rect;
@@ -2805,7 +2839,7 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot)
/********************* new screen operator *********************/
-static int screen_new_exec(bContext *C, wmOperator *op)
+static int screen_new_exec(bContext *C, wmOperator *UNUSED(op))
{
wmWindow *win= CTX_wm_window(C);
bScreen *sc= CTX_wm_screen(C);
@@ -2832,7 +2866,7 @@ void SCREEN_OT_new(wmOperatorType *ot)
/********************* delete screen operator *********************/
-static int screen_delete_exec(bContext *C, wmOperator *op)
+static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
bScreen *sc= CTX_wm_screen(C);
@@ -2863,7 +2897,7 @@ static int scene_new_exec(bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
int type= RNA_enum_get(op->ptr, "type");
- newscene= copy_scene(bmain, scene, type);
+ newscene= copy_scene(scene, type);
/* these can't be handled in blenkernel curently, so do them here */
if(type == SCE_COPY_LINK_DATA)
@@ -2903,7 +2937,7 @@ void SCENE_OT_new(wmOperatorType *ot)
/********************* delete scene operator *********************/
-static int scene_delete_exec(bContext *C, wmOperator *op)
+static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 56efa0a5a83..082c9f2f721 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -42,6 +42,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_image.h"
#include "BKE_report.h"
#include "BKE_writeavi.h"
@@ -77,14 +78,14 @@ static int screenshot_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
strcpy(G.ima, path);
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
/* BKE_add_image_extension() checks for if extension was already set */
if(scene->r.scemode & R_EXTENSION)
if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5)
BKE_add_image_extension(path, scene->r.imtype);
- ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0, 0);
+ ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
ibuf->rect= scd->dumprect;
BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality);
@@ -132,7 +133,7 @@ static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy, int fscre
}
-static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
unsigned int *dumprect;
int dumpsx, dumpsy;
@@ -214,7 +215,7 @@ static void screenshot_updatejob(void *sjv)
/* only this runs inside thread */
-static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *progress)
+static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *UNUSED(progress))
{
ScreenshotJob *sj= sjv;
RenderData rd= sj->scene->r;
@@ -251,7 +252,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
break;
}
else {
- ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0, 0);
+ ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0);
char name[FILE_MAXDIR+FILE_MAXFILE];
int ok;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 6e921b57d9d..71754c3589a 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -383,7 +383,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
return tile->rect;
if (*tmpibuf==NULL)
- *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect, 0);
+ *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect);
tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile");
strcpy(tile->idname, ima->id.name);
@@ -410,7 +410,7 @@ static void image_undo_restore(bContext *C, ListBase *lb)
UndoImageTile *tile;
tmpibuf= IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
- IB_rectfloat|IB_rect, 0);
+ IB_rectfloat|IB_rect);
for(tile=lb->first; tile; tile=tile->next) {
/* find image based on name, pointer becomes invalid with global undo */
@@ -473,8 +473,6 @@ static int project_bucket_offset_safe(const ProjPaintState *ps, const float proj
}
}
-#define SIDE_OF_LINE(pa, pb, pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
-
/* still use 2D X,Y space but this works for verts transformed by a perspective matrix, using their 4th component as a weight */
static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4], float co[2], float w[3])
{
@@ -1689,7 +1687,7 @@ static float Vec2Lenf_nosqrt_other(const float *v1, const float v2_1, const floa
/* note, use a squared value so we can use Vec2Lenf_nosqrt
* be sure that you have done a bounds check first or this may fail */
/* only give bucket_bounds as an arg because we need it elsewhere */
-static int project_bucket_isect_circle(const int bucket_x, const int bucket_y, const float cent[2], const float radius_squared, rctf *bucket_bounds)
+static int project_bucket_isect_circle(const float cent[2], const float radius_squared, rctf *bucket_bounds)
{
/* Would normally to a simple intersection test, however we know the bounds of these 2 already intersect
@@ -1852,7 +1850,7 @@ static void project_bucket_clip_face(
{
int inside_bucket_flag = 0;
int inside_face_flag = 0;
- const int flip = ((SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) > 0.0f) != (SIDE_OF_LINE(uv1co, uv2co, uv3co) > 0.0f));
+ const int flip = ((line_point_side_v2(v1coSS, v2coSS, v3coSS) > 0.0f) != (line_point_side_v2(uv1co, uv2co, uv3co) > 0.0f));
float bucket_bounds_ss[4][2];
@@ -2134,15 +2132,15 @@ if __name__ == '__main__':
/* checks if pt is inside a convex 2D polyline, the polyline must be ordered rotating clockwise
- * otherwise it would have to test for mixed (SIDE_OF_LINE > 0.0f) cases */
+ * otherwise it would have to test for mixed (line_point_side_v2 > 0.0f) cases */
int IsectPoly2Df(const float pt[2], float uv[][2], const int tot)
{
int i;
- if (SIDE_OF_LINE(uv[tot-1], uv[0], pt) < 0.0f)
+ if (line_point_side_v2(uv[tot-1], uv[0], pt) < 0.0f)
return 0;
for (i=1; i<tot; i++) {
- if (SIDE_OF_LINE(uv[i-1], uv[i], pt) < 0.0f)
+ if (line_point_side_v2(uv[i-1], uv[i], pt) < 0.0f)
return 0;
}
@@ -2152,10 +2150,10 @@ int IsectPoly2Df(const float pt[2], float uv[][2], const int tot)
static int IsectPoly2Df_twoside(const float pt[2], float uv[][2], const int tot)
{
int i;
- int side = (SIDE_OF_LINE(uv[tot-1], uv[0], pt) > 0.0f);
+ int side = (line_point_side_v2(uv[tot-1], uv[0], pt) > 0.0f);
for (i=1; i<tot; i++) {
- if ((SIDE_OF_LINE(uv[i-1], uv[i], pt) > 0.0f) != side)
+ if ((line_point_side_v2(uv[i-1], uv[i], pt) > 0.0f) != side)
return 0;
}
@@ -2652,7 +2650,7 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index
* calculated when it might not be needed later, (at the moment at least)
* obviously it shouldn't have bugs though */
-static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max[2], int bucket_x, int bucket_y, int bucket_index, const MFace *mf)
+static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MFace *mf)
{
/* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */
rctf bucket_bounds;
@@ -2712,11 +2710,11 @@ static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max
/* Add faces to the bucket but dont initialize its pixels
* TODO - when painting occluded, sort the faces on their min-Z and only add faces that faces that are not occluded */
-static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const MTFace *tf, const int face_index)
+static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const int face_index)
{
float min[2], max[2], *vCoSS;
int bucketMin[2], bucketMax[2]; /* for ps->bucketRect indexing */
- int fidx, bucket_x, bucket_y, bucket_index;
+ int fidx, bucket_x, bucket_y;
int has_x_isect = -1, has_isect = 0; /* for early loop exit */
MemArena *arena = ps->arena_mt[0]; /* just use the first thread arena since threading has not started yet */
@@ -2733,10 +2731,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf,
for (bucket_y = bucketMin[1]; bucket_y < bucketMax[1]; bucket_y++) {
has_x_isect = 0;
for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) {
-
- bucket_index = bucket_x + (bucket_y * ps->buckets_x);
-
- if (project_bucket_face_isect(ps, min, max, bucket_x, bucket_y, bucket_index, mf)) {
+ if (project_bucket_face_isect(ps, bucket_x, bucket_y, mf)) {
+ int bucket_index= bucket_x + (bucket_y * ps->buckets_x);
BLI_linklist_prepend_arena(
&ps->bucketFaces[ bucket_index ],
SET_INT_IN_POINTER(face_index), /* cast to a pointer to shut up the compiler */
@@ -3194,7 +3190,7 @@ static void project_paint_begin(ProjPaintState *ps)
}
}
else {
- if (SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) < 0.0f) {
+ if (line_point_side_v2(v1coSS, v2coSS, v3coSS) < 0.0f) {
continue;
}
@@ -3217,7 +3213,7 @@ static void project_paint_begin(ProjPaintState *ps)
if (image_index != -1) {
/* Initialize the faces screen pixels */
/* Add this to a list to initialize later */
- project_paint_delayed_face_init(ps, mf, tf, face_index);
+ project_paint_delayed_face_init(ps, mf, face_index);
}
}
}
@@ -3500,7 +3496,7 @@ static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf
project_bucket_bounds(ps, ps->context_bucket_x, ps->context_bucket_y, bucket_bounds);
if ( (ps->source != PROJ_SRC_VIEW) ||
- project_bucket_isect_circle(ps->context_bucket_x, ps->context_bucket_y, mval, (float)(diameter*diameter), bucket_bounds)
+ project_bucket_isect_circle(mval, (float)(diameter*diameter), bucket_bounds)
) {
*bucket_index = ps->context_bucket_x + (ps->context_bucket_y * ps->buckets_x);
ps->context_bucket_x++;
@@ -3569,7 +3565,7 @@ static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, c
cp[3]= alpha > 255 ? 255 : alpha;
}
-static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask)
+static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask)
{
if (ps->is_airbrush==0 && mask < 1.0f) {
projPixel->newColor.uint = IMB_blend_color(projPixel->newColor.uint, ((ProjPixelClone*)projPixel)->clonepx.uint, (int)(alpha*255), ps->blend);
@@ -3580,7 +3576,7 @@ static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, floa
}
}
-static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask)
+static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask)
{
if (ps->is_airbrush==0 && mask < 1.0f) {
IMB_blend_color_float(projPixel->newColor.f, projPixel->newColor.f, ((ProjPixelClone *)projPixel)->clonepx.f, alpha, ps->blend);
@@ -3597,7 +3593,7 @@ static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, fl
* accumulation of color greater then 'projPixel->mask' however in the case of smear its not
* really that important to be correct as it is with clone and painting
*/
-static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2])
+static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2])
{
unsigned char rgba_ub[4];
@@ -3608,7 +3604,7 @@ static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, floa
BLI_linklist_prepend_arena(smearPixels, (void *)projPixel, smearArena);
}
-static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2])
+static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2])
{
unsigned char rgba_ub[4];
unsigned char rgba_smear[4];
@@ -3757,6 +3753,7 @@ static void *do_projectpaint_thread(void *ph_v)
if (falloff > 0.0f) {
if (ps->is_texbrush) {
+ /* note, for clone and smear, we only use the alpha, could be a special function */
brush_sample_tex(ps->brush, projPixel->projCoSS, rgba, thread_index);
alpha = rgba[3];
} else {
@@ -3808,20 +3805,20 @@ static void *do_projectpaint_thread(void *ph_v)
case PAINT_TOOL_CLONE:
if (is_floatbuf) {
if (((ProjPixelClone *)projPixel)->clonepx.f[3]) {
- do_projectpaint_clone_f(ps, projPixel, rgba, alpha, mask);
+ do_projectpaint_clone_f(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */
}
}
else {
if (((ProjPixelClone*)projPixel)->clonepx.ch[3]) {
- do_projectpaint_clone(ps, projPixel, rgba, alpha, mask);
+ do_projectpaint_clone(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */
}
}
break;
case PAINT_TOOL_SMEAR:
sub_v2_v2v2(co, projPixel->projCoSS, pos_ofs);
- if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels_f, co);
- else do_projectpaint_smear(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels, co);
+ if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, alpha, mask, smearArena, &smearPixels_f, co);
+ else do_projectpaint_smear(ps, projPixel, alpha, mask, smearArena, &smearPixels, co);
break;
default:
if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, rgba, alpha, mask);
@@ -3861,7 +3858,7 @@ static void *do_projectpaint_thread(void *ph_v)
return NULL;
}
-static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *pos)
+static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, float *pos)
{
/* First unpack args from the struct */
ProjPaintState *ps = (ProjPaintState *)state;
@@ -3928,7 +3925,7 @@ static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *po
}
-static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *prevmval_i, int *mval_i, double time, float pressure)
+static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *UNUSED(prevmval_i), int *mval_i, double time, float pressure)
{
/* Use mouse coords as floats for projection painting */
@@ -4194,7 +4191,7 @@ static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos)
/* note: allocImbuf returns zero'd memory, so regions outside image will
have zero alpha, and hence not be blended onto the image */
int w=ibufb->x, h=ibufb->y, destx=0, desty=0, srcx=pos[0], srcy=pos[1];
- ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags, 0);
+ ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags);
IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h);
IMB_rectblend(clonebuf, ibuf, destx, desty, srcx, srcy, w, h,
@@ -4387,7 +4384,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
ibuf= BKE_image_get_ibuf(newimage, s->sima? &s->sima->iuser: NULL);
if(ibuf && ibuf->rect)
- imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, mval, newuv);
+ imapaint_pick_uv(s->scene, s->ob, newfaceindex, mval, newuv);
else {
newimage = NULL;
newuv[0] = newuv[1] = 0.0f;
@@ -4398,8 +4395,8 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
/* see if stroke is broken, and if so finish painting in old position */
if (s->image) {
- imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv);
- imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, prevmval, bkuv);
+ imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv);
+ imapaint_pick_uv(s->scene, s->ob, newfaceindex, prevmval, bkuv);
if (newimage == s->image)
breakstroke= texpaint_break_stroke(s->uv, fwuv, bkuv, newuv);
@@ -4410,7 +4407,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
fwuv[0]= fwuv[1]= 0.0f;
if (breakstroke) {
- imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv);
+ imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv);
redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint,
fwuv, time, 1, pressure);
imapaint_clear_partial_redraw();
@@ -4923,7 +4920,7 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
/************************ cursor drawing *******************************/
-static void brush_drawcursor(bContext *C, int x, int y, void *customdata)
+static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata))
{
Brush *brush= image_paint_brush(C);
Paint *paint= paint_get_active(CTX_data_scene(C));
@@ -4989,10 +4986,10 @@ static int paint_radial_control_exec(bContext *C, wmOperator *op)
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint);
float zoom;
int ret;
- char str[256];
+ char str[64];
get_imapaint_zoom(C, &zoom, &zoom);
ret = brush_radial_control_exec(op, brush, 1.0f / zoom);
- WM_radial_control_string(op, str, 256);
+ WM_radial_control_string(op, str, sizeof(str));
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
@@ -5087,7 +5084,7 @@ static int grab_clone_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int grab_clone_cancel(bContext *C, wmOperator *op)
+static int grab_clone_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
return OPERATOR_CANCELLED;
@@ -5336,8 +5333,8 @@ static int texture_paint_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint);
int ret = brush_radial_control_exec(op, brush, 1);
- char str[256];
- WM_radial_control_string(op, str, 256);
+ char str[64];
+ WM_radial_control_string(op, str, sizeof(str));
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 6c1e933f9e8..68599dfcda2 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -164,7 +164,7 @@ void PAINT_OT_image_from_view(struct wmOperatorType *ot);
/* paint_utils.c */
int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index);
-void imapaint_pick_uv(struct Scene *scene, struct Object *ob, struct Mesh *mesh, unsigned int faceindex, int *xy, float *uv);
+void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, int *xy, float *uv);
void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);
void BRUSH_OT_curve_preset(struct wmOperatorType *ot);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 39bae3c1153..b190398037d 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -43,7 +43,7 @@
//#include <stdio.h>
/* Brush operators */
-static int brush_add_exec(bContext *C, wmOperator *op)
+static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
{
/*int type = RNA_enum_get(op->ptr, "type");*/
Paint *paint = paint_get_active(CTX_data_scene(C));
@@ -130,7 +130,7 @@ void BRUSH_OT_scale_size(wmOperatorType *ot)
RNA_def_float(ot->srna, "scalar", 1, 0, 2, "Scalar", "Factor to scale brush size by", 0, 2);
}
-static int vertex_color_set_exec(bContext *C, wmOperator *op)
+static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
@@ -155,7 +155,7 @@ void PAINT_OT_vertex_color_set(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int brush_reset_exec(bContext *C, wmOperator *op)
+static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
{
Paint *paint = paint_get_active(CTX_data_scene(C));
struct Brush *brush = paint_brush(paint);
@@ -309,7 +309,7 @@ static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *path)
RNA_int_set(kmi->ptr, "value", 19);
}
-static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *path)
+static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path))
{
wmKeyMapItem *kmi;
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 576d4b64b05..50d1286042b 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -291,7 +291,7 @@ static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
snap->winy = vc->ar->winy;
}
-int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
+static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
{
static GLuint overlay_texture = 0;
static int init = 0;
@@ -306,8 +306,12 @@ int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
int j;
int refresh;
+#ifndef _OPENMP
+ (void)sd; /* quied unused warning */
+#endif
+
if (br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED && !br->mtex.tex) return 0;
-
+
refresh =
!overlay_texture ||
(br->mtex.tex &&
diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c
index 6dc406005f9..72f42aa1d3c 100644
--- a/source/blender/editors/sculpt_paint/paint_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_undo.c
@@ -36,6 +36,7 @@
#include "BKE_mesh.h"
#include "BLI_string.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_global.h"
@@ -69,13 +70,13 @@ static UndoStack MeshUndoStack = {UNDO_PAINT_MESH, {NULL, NULL}, NULL};
/* Generic */
-static void undo_restore(bContext *C, UndoStack *stack, UndoElem *uel)
+static void undo_restore(bContext *C, UndoStack *UNUSED(stack), UndoElem *uel)
{
if(uel && uel->restore)
uel->restore(C, &uel->elems);
}
-static void undo_elem_free(UndoStack *stack, UndoElem *uel)
+static void undo_elem_free(UndoStack *UNUSED(stack), UndoElem *uel)
{
if(uel && uel->free) {
uel->free(&uel->elems);
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index d8bef04f82a..42c56424df4 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -103,7 +103,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl
}
/* compute uv coordinates of mouse in face */
-void imapaint_pick_uv(Scene *scene, Object *ob, Mesh *mesh, unsigned int faceindex, int *xy, float *uv)
+void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, int *xy, float *uv)
{
DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
@@ -248,7 +248,7 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot)
/* face-select ops */
-static int paint_select_linked_exec(bContext *C, wmOperator *op)
+static int paint_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
select_linked_tfaces(C, CTX_data_active_object(C), NULL, 2);
ED_region_tag_redraw(CTX_wm_region(C));
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 426cd09dcde..b12767d46ad 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -578,7 +578,7 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float
/* else */
/* sets wp->weight to the closest weight value to vertex */
/* note: we cant sample frontbuf, weight colors are interpolated too unpredictable */
-void sample_wpaint(Scene *scene, ARegion *ar, View3D *v3d, int mode)
+void sample_wpaint(Scene *scene, ARegion *ar, View3D *UNUSED(v3d), int mode)
{
ViewContext vc;
ToolSettings *ts= scene->toolsettings;
@@ -787,7 +787,7 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index,
/* *************** set wpaint operator ****************** */
-static int set_wpaint(bContext *C, wmOperator *op) /* toggle */
+static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */
{
Object *ob= CTX_data_active_object(C);
Scene *scene= CTX_data_scene(C);
@@ -982,7 +982,7 @@ struct WPaintData {
char *vgroup_validmap; /*stores if vgroups tie to deforming bones or not*/
};
-static char *wpaint_make_validmap(Mesh *me, Object *ob)
+static char *wpaint_make_validmap(Object *ob)
{
bDeformGroup *dg;
ModifierData *md;
@@ -1040,7 +1040,7 @@ static char *wpaint_make_validmap(Mesh *me, Object *ob)
return validmap;
}
-static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event)
+static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene= CTX_data_scene(C);
struct PaintStroke *stroke = op->customdata;
@@ -1070,7 +1070,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event)
vgroups affect deform bones*/
wpd->auto_normalize = ts->auto_normalize;
if (wpd->auto_normalize)
- wpd->vgroup_validmap = wpaint_make_validmap(me, ob);
+ wpd->vgroup_validmap = wpaint_make_validmap(ob);
// if(qual & LR_CTRLKEY) {
// sample_wpaint(scene, ar, v3d, 0);
@@ -1389,7 +1389,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot)
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
}
-static int weight_paint_set_exec(bContext *C, wmOperator *op)
+static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op))
{
struct Scene *scene= CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
@@ -1502,7 +1502,7 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op)
Mesh *me= ob->data;
int type= RNA_enum_get(op->ptr, "type");
- create_vgroups_from_armature(scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
+ create_vgroups_from_armature(op->reports, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
DAG_id_flush_update(&me->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index ed2251cea38..7ddb42fa51a 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -370,7 +370,7 @@ static float get_texcache_pixel_bilinear(const SculptSession *ss, float u, float
#endif
-static float tex_strength(SculptSession *ss, Brush *br, float *co,
+static float tex_strength(SculptSession *ss, Brush *UNUSED(br), float *co,
float mask, float dist)
{
return paint_stroke_combined_strength(ss->cache->stroke, dist, co, mask);
@@ -408,6 +408,8 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
float out_flip[3] = {0.0f, 0.0f, 0.0f};
+ (void)sd; /* unused w/o openmp */
+
zero_v3(an);
#pragma omp parallel for schedule(guided) if (sd->paint.flags & PAINT_USE_OPENMP)
@@ -1229,6 +1231,8 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
float count = 0;
+ (void)sd; /* unused w/o openmp */
+
zero_v3(fc);
#pragma omp parallel for schedule(guided) if (sd->paint.flags & PAINT_USE_OPENMP)
@@ -1284,6 +1288,8 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob, PBVHNode
// fc
float count = 0;
+ (void)sd; /* unused w/o openmp */
+
// an
zero_v3(an);
@@ -2384,7 +2390,7 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
cache->vertex_rotation= 0;
}
-static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
+static void sculpt_update_brush_delta(Object *ob, Brush *brush)
{
SculptSession *ss = ob->paint->sculpt;
StrokeCache *cache = ss->cache;
@@ -2463,7 +2469,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession
/* Truly temporary data that isn't stored in properties */
- sculpt_update_brush_delta(sd, ob, brush);
+ sculpt_update_brush_delta(ob, brush);
if(brush->sculpt_tool == SCULPT_TOOL_ROTATE) {
float mouse[2], initial_mouse[2];
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index fe1fe3266bc..18f35502f8b 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -280,7 +280,7 @@ static int unpack_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Editing* ed = CTX_data_scene(C)->ed;
bSound* sound;
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index d2067790b2f..ce9a96af38c 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -63,7 +63,7 @@
/* Channel List */
/* left hand part */
-void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARegion *ar)
+void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -90,8 +90,8 @@ void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARe
*/
v2d->tot.ymin= (float)(-height);
}
- /* need to do a view-sync here, so that the keys area doesn't jump around */
- UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL);
+ /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
+ UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY);
/* loop through channels, and set up drawing depending on their type */
{ /* first pass: just the standard GL-drawing for backdrop + text */
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 916b0032f17..b0704e76138 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -70,7 +70,7 @@
/* ******************** New Action Operator *********************** */
-static int act_new_exec(bContext *C, wmOperator *op)
+static int act_new_exec(bContext *C, wmOperator *UNUSED(op))
{
bAction *action;
PointerRNA ptr, idptr;
@@ -173,7 +173,7 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max)
/* ****************** Automatic Preview-Range Operator ****************** */
-static int actkeys_previewrange_exec(bContext *C, wmOperator *op)
+static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
Scene *scene;
@@ -217,7 +217,7 @@ void ACTION_OT_previewrange_set (wmOperatorType *ot)
/* ****************** View-All Operator ****************** */
-static int actkeys_viewall_exec(bContext *C, wmOperator *op)
+static int actkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
View2D *v2d;
@@ -521,7 +521,7 @@ static void duplicate_action_keys (bAnimContext *ac)
/* ------------------- */
-static int actkeys_duplicate_exec(bContext *C, wmOperator *op)
+static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -541,7 +541,7 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED; // xxx - start transform
}
-static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
actkeys_duplicate_exec(C, op);
@@ -608,7 +608,7 @@ static void delete_action_keys (bAnimContext *ac)
/* ------------------- */
-static int actkeys_delete_exec(bContext *C, wmOperator *op)
+static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -734,7 +734,7 @@ static void sample_action_keys (bAnimContext *ac)
/* ------------------- */
-static int actkeys_sample_exec(bContext *C, wmOperator *op)
+static int actkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -791,7 +791,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting mode per F-Curve */
@@ -1096,7 +1096,7 @@ void ACTION_OT_keyframe_type (wmOperatorType *ot)
/* ***************** Jump to Selected Frames Operator *********************** */
/* snap current-frame indicator to 'average time' of selected keyframe */
-static int actkeys_framejump_exec(bContext *C, wmOperator *op)
+static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
ListBase anim_data= {NULL, NULL};
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index b02e95ac138..cc363b76479 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -41,7 +41,7 @@ struct bAnimListElem;
/* ***************************************** */
/* action_draw.c */
-void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar);
+void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar);
void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar);
struct ActKeysInc *init_aki_data(struct bAnimContext *ac, struct bAnimListElem *ale);
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index b2c47194384..11b6123dbbb 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -551,7 +551,7 @@ void ACTION_OT_select_column (wmOperatorType *ot)
/* ******************** Select Linked Operator *********************** */
-static int actkeys_select_linked_exec (bContext *C, wmOperator *op)
+static int actkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -650,7 +650,7 @@ static void select_moreless_action_keys (bAnimContext *ac, short mode)
/* ----------------- */
-static int actkeys_select_more_exec (bContext *C, wmOperator *op)
+static int actkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -684,7 +684,7 @@ void ACTION_OT_select_more (wmOperatorType *ot)
/* ----------------- */
-static int actkeys_select_less_exec (bContext *C, wmOperator *op)
+static int actkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -990,7 +990,7 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode,
}
else if (ale->type == ANIMTYPE_GPLAYER) {
struct bGPDlayer *gpl= (struct bGPDlayer *)ale->data;
- gpl_to_keylist(ads, gpl, &anim_keys, NULL);
+ gpl_to_keylist(ads, gpl, &anim_keys);
}
/* loop through keyframes, finding one that was within the range clicked on */
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 7b96618d923..bb3b40fbf9b 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -101,16 +101,17 @@ static SpaceLink *action_new(const bContext *C)
ar->v2d.cur = ar->v2d.tot;
ar->v2d.min[0]= 0.0f;
- ar->v2d.min[1]= 0.0f;
+ ar->v2d.min[1]= 0.0f;
ar->v2d.max[0]= MAXFRAMEF;
- ar->v2d.max[1]= FLT_MAX;
+ ar->v2d.max[1]= FLT_MAX;
ar->v2d.minzoom= 0.01f;
ar->v2d.maxzoom= 50;
ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
+ ar->v2d.keepofs= V2D_KEEPOFS_Y;
ar->v2d.align= V2D_ALIGN_NO_POS_Y;
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
@@ -118,7 +119,7 @@ static SpaceLink *action_new(const bContext *C)
}
/* not spacelink itself */
-static void action_free(SpaceLink *sl)
+static void action_free(SpaceLink *UNUSED(sl))
{
// SpaceAction *saction= (SpaceAction*) sl;
@@ -126,7 +127,7 @@ static void action_free(SpaceLink *sl)
/* spacetype; init callback */
-static void action_init(struct wmWindowManager *wm, ScrArea *sa)
+static void action_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
SpaceAction *saction = sa->spacedata.first;
saction->flag |= SACTION_TEMP_NEEDCHANSYNC;
@@ -169,12 +170,12 @@ static void action_main_area_draw(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* time grid */
unit= (saction->flag & SACTION_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES;
- grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
- UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL);
+ grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
+ UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL);
UI_view2d_grid_free(grid);
/* data */
@@ -188,11 +189,11 @@ static void action_main_area_draw(const bContext *C, ARegion *ar)
ANIM_draw_cfra(C, v2d, flag);
/* markers */
- UI_view2d_view_orthoSpecial(C, v2d, 1);
+ UI_view2d_view_orthoSpecial(ar, v2d, 1);
draw_markers_time(C, 0);
/* preview range */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
ANIM_draw_previewrange(C, v2d);
/* reset view matrix */
@@ -219,7 +220,6 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar)
static void action_channel_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- SpaceAction *saction= CTX_wm_space_action(C);
bAnimContext ac;
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
@@ -228,11 +228,11 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
- draw_channel_names((bContext *)C, &ac, saction, ar);
+ draw_channel_names((bContext *)C, &ac, ar);
}
/* reset view matrix */
@@ -246,7 +246,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar)
/* add handlers, stuff you only do once or on area/region changes */
-static void action_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void action_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
@@ -417,7 +417,7 @@ static void action_header_area_listener(ARegion *ar, wmNotifier *wmn)
static void action_refresh(const bContext *C, ScrArea *sa)
{
- SpaceAction *saction= CTX_wm_space_action(C);
+ SpaceAction *saction= (SpaceAction *)sa->spacedata.first;
/* update the state of the animchannels in response to changes from the data they represent
* NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 2140c59da67..0d0d3713723 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -30,6 +30,7 @@
#include "DNA_object_types.h"
#include "DNA_windowmanager_types.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -224,19 +225,19 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type)
/* ********************* space template *********************** */
/* allocate and init some vars */
-static SpaceLink *xxx_new(const bContext *C)
+static SpaceLink *xxx_new(const bContext *UNUSED(C))
{
return NULL;
}
/* not spacelink itself */
-static void xxx_free(SpaceLink *sl)
+static void xxx_free(SpaceLink *UNUSED(sl))
{
}
/* spacetype; init callback for usage, should be redoable */
-static void xxx_init(wmWindowManager *wm, ScrArea *sa)
+static void xxx_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
/* link area to SpaceXXX struct */
@@ -246,7 +247,7 @@ static void xxx_init(wmWindowManager *wm, ScrArea *sa)
/* add types to regions */
}
-static SpaceLink *xxx_duplicate(SpaceLink *sl)
+static SpaceLink *xxx_duplicate(SpaceLink *UNUSED(sl))
{
return NULL;
@@ -257,7 +258,7 @@ static void xxx_operatortypes(void)
/* register operator types for this space */
}
-static void xxx_keymap(wmKeyConfig *keyconf)
+static void xxx_keymap(wmKeyConfig *UNUSED(keyconf))
{
/* add default items to keymap */
}
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 343237dee5e..2d16bb6bc81 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -323,7 +323,7 @@ static int buttons_context_path_particle(ButsContextPath *path)
return 0;
}
-static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
+static int buttons_context_path_brush(ButsContextPath *path)
{
Scene *scene;
Brush *br= NULL;
@@ -352,7 +352,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
return 0;
}
-static int buttons_context_path_texture(const bContext *C, ButsContextPath *path)
+static int buttons_context_path_texture(ButsContextPath *path)
{
Material *ma;
Lamp *la;
@@ -367,7 +367,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
return 1;
}
/* try brush */
- if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(C, path)) {
+ if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(path)) {
br= path->ptr[path->len-1].data;
if(br) {
@@ -416,7 +416,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
}
/* try brushes again in case of no material, lamp, etc */
path->len = orig_len;
- if(buttons_context_path_brush(C, path)) {
+ if(buttons_context_path_brush(path)) {
br= path->ptr[path->len-1].data;
if(br) {
@@ -485,7 +485,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
found= buttons_context_path_material(path);
break;
case BCONTEXT_TEXTURE:
- found= buttons_context_path_texture(C, path);
+ found= buttons_context_path_texture(path);
break;
case BCONTEXT_BONE:
found= buttons_context_path_bone(path);
@@ -515,7 +515,7 @@ static int buttons_shading_context(const bContext *C, int mainb)
return 0;
}
-static int buttons_shading_new_context(const bContext *C, int flag, int mainb)
+static int buttons_shading_new_context(const bContext *C, int flag)
{
Object *ob= CTX_data_active_object(C);
@@ -568,7 +568,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
if((flag & (1 << sbuts->mainb)) == 0) {
if(sbuts->flag & SB_SHADING_CONTEXT) {
/* try to keep showing shading related buttons */
- sbuts->mainb= buttons_shading_new_context(C, flag, sbuts->mainb);
+ sbuts->mainb= buttons_shading_new_context(C, flag);
}
else if(flag & BCONTEXT_OBJECT) {
sbuts->mainb= BCONTEXT_OBJECT;
@@ -821,7 +821,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
/************************* Drawing the Path ************************/
-static void pin_cb(bContext *C, void *arg1, void *arg2)
+static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
SpaceButs *sbuts= CTX_wm_space_buts(C);
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index ab756b638fa..9071d9f27d9 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -33,6 +33,7 @@
#include "BLI_blenlib.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "ED_screen.h"
@@ -50,7 +51,7 @@
#define B_CONTEXT_SWITCH 101
#define B_BUTSPREVIEW 102
-static void do_buttons_buttons(bContext *C, void *arg, int event)
+static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
{
SpaceButs *sbuts= CTX_wm_space_buts(C);
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index c1803dde805..e72446366fe 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -39,6 +39,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -53,7 +54,7 @@
/********************** toolbox operator *********************/
-static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
bScreen *sc= CTX_wm_screen(C);
SpaceButs *sbuts= CTX_wm_space_buts(C);
@@ -104,7 +105,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
/* add slash for directories, important for some properties */
if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
id = fbo->ptr.id.data;
- base = (id && id->lib)? id->lib->filepath: G.sce;
+ base = (id && id->lib)? id->lib->filepath: G.main->name;
BLI_strncpy(path, str, FILE_MAX);
BLI_path_abs(path, base);
@@ -123,7 +124,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int file_browse_cancel(bContext *C, wmOperator *op)
+static int file_browse_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata= NULL;
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index fcd66c43321..44138119f7a 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -55,7 +55,7 @@
/* ******************** default callbacks for buttons space ***************** */
-static SpaceLink *buttons_new(const bContext *C)
+static SpaceLink *buttons_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceButs *sbuts;
@@ -103,7 +103,7 @@ static void buttons_free(SpaceLink *sl)
}
/* spacetype; init callback */
-static void buttons_init(struct wmWindowManager *wm, ScrArea *sa)
+static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
SpaceButs *sbuts= sa->spacedata.first;
@@ -191,7 +191,7 @@ void buttons_keymap(struct wmKeyConfig *keyconf)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void buttons_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
}
@@ -203,7 +203,7 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
- UI_view2d_view_ortho(C, &ar->v2d);
+ UI_view2d_view_ortho(&ar->v2d);
buttons_header_buttons(C, ar);
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index d1fa4e17e6f..edbb539e836 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -133,7 +133,7 @@ typedef struct ConsoleDrawContext {
int draw;
} ConsoleDrawContext;
-static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int console_width, int lheight)
+static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight)
{
if(sel[0] <= str_len_draw && sel[1] >= 0) {
int sta = MAX2(sel[0], 0);
@@ -222,7 +222,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len,
if(cdc->sel[0] != cdc->sel[1]) {
STEP_SEL(-initial_offset);
// glColor4ub(255, 0, 0, 96); // debug
- console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->console_width, cdc->lheight);
+ console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight);
STEP_SEL(cdc->console_width);
glColor3ubv(fg);
}
@@ -240,7 +240,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len,
if(cdc->sel[0] != cdc->sel[1]) {
// glColor4ub(0, 255, 0, 96); // debug
- console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->console_width, cdc->lheight);
+ console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight);
STEP_SEL(cdc->console_width);
glColor3ubv(fg);
}
@@ -272,7 +272,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len,
if(cdc->sel[0] != cdc->sel[1]) {
int isel[2]= {str_len - cdc->sel[1], str_len - cdc->sel[0]};
// glColor4ub(255, 255, 0, 96); // debug
- console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->console_width, cdc->lheight);
+ console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight);
STEP_SEL(-(str_len + 1));
}
@@ -286,6 +286,24 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len,
#undef STEP_SEL
}
+void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy)
+{
+ /* fake the edit line being in the scroll buffer */
+ ConsoleLine *cl= sc->history.last;
+ cl_dummy->type= CONSOLE_LINE_INPUT;
+ cl_dummy->len= cl_dummy->len_alloc= strlen(sc->prompt) + cl->len;
+ cl_dummy->len_alloc= cl_dummy->len + 1;
+ cl_dummy->line= MEM_mallocN(cl_dummy->len_alloc, "cl_dummy");
+ memcpy(cl_dummy->line, sc->prompt, (cl_dummy->len_alloc - cl->len));
+ memcpy(cl_dummy->line + ((cl_dummy->len_alloc - cl->len)) - 1, cl->line, cl->len + 1);
+ BLI_addtail(&sc->scrollback, cl_dummy);
+}
+void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dummy)
+{
+ MEM_freeN(cl_dummy->line);
+ BLI_remlink(&sc->scrollback, cl_dummy);
+}
+
#define CONSOLE_DRAW_MARGIN 4
#define CONSOLE_DRAW_SCROLL 16
@@ -349,15 +367,7 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *
xy[0]= x_orig; /* remove prompt offset */
}
- /* fake the edit line being in the scroll buffer */
- cl_dummy.type= CONSOLE_LINE_INPUT;
- cl_dummy.len= cl_dummy.len_alloc= prompt_len + cl->len;
- cl_dummy.len_alloc= cl_dummy.len + 1;
- cl_dummy.line= MEM_mallocN(cl_dummy.len_alloc, "cl_dummy");
- memcpy(cl_dummy.line, sc->prompt, (cl_dummy.len_alloc - cl->len));
- memcpy(cl_dummy.line + ((cl_dummy.len_alloc - cl->len)) - 1, cl->line, cl->len + 1);
- BLI_addtail(&sc->scrollback, &cl_dummy);
-
+ console_scrollback_prompt_begin(sc, &cl_dummy);
for(cl= sc->scrollback.last; cl; cl= cl->prev) {
y_prev= xy[1];
@@ -378,9 +388,7 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *
}
}
- /* temp line end */
- MEM_freeN(cl_dummy.line);
- BLI_remlink(&sc->scrollback, &cl_dummy);
+ console_scrollback_prompt_end(sc, &cl_dummy);
}
else {
Report *report;
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index c74d39f25e3..1a48dd408bd 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -41,11 +41,14 @@ int console_text_height(struct SpaceConsole *sc, struct ARegion *ar, struct Repo
void *console_text_pick(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports, int mouse_y); /* needed for selection */
int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports, int mval[2]);
+void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy);
+void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dummy);
+
/* console_ops.c */
void console_history_free(SpaceConsole *sc, ConsoleLine *cl);
void console_scrollback_free(SpaceConsole *sc, ConsoleLine *cl);
-ConsoleLine *console_history_add_str(const struct bContext *C, char *str, int own);
-ConsoleLine *console_scrollback_add_str(const struct bContext *C, char *str, int own);
+ConsoleLine *console_history_add_str(struct SpaceConsole *sc, char *str, int own);
+ConsoleLine *console_scrollback_add_str(struct SpaceConsole *sc, char *str, int own);
ConsoleLine *console_history_verify(const struct bContext *C);
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index a49581cb417..2b419b0a833 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -194,7 +194,7 @@ static ConsoleLine *console_scrollback_add(const bContext *C, ConsoleLine *from)
}
#endif
-static ConsoleLine *console_lb_add_str__internal(ListBase *lb, const bContext *C, char *str, int own)
+static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, int own)
{
ConsoleLine *ci= MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
if(own) ci->line= str;
@@ -205,14 +205,13 @@ static ConsoleLine *console_lb_add_str__internal(ListBase *lb, const bContext *C
BLI_addtail(lb, ci);
return ci;
}
-ConsoleLine *console_history_add_str(const bContext *C, char *str, int own)
+ConsoleLine *console_history_add_str(SpaceConsole *sc, char *str, int own)
{
- return console_lb_add_str__internal(&CTX_wm_space_console(C)->history, C, str, own);
+ return console_lb_add_str__internal(&sc->history, str, own);
}
-ConsoleLine *console_scrollback_add_str(const bContext *C, char *str, int own)
+ConsoleLine *console_scrollback_add_str(SpaceConsole *sc, char *str, int own)
{
- SpaceConsole *sc= CTX_wm_space_console(C);
- ConsoleLine *ci= console_lb_add_str__internal(&sc->scrollback, C, str, own);
+ ConsoleLine *ci= console_lb_add_str__internal(&sc->scrollback, str, own);
console_select_offset(sc, ci->len + 1);
return ci;
}
@@ -403,8 +402,13 @@ static int insert_exec(bContext *C, wmOperator *op)
static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!RNA_property_is_set(op->ptr, "text")) {
+ // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
+ if(!RNA_string_length(op->ptr, "text")) {
char str[2] = {event->ascii, '\0'};
+ /* if alt/ctrl/super are pressed pass through */
+ if(event->ctrl || event->oskey)
+ return OPERATOR_PASS_THROUGH;
+
RNA_string_set(op->ptr, "text", str);
}
return insert_exec(C, op);
@@ -622,7 +626,7 @@ static int history_append_exec(bContext *C, wmOperator *op)
}
}
- ci= console_history_add_str(C, str, 1); /* own the string */
+ ci= console_history_add_str(sc, str, 1); /* own the string */
console_select_offset(sc, ci->len - prev_len);
console_line_cursor_set(ci, cursor);
@@ -658,7 +662,7 @@ static int scrollback_append_exec(bContext *C, wmOperator *op)
char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */
int type= RNA_enum_get(op->ptr, "type");
- ci= console_scrollback_add_str(C, str, 1); /* own the string */
+ ci= console_scrollback_add_str(sc, str, 1); /* own the string */
ci->type= type;
console_scrollback_limit(sc);
@@ -693,7 +697,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
}
-static int copy_exec(bContext *C, wmOperator *op)
+static int copy_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc= CTX_wm_space_console(C);
int buf_len;
@@ -705,6 +709,8 @@ static int copy_exec(bContext *C, wmOperator *op)
int sel[2];
int offset= 0;
+ ConsoleLine cl_dummy= {0};
+
#if 0
/* copy whole file */
for(cl= sc->scrollback.first; cl; cl= cl->next) {
@@ -716,14 +722,16 @@ static int copy_exec(bContext *C, wmOperator *op)
if(sc->sel_start == sc->sel_end)
return OPERATOR_CANCELLED;
+ console_scrollback_prompt_begin(sc, &cl_dummy);
for(cl= sc->scrollback.first; cl; cl= cl->next) {
offset += cl->len + 1;
}
- if(offset==0)
+ if(offset==0) {
+ console_scrollback_prompt_end(sc, &cl_dummy);
return OPERATOR_CANCELLED;
-
+ }
offset -= 1;
sel[0]= offset - sc->sel_end;
@@ -750,6 +758,9 @@ static int copy_exec(bContext *C, wmOperator *op)
WM_clipboard_text_set(buf_str, 0);
MEM_freeN(buf_str);
+
+ console_scrollback_prompt_end(sc, &cl_dummy);
+
return OPERATOR_FINISHED;
}
@@ -767,8 +778,9 @@ void CONSOLE_OT_copy(wmOperatorType *ot)
/* properties */
}
-static int paste_exec(bContext *C, wmOperator *op)
+static int paste_exec(bContext *C, wmOperator *UNUSED(op))
{
+ SpaceConsole *sc= CTX_wm_space_console(C);
ConsoleLine *ci= console_history_verify(C);
char *buf_str= WM_clipboard_text_get(0);
@@ -792,7 +804,7 @@ static int paste_exec(bContext *C, wmOperator *op)
ci= console_history_verify(C);
}
- console_line_insert(ci, buf_next);
+ console_select_offset(sc, console_line_insert(ci, buf_next));
}
MEM_freeN(buf_str);
@@ -821,7 +833,8 @@ typedef struct SetConsoleCursor {
int sel_init;
} SetConsoleCursor;
-static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int sel)
+// TODO, cursor placement without selection
+static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel))
{
int pos;
pos= console_char_pick(sc, ar, NULL, mval);
@@ -856,7 +869,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve
ED_area_tag_redraw(CTX_wm_area(C));
}
-static void set_cursor_exit(bContext *C, wmOperator *op)
+static void set_cursor_exit(bContext *UNUSED(C), wmOperator *op)
{
// SpaceConsole *sc= CTX_wm_space_console(C);
SetConsoleCursor *scu= op->customdata;
diff --git a/source/blender/editors/space_console/console_report.c b/source/blender/editors/space_console/console_report.c
index 51bffa5b981..6483177a045 100644
--- a/source/blender/editors/space_console/console_report.c
+++ b/source/blender/editors/space_console/console_report.c
@@ -72,7 +72,7 @@ static int console_report_poll(bContext *C)
return 1;
}
-static int report_replay_exec(bContext *C, wmOperator *op)
+static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc= CTX_wm_space_console(C);
ReportList *reports= CTX_wm_reports(C);
@@ -83,7 +83,7 @@ static int report_replay_exec(bContext *C, wmOperator *op)
for(report=reports->list.last; report; report=report->prev) {
if((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) {
- console_history_add_str(C, report->message, 0);
+ console_history_add_str(sc, report->message, 0);
WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL);
ED_area_tag_redraw(CTX_wm_area(C));
@@ -165,7 +165,7 @@ void CONSOLE_OT_select_pick(wmOperatorType *ot)
-static int report_select_all_toggle_exec(bContext *C, wmOperator *op)
+static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc= CTX_wm_space_console(C);
ReportList *reports= CTX_wm_reports(C);
@@ -314,7 +314,7 @@ void CONSOLE_OT_select_border(wmOperatorType *ot)
-static int report_delete_exec(bContext *C, wmOperator *op)
+static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc= CTX_wm_space_console(C);
ReportList *reports= CTX_wm_reports(C);
@@ -359,7 +359,7 @@ void CONSOLE_OT_report_delete(wmOperatorType *ot)
}
-static int report_copy_exec(bContext *C, wmOperator *op)
+static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc= CTX_wm_space_console(C);
ReportList *reports= CTX_wm_reports(C);
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index c30897bbb87..70263788b13 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -67,7 +67,7 @@ static void console_update_rect(const bContext *C, ARegion *ar)
/* ******************** default callbacks for console space ***************** */
-static SpaceLink *console_new(const bContext *C)
+static SpaceLink *console_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceConsole *sconsole;
@@ -121,7 +121,7 @@ static void console_free(SpaceLink *sl)
/* spacetype; init callback */
-static void console_init(struct wmWindowManager *wm, ScrArea *sa)
+static void console_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -162,7 +162,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
/* ************* dropboxes ************* */
-static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event))
{
SpaceConsole *sc= CTX_wm_space_console(C);
if(sc->type==CONSOLE_TYPE_PYTHON)
@@ -182,7 +182,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
RNA_string_set(drop->ptr, "text", text);
}
-static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event))
{
SpaceConsole *sc= CTX_wm_space_console(C);
if(sc->type==CONSOLE_TYPE_PYTHON)
@@ -227,7 +227,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
console_update_rect(C, ar);
/* worlks best with no view2d matrix set */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* data... */
@@ -361,7 +361,7 @@ void console_keymap(struct wmKeyConfig *keyconf)
/****************** header region ******************/
/* add handlers, stuff you only do once or on area/region changes */
-static void console_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void console_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 0f627bda3dc..65415d382ec 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -40,6 +40,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BLF_api.h"
@@ -79,7 +80,7 @@ enum {
} eFile_ButEvents;
-static void do_file_buttons(bContext *C, void *arg, int event)
+static void do_file_buttons(bContext *C, void *UNUSED(arg), int event)
{
switch(event) {
case B_FS_FILENAME:
@@ -433,7 +434,7 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
}
}
-static void renamebutton_cb(bContext *C, void *arg1, char *oldname)
+static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
{
char newname[FILE_MAX+12];
char orgname[FILE_MAX+12];
@@ -445,9 +446,9 @@ static void renamebutton_cb(bContext *C, void *arg1, char *oldname)
struct direntry *file = (struct direntry *)arg1;
#endif
- BLI_make_file_string(G.sce, orgname, sfile->params->dir, oldname);
+ BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname);
BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
- BLI_make_file_string(G.sce, newname, sfile->params->dir, filename);
+ BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
if( strcmp(orgname, newname) != 0 ) {
if (!BLI_exists(newname)) {
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index e9764a2d36a..1af8e9d14be 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -30,6 +30,7 @@
#include "BKE_screen.h"
#include "BKE_global.h"
#include "BKE_report.h"
+#include "BKE_main.h"
#include "BLI_blenlib.h"
#include "BLI_storage_types.h"
@@ -190,7 +191,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, short selecting, sh
/* avoids /../../ */
BLI_parent_dir(params->dir);
} else {
- BLI_cleanup_dir(G.sce, params->dir);
+ BLI_cleanup_dir(G.main->name, params->dir);
strcat(params->dir, file->relname);
BLI_add_slash(params->dir);
}
@@ -304,7 +305,7 @@ void FILE_OT_select(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "fill", 0, "Fill", "Select everything beginning with the last selection.");
}
-static int file_select_all_exec(bContext *C, wmOperator *op)
+static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -361,7 +362,7 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "dir", entry);
BLI_strncpy(params->dir, entry, sizeof(params->dir));
- BLI_cleanup_dir(G.sce, params->dir);
+ BLI_cleanup_dir(G.main->name, params->dir);
file_change_dir(C, 1);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
@@ -384,7 +385,7 @@ void FILE_OT_select_bookmark(wmOperatorType *ot)
RNA_def_string(ot->srna, "dir", "", 256, "Dir", "");
}
-static int bookmark_add_exec(bContext *C, wmOperator *op)
+static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -479,7 +480,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
return (params->active_file != origfile);
}
-static int file_highlight_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -504,7 +505,7 @@ void FILE_OT_highlight(struct wmOperatorType *ot)
ot->poll= ED_operator_file_active;
}
-int file_cancel_exec(bContext *C, wmOperator *unused)
+int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
wmOperator *op = sfile->op;
@@ -544,7 +545,7 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file);
if(RNA_struct_find_property(op->ptr, "relative_path")) {
if(RNA_boolean_get(op->ptr, "relative_path")) {
- BLI_path_rel(filepath, G.sce);
+ BLI_path_rel(filepath, G.main->name);
}
}
@@ -613,7 +614,7 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op)
/* XXX, files and dirs updates missing, not really so important though */
}
-void file_draw_check_cb(bContext *C, void *dummy1, void *dummy2)
+void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
SpaceFile *sfile= CTX_wm_space_file(C);
wmOperator *op= sfile->op;
@@ -680,7 +681,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
file_sfile_to_operator(op, sfile, filepath);
fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1);
- BLI_make_file_string(G.sce, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
+ BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
fsmenu_write_file(fsmenu_get(), filepath);
WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC);
@@ -704,14 +705,14 @@ void FILE_OT_execute(struct wmOperatorType *ot)
}
-int file_parent_exec(bContext *C, wmOperator *unused)
+int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
if(sfile->params) {
if (BLI_has_parent(sfile->params->dir)) {
BLI_parent_dir(sfile->params->dir);
- BLI_cleanup_dir(G.sce, sfile->params->dir);
+ BLI_cleanup_dir(G.main->name, sfile->params->dir);
file_change_dir(C, 0);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
}
@@ -735,7 +736,7 @@ void FILE_OT_parent(struct wmOperatorType *ot)
}
-int file_refresh_exec(bContext *C, wmOperator *unused)
+int file_refresh_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -759,7 +760,7 @@ void FILE_OT_previous(struct wmOperatorType *ot)
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
}
-int file_previous_exec(bContext *C, wmOperator *unused)
+int file_previous_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -790,7 +791,7 @@ void FILE_OT_next(struct wmOperatorType *ot)
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
}
-int file_next_exec(bContext *C, wmOperator *unused)
+int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
if(sfile->params) {
@@ -812,7 +813,7 @@ int file_next_exec(bContext *C, wmOperator *unused)
/* only meant for timer usage */
-static int file_smoothscroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -995,7 +996,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot)
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
}
-int file_directory_exec(bContext *C, wmOperator *unused)
+int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -1010,7 +1011,7 @@ int file_directory_exec(bContext *C, wmOperator *unused)
if (sfile->params->dir[0] == '\0')
get_default_root(sfile->params->dir);
#endif
- BLI_cleanup_dir(G.sce, sfile->params->dir);
+ BLI_cleanup_dir(G.main->name, sfile->params->dir);
BLI_add_slash(sfile->params->dir);
file_change_dir(C, 1);
@@ -1021,7 +1022,7 @@ int file_directory_exec(bContext *C, wmOperator *unused)
return OPERATOR_FINISHED;
}
-int file_filename_exec(bContext *C, wmOperator *unused)
+int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -1049,7 +1050,7 @@ void FILE_OT_refresh(struct wmOperatorType *ot)
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
}
-int file_hidedot_exec(bContext *C, wmOperator *unused)
+int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused))
{
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -1102,7 +1103,7 @@ struct ARegion *file_buttons_region(struct ScrArea *sa)
return arnew;
}
-int file_bookmark_toggle_exec(bContext *C, wmOperator *unused)
+int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= file_buttons_region(sa);
@@ -1158,7 +1159,7 @@ void FILE_OT_filenum(struct wmOperatorType *ot)
RNA_def_int(ot->srna, "increment", 1, 0, 100, "Increment", "", 0,100);
}
-int file_rename_exec(bContext *C, wmOperator *op)
+int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
@@ -1232,7 +1233,7 @@ int file_delete_poll(bContext *C)
return poll;
}
-int file_delete_exec(bContext *C, wmOperator *op)
+int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
char str[FILE_MAX];
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -1240,7 +1241,7 @@ int file_delete_exec(bContext *C, wmOperator *op)
file = filelist_file(sfile->files, sfile->params->active_file);
- BLI_make_file_string(G.sce, str, sfile->params->dir, file->relname);
+ BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname);
BLI_delete(str, 0, 0);
ED_fileselect_clear(C, sfile);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 33d740e18a6..9096b9eed27 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -49,7 +49,7 @@
#include <string.h>
-static void file_panel_cb(bContext *C, void *arg_entry, void *arg_unused)
+static void file_panel_cb(bContext *C, void *arg_entry, void *UNUSED(arg_v))
{
PointerRNA ptr;
char *entry= (char*)arg_entry;
@@ -151,7 +151,7 @@ static void file_panel_recent(const bContext *C, Panel *pa)
}
-static int file_panel_operator_poll(const bContext *C, PanelType *pt)
+static int file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceFile *sfile= CTX_wm_space_file(C);
return (sfile && sfile->op);
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index eba0df9f963..43d5d54805d 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -295,7 +295,7 @@ static int is_hidden_file(const char* filename, short hide_dot)
return is_hidden;
}
-static int is_filtered_file(struct direntry* file, const char* dir, unsigned int filter, short hide_dot)
+static int is_filtered_file(struct direntry* file, const char* UNUSED(dir), unsigned int filter, short hide_dot)
{
int is_filtered=0;
if (filter) {
@@ -324,7 +324,7 @@ static int is_filtered_lib(struct direntry* file, const char* dir, unsigned int
return is_filtered;
}
-static int is_filtered_main(struct direntry* file, const char* dir, unsigned int filter, short hide_dot)
+static int is_filtered_main(struct direntry* file, const char* UNUSED(dir), unsigned int UNUSED(filter), short hide_dot)
{
return !is_hidden_file(file->relname, hide_dot);
}
@@ -371,7 +371,7 @@ void filelist_init_icons()
for (x=0; x<SPECIAL_IMG_COLS; x++) {
int tile = SPECIAL_IMG_COLS*y + x;
if (tile < SPECIAL_IMG_MAX) {
- ibuf = IMB_allocImBuf(SPECIAL_IMG_SIZE, SPECIAL_IMG_SIZE, 32, IB_rect, 0);
+ ibuf = IMB_allocImBuf(SPECIAL_IMG_SIZE, SPECIAL_IMG_SIZE, 32, IB_rect);
for (k=0; k<SPECIAL_IMG_SIZE; k++) {
memcpy(&ibuf->rect[k*SPECIAL_IMG_SIZE], &bbuf->rect[(k+y*SPECIAL_IMG_SIZE)*SPECIAL_IMG_SIZE*SPECIAL_IMG_COLS+x*SPECIAL_IMG_SIZE], SPECIAL_IMG_SIZE*sizeof(int));
}
@@ -730,7 +730,7 @@ static void filelist_read_dir(struct FileList* filelist)
BLI_getwdN(wdir);
- BLI_cleanup_dir(G.sce, filelist->dir);
+ BLI_cleanup_dir(G.main->name, filelist->dir);
filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist));
if(!chdir(wdir)) {} /* fix warning about not checking return value */
@@ -747,7 +747,7 @@ static void filelist_read_main(struct FileList* filelist)
static void filelist_read_library(struct FileList* filelist)
{
if (!filelist) return;
- BLI_cleanup_dir(G.sce, filelist->dir);
+ BLI_cleanup_dir(G.main->name, filelist->dir);
filelist_from_library(filelist);
if(!filelist->libfiledata) {
int num;
@@ -912,7 +912,7 @@ void filelist_from_library(struct FileList* filelist)
return;
}
- BLI_strncpy(filename, G.sce, sizeof(filename)); // G.sce = last file loaded, for UI
+ BLI_strncpy(filename, G.main->name, sizeof(filename));
/* there we go */
/* for the time being only read filedata when libfiledata==0 */
@@ -965,7 +965,7 @@ void filelist_from_library(struct FileList* filelist)
/* first allocate imbuf for copying preview into it */
if (w > 0 && h > 0 && rect) {
- ima = IMB_allocImBuf(w, h, 32, IB_rect, 0);
+ ima = IMB_allocImBuf(w, h, 32, IB_rect);
memcpy(ima->rect, rect, w*h*sizeof(unsigned int));
filelist->filelist[i + 1].image = ima;
filelist->filelist[i + 1].flags = IMAGEFILE;
@@ -979,7 +979,7 @@ void filelist_from_library(struct FileList* filelist)
filelist_sort(filelist, FILE_SORT_ALPHA);
- BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change
+ BLI_strncpy(G.main->name, filename, sizeof(filename)); // prevent G.main->name to change
filelist->filter = 0;
filelist_filter(filelist);
@@ -1145,7 +1145,7 @@ static void thumbnail_joblist_free(ThumbnailJob *tj)
BLI_freelistN(&tj->loadimages);
}
-static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *progress)
+static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *UNUSED(progress))
{
ThumbnailJob *tj= tjv;
FileImage* limg = tj->loadimages.first;
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 7192870bcc8..8ad3ef08e85 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -64,6 +64,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BLF_api.h"
@@ -104,7 +105,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
if (!sfile->params) {
sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams");
/* set path to most recently opened .blend */
- BLI_split_dirfile(G.sce, sfile->params->dir, sfile->params->file);
+ BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file);
sfile->params->filter_glob[0] = '\0';
}
@@ -142,8 +143,8 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
if(params->dir[0]) {
- BLI_cleanup_dir(G.sce, params->dir);
- BLI_path_abs(params->dir, G.sce);
+ BLI_cleanup_dir(G.main->name, params->dir);
+ BLI_path_abs(params->dir, G.main->name);
}
params->filter = 0;
@@ -463,7 +464,7 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern)
return match;
}
-void autocomplete_directory(struct bContext *C, char *str, void *arg_v)
+void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
{
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -510,7 +511,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *arg_v)
}
}
-void autocomplete_file(struct bContext *C, char *str, void *arg_v)
+void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
{
SpaceFile *sfile= CTX_wm_space_file(C);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 0cd721964bd..92244165dc1 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -66,7 +66,7 @@
/* ******************** default callbacks for file space ***************** */
-static SpaceLink *file_new(const bContext *C)
+static SpaceLink *file_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceFile *sfile;
@@ -143,7 +143,7 @@ static void file_free(SpaceLink *sl)
/* spacetype; init callback, area size changes, screen set, etc */
-static void file_init(struct wmWindowManager *wm, ScrArea *sa)
+static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
//printf("file_init\n");
@@ -178,7 +178,7 @@ static SpaceLink *file_duplicate(SpaceLink *sl)
return (SpaceLink *)sfilen;
}
-static void file_refresh(const bContext *C, ScrArea *sa)
+static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
{
SpaceFile *sfile= CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
@@ -335,7 +335,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar)
file_calc_previews(C, ar);
/* set view */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* on first read, find active file */
if (params->active_file == -1) {
@@ -457,7 +457,7 @@ static void file_channel_area_draw(const bContext *C, ARegion *ar)
ED_region_panels(C, ar, 1, NULL, -1);
}
-static void file_channel_area_listener(ARegion *ar, wmNotifier *wmn)
+static void file_channel_area_listener(ARegion *UNUSED(ar), wmNotifier *wmn)
{
/* context changes */
switch(wmn->category) {
@@ -505,7 +505,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
- UI_view2d_view_ortho(C, &ar->v2d);
+ UI_view2d_view_ortho(&ar->v2d);
file_draw_buttons(C, ar);
diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c
index b69bfdc0231..750cf98727a 100644
--- a/source/blender/editors/space_file/writeimage.c
+++ b/source/blender/editors/space_file/writeimage.c
@@ -41,6 +41,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_image.h"
#include "RE_pipeline.h"
@@ -48,10 +49,10 @@
#include "file_intern.h"
/* XXX */
-static void error(const char *dummy) {}
-static void waitcursor(int val) {}
-static void activate_fileselect(int d1, char *d2, char *d3, void *d4) {}
-static int saveover(const char *dummy) {return 0;}
+static void error(const char *UNUSED(dummy)) {}
+static void waitcursor(int UNUSED(val)) {}
+static void activate_fileselect(int UNUSED(d1), char *UNUSED(d2), char *UNUSED(d3), void *UNUSED(d4)) {}
+static int saveover(const char *UNUSED(dummy)) {return 0;}
/* XXX */
@@ -75,7 +76,7 @@ static void save_rendered_image_cb_real(char *name, int confirm)
BKE_add_image_extension(name, scene->r.imtype);
strcpy(str, name);
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
if (confirm)
overwrite = saveover(str);
@@ -99,7 +100,7 @@ static void save_rendered_image_cb_real(char *name, int confirm)
waitcursor(1); /* from screen.c */
- ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0, 0);
+ ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0);
ibuf->rect= (unsigned int *)rres.rect32;
ibuf->rect_float= rres.rectf;
ibuf->zbuf_float= rres.rectz;
@@ -218,7 +219,7 @@ void BIF_save_rendered_image_fs(Scene *scene)
char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2];
if(G.ima[0]==0) {
- strcpy(dir, G.sce);
+ strcpy(dir, G.main->name);
BLI_splitdirstring(dir, str);
strcpy(G.ima, dir);
}
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index f4567255b91..dd3672b656a 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -76,7 +76,7 @@
/* -------------- */
-static void do_graph_region_buttons(bContext *C, void *arg, int event)
+static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event)
{
//Scene *scene= CTX_data_scene(C);
@@ -116,7 +116,7 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **
return 1;
}
-static int graph_panel_poll(const bContext *C, PanelType *pt)
+static int graph_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
return graph_panel_context(C, NULL, NULL);
}
@@ -288,7 +288,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
#define B_IPO_DEPCHANGE 10
-static void do_graph_region_driver_buttons(bContext *C, void *arg, int event)
+static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int event)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -310,7 +310,7 @@ static void do_graph_region_driver_buttons(bContext *C, void *arg, int event)
}
/* callback to remove the active driver */
-static void driver_remove_cb (bContext *C, void *ale_v, void *dummy_v)
+static void driver_remove_cb (bContext *UNUSED(C), void *ale_v, void *UNUSED(arg))
{
bAnimListElem *ale= (bAnimListElem *)ale_v;
ID *id= ale->id;
@@ -325,7 +325,7 @@ static void driver_remove_cb (bContext *C, void *ale_v, void *dummy_v)
}
/* callback to add a target variable to the active driver */
-static void driver_add_var_cb (bContext *C, void *driver_v, void *dummy_v)
+static void driver_add_var_cb (bContext *UNUSED(C), void *driver_v, void *UNUSED(arg))
{
ChannelDriver *driver= (ChannelDriver *)driver_v;
@@ -334,7 +334,7 @@ static void driver_add_var_cb (bContext *C, void *driver_v, void *dummy_v)
}
/* callback to remove target variable from active driver */
-static void driver_delete_var_cb (bContext *C, void *driver_v, void *dvar_v)
+static void driver_delete_var_cb (bContext *UNUSED(C), void *driver_v, void *dvar_v)
{
ChannelDriver *driver= (ChannelDriver *)driver_v;
DriverVar *dvar= (DriverVar *)dvar_v;
@@ -344,7 +344,7 @@ static void driver_delete_var_cb (bContext *C, void *driver_v, void *dvar_v)
}
/* callback to reset the driver's flags */
-static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v)
+static void driver_update_flags_cb (bContext *UNUSED(C), void *fcu_v, void *UNUSED(arg))
{
FCurve *fcu= (FCurve *)fcu_v;
ChannelDriver *driver= fcu->driver;
@@ -355,7 +355,7 @@ static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v)
}
/* drivers panel poll */
-static int graph_panel_drivers_poll(const bContext *C, PanelType *pt)
+static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceIpo *sipo= CTX_wm_space_graph(C);
@@ -365,9 +365,8 @@ static int graph_panel_drivers_poll(const bContext *C, PanelType *pt)
return graph_panel_context(C, NULL, NULL);
}
-
/* settings for 'single property' driver variable type */
-static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar)
+static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVar *dvar)
{
DriverTarget *dtar= &dvar->targets[0];
PointerRNA dtar_ptr;
@@ -379,7 +378,7 @@ static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layou
/* Target ID */
row= uiLayoutRow(layout, 0);
- uiTemplateAnyID(row, (bContext *)C, &dtar_ptr, "id", "id_type", "Prop:");
+ uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", "Prop:");
/* Target Property */
// TODO: make this less technical...
@@ -392,12 +391,12 @@ static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layou
col= uiLayoutColumn(layout, 1);
block= uiLayoutGetBlock(col);
/* rna path */
- uiTemplatePathBuilder(col, (bContext *)C, &dtar_ptr, "data_path", &root_ptr, "Path");
+ uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, "Path");
}
}
/* settings for 'rotation difference' driver variable type */
-static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar)
+static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *dvar)
{
DriverTarget *dtar= &dvar->targets[0];
DriverTarget *dtar2= &dvar->targets[1];
@@ -412,7 +411,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout,
/* Bone 1 */
col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Bone 1:");
+ uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Bone 1:");
if (dtar->id && ob1->pose) {
PointerRNA tar_ptr;
@@ -422,7 +421,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout,
}
col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, (bContext *)C, &dtar2_ptr, "id", "id_type", "Bone 2:");
+ uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Bone 2:");
if (dtar2->id && ob2->pose) {
PointerRNA tar_ptr;
@@ -433,7 +432,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout,
}
/* settings for 'location difference' driver variable type */
-static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar)
+static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *dvar)
{
DriverTarget *dtar= &dvar->targets[0];
DriverTarget *dtar2= &dvar->targets[1];
@@ -448,7 +447,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout,
/* Bone 1 */
col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Ob/Bone 1:");
+ uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone 1:");
if (dtar->id && ob1->pose) {
PointerRNA tar_ptr;
@@ -460,7 +459,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout,
uiItemR(col, &dtar_ptr, "use_local_space_transform", 0, NULL, 0);
col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, (bContext *)C, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:");
+ uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:");
if (dtar2->id && ob2->pose) {
PointerRNA tar_ptr;
@@ -473,7 +472,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout,
}
/* settings for 'transform channel' driver variable type */
-static void graph_panel_driverVar__transChan(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar)
+static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar *dvar)
{
DriverTarget *dtar= &dvar->targets[0];
Object *ob = (Object *)dtar->id;
@@ -485,7 +484,7 @@ static void graph_panel_driverVar__transChan(const bContext *C, uiLayout *layout
/* properties */
col= uiLayoutColumn(layout, 1);
- uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Ob/Bone:");
+ uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone:");
if (dtar->id && ob->pose) {
PointerRNA tar_ptr;
@@ -606,16 +605,16 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* controls to draw depends on the type of variable */
switch (dvar->type) {
case DVAR_TYPE_SINGLE_PROP: /* single property */
- graph_panel_driverVar__singleProp(C, box, ale->id, dvar);
+ graph_panel_driverVar__singleProp(box, ale->id, dvar);
break;
case DVAR_TYPE_ROT_DIFF: /* rotational difference */
- graph_panel_driverVar__rotDiff(C, box, ale->id, dvar);
+ graph_panel_driverVar__rotDiff(box, ale->id, dvar);
break;
case DVAR_TYPE_LOC_DIFF: /* location difference */
- graph_panel_driverVar__locDiff(C, box, ale->id, dvar);
+ graph_panel_driverVar__locDiff(box, ale->id, dvar);
break;
case DVAR_TYPE_TRANSFORM_CHAN: /* transform channel */
- graph_panel_driverVar__transChan(C, box, ale->id, dvar);
+ graph_panel_driverVar__transChan(box, ale->id, dvar);
break;
}
@@ -642,7 +641,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
#define B_FMODIFIER_REDRAW 20
-static void do_graph_region_modifier_buttons(bContext *C, void *arg, int event)
+static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int event)
{
switch (event) {
case B_REDR:
@@ -733,7 +732,7 @@ void graph_buttons_register(ARegionType *art)
BLI_addtail(&art->paneltypes, pt);
}
-static int graph_properties(bContext *C, wmOperator *op)
+static int graph_properties(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= graph_has_buttons_region(sa);
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index f780a6c31ee..01a8ba4797c 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -87,7 +87,7 @@
/* Envelope -------------- */
// TODO: draw a shaded poly showing the region of influence too!!!
-static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm, View2D *v2d)
+static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d)
{
FMod_Envelope *env= (FMod_Envelope *)fcm->data;
FCM_EnvelopeData *fed;
@@ -137,7 +137,7 @@ static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm,
/* Points ---------------- */
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_vertices_keyframes (bAnimContext *ac, FCurve *fcu, View2D *v2d, short edit, short sel)
+static void draw_fcurve_vertices_keyframes (FCurve *fcu, View2D *v2d, short edit, short sel)
{
BezTriple *bezt= fcu->bezt;
const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
@@ -209,7 +209,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys
}
/* helper func - draw handle vertices only for an F-Curve (if it is not protected) */
-static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCurve *fcu, View2D *v2d, short sel)
+static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, short sel_handle_only)
{
BezTriple *bezt= fcu->bezt;
BezTriple *prevbezt = NULL;
@@ -237,7 +237,7 @@ static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCur
* Also, need to take into account whether the keyframe was selected
* if a Graph Editor option to only show handles of selected keys is on.
*/
- if ( !(sipo->flag & SIPO_SELVHANDLESONLY) || BEZSELECTED(bezt) ) {
+ if ( !sel_handle_only || BEZSELECTED(bezt) ) {
if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) {
if ((bezt->f1 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/
draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize);
@@ -255,7 +255,7 @@ static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCur
}
/* helper func - set color to draw F-Curve data with */
-static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel)
+static void set_fcurve_vertex_color (FCurve *fcu, short sel)
{
/* Fade the 'intensity' of the vertices based on the selection of the curves too */
int alphaOffset= (int)((drawFCurveFade(fcu) - 1.0f) * 255);
@@ -274,7 +274,7 @@ static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel)
}
-static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu, int do_handles)
+static void draw_fcurve_vertices (ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only)
{
View2D *v2d= &ar->v2d;
@@ -290,19 +290,19 @@ static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar,
/* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
if (do_handles)
{
- set_fcurve_vertex_color(sipo, fcu, 0);
- draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 0);
+ set_fcurve_vertex_color(fcu, 0);
+ draw_fcurve_vertices_handles(fcu, v2d, 0, sel_handle_only);
- set_fcurve_vertex_color(sipo, fcu, 1);
- draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 1);
+ set_fcurve_vertex_color(fcu, 1);
+ draw_fcurve_vertices_handles(fcu, v2d, 1, sel_handle_only);
}
/* draw keyframes over the handles */
- set_fcurve_vertex_color(sipo, fcu, 0);
- draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
+ set_fcurve_vertex_color(fcu, 0);
+ draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
- set_fcurve_vertex_color(sipo, fcu, 1);
- draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
+ set_fcurve_vertex_color(fcu, 1);
+ draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
glPointSize(1.0f);
}
@@ -329,7 +329,7 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
/* draw lines for F-Curve handles only (this is only done in EditMode)
* note: draw_fcurve_handles_check must be checked before running this. */
-static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
+static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
{
int sel, b;
@@ -455,7 +455,7 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys
}
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
+static void draw_fcurve_samples (ARegion *ar, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
@@ -489,7 +489,7 @@ static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar,
/* Curve ---------------- */
/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */
-static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DGrid *grid)
+static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid)
{
ChannelDriver *driver;
float samplefreq, ctime;
@@ -627,7 +627,7 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi
}
/* helper func - draw one repeat of an F-Curve */
-static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid)
+static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d)
{
BezTriple *prevbezt= fcu->bezt;
BezTriple *bezt= prevbezt+1;
@@ -784,7 +784,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
* NOTE: unit mapping has already been applied to the values, so do not try and apply again
*/
-void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid)
+void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
{
FCurve *fcu;
@@ -878,12 +878,12 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
/* draw a curve affected by modifiers or only allowed to have integer values
* by sampling it at various small-intervals over the visible region
*/
- draw_fcurve_curve(ac, ale->id, fcu, sipo, &ar->v2d, grid);
+ draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid);
}
else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) {
/* just draw curve based on defined data (i.e. no modifiers) */
if (fcu->bezt)
- draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d, grid);
+ draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d);
else if (fcu->fpt)
draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d);
}
@@ -904,7 +904,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
switch (fcm->type) {
case FMODIFIER_TYPE_ENVELOPE: /* envelope */
- draw_fcurve_modifier_controls_envelope(fcu, fcm, &ar->v2d);
+ draw_fcurve_modifier_controls_envelope(fcm, &ar->v2d);
break;
}
}
@@ -919,15 +919,15 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
if (do_handles) {
/* only draw handles/vertices on keyframes */
glEnable(GL_BLEND);
- draw_fcurve_handles(ac, sipo, ar, fcu);
+ draw_fcurve_handles(sipo, fcu);
glDisable(GL_BLEND);
}
- draw_fcurve_vertices(ac, sipo, ar, fcu, do_handles);
+ draw_fcurve_vertices(ar, fcu, do_handles, sipo->flag&SIPO_SELVHANDLESONLY);
}
else {
/* samples: only draw two indicators at either end as indicators */
- draw_fcurve_samples(ac, sipo, ar, fcu);
+ draw_fcurve_samples(ar, fcu);
}
/* unapply unit mapping */
@@ -948,7 +948,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
/* Channel List */
/* left hand part */
-void graph_draw_channel_names(bContext *C, bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
+void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 5c692ba1112..e1d1e4194d5 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -140,7 +140,7 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo
/* ****************** Automatic Preview-Range Operator ****************** */
-static int graphkeys_previewrange_exec(bContext *C, wmOperator *op)
+static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
Scene *scene;
@@ -183,7 +183,7 @@ void GRAPH_OT_previewrange_set (wmOperatorType *ot)
/* ****************** View-All Operator ****************** */
-static int graphkeys_viewall_exec(bContext *C, wmOperator *op)
+static int graphkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
View2D *v2d;
@@ -305,7 +305,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end)
/* ------------------- */
-static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *op)
+static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
View2D *v2d;
@@ -349,7 +349,7 @@ void GRAPH_OT_ghost_curves_create (wmOperatorType *ot)
/* ******************** Clear Ghost-Curves Operator *********************** */
/* This operator clears the 'ghost curves' for the active Graph Editor */
-static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *op)
+static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
SpaceIpo *sipo;
@@ -719,7 +719,7 @@ static void duplicate_graph_keys (bAnimContext *ac)
/* ------------------- */
-static int graphkeys_duplicate_exec(bContext *C, wmOperator *op)
+static int graphkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -739,7 +739,7 @@ static int graphkeys_duplicate_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
graphkeys_duplicate_exec(C, op);
@@ -799,7 +799,7 @@ static void delete_graph_keys (bAnimContext *ac)
/* ------------------- */
-static int graphkeys_delete_exec(bContext *C, wmOperator *op)
+static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -935,7 +935,7 @@ static void bake_graph_curves (bAnimContext *ac, int start, int end)
/* ------------------- */
-static int graphkeys_bake_exec(bContext *C, wmOperator *op)
+static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
Scene *scene= NULL;
@@ -1001,7 +1001,7 @@ typedef struct tSoundBakeInfo {
/* Sampling callback used to determine the value from the sound to
* save in the F-Curve at the specified frame
*/
-static float fcurve_samplingcb_sound (FCurve *fcu, void *data, float evaltime)
+static float fcurve_samplingcb_sound (FCurve *UNUSED(fcu), void *data, float evaltime)
{
tSoundBakeInfo *sbi= (tSoundBakeInfo *)data;
@@ -1149,7 +1149,7 @@ static void sample_graph_keys (bAnimContext *ac)
/* ------------------- */
-static int graphkeys_sample_exec(bContext *C, wmOperator *op)
+static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1205,7 +1205,7 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting mode per F-Curve */
@@ -1530,7 +1530,7 @@ void GRAPH_OT_euler_filter (wmOperatorType *ot)
/* ***************** Jump to Selected Frames Operator *********************** */
/* snap current-frame indicator to 'average time' of selected keyframe */
-static int graphkeys_framejump_exec(bContext *C, wmOperator *op)
+static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
ListBase anim_data= {NULL, NULL};
@@ -1835,7 +1835,7 @@ void GRAPH_OT_mirror (wmOperatorType *ot)
/* ******************** Smooth Keyframes Operator *********************** */
-static int graphkeys_smooth_exec(bContext *C, wmOperator *op)
+static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
@@ -1890,7 +1890,7 @@ void GRAPH_OT_smooth (wmOperatorType *ot)
/* ******************** Add F-Modifier Operator *********************** */
/* present a special customised popup menu for this, with some filtering */
-static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *event)
+static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
uiPopupMenu *pup;
uiLayout *layout;
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index a637ed15fcd..560dabbb634 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -48,10 +48,10 @@ struct ARegion *graph_has_buttons_region(struct ScrArea *sa);
/* ***************************************** */
/* graph_draw.c */
-void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
+void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar);
void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel);
-void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid);
+void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
/* ***************************************** */
/* graph_header.c */
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 0069e6e0675..b4ca1b8c901 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -181,7 +181,7 @@ void GRAPH_OT_cursor_set(wmOperatorType *ot)
/* Toggle Handles ----------------------------------------------------------------- */
-static int view_toggle_handles_exec (bContext *C, wmOperator *op)
+static int view_toggle_handles_exec (bContext *C, wmOperator *UNUSED(op))
{
SpaceIpo *sipo= CTX_wm_space_graph(C);
ARegion *ar= CTX_wm_region(C);
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index cdc8166f2d6..0aa0a87dbac 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -539,7 +539,7 @@ void GRAPH_OT_select_column (wmOperatorType *ot)
/* ******************** Select Linked Operator *********************** */
-static int graphkeys_select_linked_exec (bContext *C, wmOperator *op)
+static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -638,7 +638,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode)
/* ----------------- */
-static int graphkeys_select_more_exec (bContext *C, wmOperator *op)
+static int graphkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -672,7 +672,7 @@ void GRAPH_OT_select_more (wmOperatorType *ot)
/* ----------------- */
-static int graphkeys_select_less_exec (bContext *C, wmOperator *op)
+static int graphkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -886,7 +886,7 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, int mval[2], ListBa
}
/* helper for find_nearest_fcurve_vert() - get the best match to use */
-static tNearestVertInfo *get_best_nearest_fcurve_vert (bAnimContext *ac, ListBase *matches)
+static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches)
{
tNearestVertInfo *nvi = NULL;
short found = 0;
@@ -941,7 +941,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, int mval[2]
get_nearest_fcurve_verts_list(ac, mval, &matches);
/* step 2: find the best vert */
- nvi= get_best_nearest_fcurve_vert(ac, &matches);
+ nvi= get_best_nearest_fcurve_vert(&matches);
BLI_freelistN(&matches);
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index ca372d74da6..ff2d233ccdb 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -175,7 +175,7 @@ static void graph_free(SpaceLink *sl)
/* spacetype; init callback */
-static void graph_init(struct wmWindowManager *wm, ScrArea *sa)
+static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first;
@@ -229,17 +229,17 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* grid */
unitx= (sipo->flag & SIPO_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMESCALE;
- grid= UI_view2d_grid_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy);
- UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL);
+ grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy);
+ UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL);
/* draw data */
if (ANIM_animdata_get_context(C, &ac)) {
/* draw ghost curves */
- graph_draw_ghost_curves(&ac, sipo, ar, grid);
+ graph_draw_ghost_curves(&ac, sipo, ar);
/* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */
graph_draw_curves(&ac, sipo, ar, grid, 0);
@@ -282,11 +282,11 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
ANIM_draw_cfra(C, v2d, flag);
/* markers */
- UI_view2d_view_orthoSpecial(C, v2d, 1);
+ UI_view2d_view_orthoSpecial(ar, v2d, 1);
draw_markers_time(C, 0);
/* preview range */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
ANIM_draw_previewrange(C, v2d);
/* reset view matrix */
@@ -314,7 +314,6 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar)
static void graph_channel_area_draw(const bContext *C, ARegion *ar)
{
- SpaceIpo *sipo= CTX_wm_space_graph(C);
bAnimContext ac;
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
@@ -325,11 +324,11 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar)
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* draw channels */
if (ANIM_animdata_get_context(C, &ac)) {
- graph_draw_channel_names((bContext*)C, &ac, sipo, ar);
+ graph_draw_channel_names((bContext*)C, &ac, ar);
}
/* reset view matrix */
@@ -342,7 +341,7 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void graph_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void graph_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt
index d47f5a9820e..750c4b324d6 100644
--- a/source/blender/editors/space_image/CMakeLists.txt
+++ b/source/blender/editors/space_image/CMakeLists.txt
@@ -41,6 +41,10 @@ IF(WITH_IMAGE_TIFF)
ADD_DEFINITIONS(-DWITH_TIFF)
ENDIF(WITH_IMAGE_TIFF)
+IF(WITH_IMAGE_CINEON)
+ ADD_DEFINITIONS(-DWITH_CINEON)
+ENDIF(WITH_IMAGE_CINEON)
+
IF(WITH_LCMS)
SET(INC ${INC} ${LCMS_INCLUDE_DIR})
ADD_DEFINITIONS(-DWITH_LCMS)
diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript
index c7c31352185..15a7aeb828f 100644
--- a/source/blender/editors/space_image/SConscript
+++ b/source/blender/editors/space_image/SConscript
@@ -16,6 +16,8 @@ if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
if env['WITH_BF_TIFF']:
defs.append('WITH_TIFF')
+if env['WITH_BF_CINEON']:
+ defs.append('WITH_CINEON')
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 840d4943c56..bbc8925a152 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -97,7 +97,7 @@
static void image_editvertex_buts(const bContext *C, uiBlock *block);
-static void do_image_panel_events(bContext *C, void *arg, int event)
+static void do_image_panel_events(bContext *C, void *UNUSED(arg), int event)
{
SpaceImage *sima= CTX_wm_space_image(C);
@@ -300,7 +300,7 @@ static void image_editvertex_buts(const bContext *C, uiBlock *block)
/* is used for both read and write... */
-static int image_panel_poll(const bContext *C, PanelType *pt)
+static int image_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceImage *sima= CTX_wm_space_image(C);
ImBuf *ibuf;
@@ -493,7 +493,8 @@ static char *slot_menu()
return str;
}
-static char *layer_menu(RenderResult *rr, short *curlay)
+/* TODO, curlay should be removed? */
+static char *layer_menu(RenderResult *rr, short *UNUSED(curlay))
{
RenderLayer *rl;
int len= 64 + 32*BLI_countlist(&rr->layers);
@@ -739,7 +740,7 @@ typedef struct RNAUpdateCb {
ImageUser *iuser;
} RNAUpdateCb;
-static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused)
+static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
{
RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb;
@@ -951,7 +952,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser
}
}
-static int image_panel_uv_poll(const bContext *C, PanelType *pt)
+static int image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt))
{
Object *obedit= CTX_data_edit_object(C);
return ED_uvedit_test(obedit);
@@ -996,7 +997,7 @@ void image_buttons_register(ARegionType *art)
BLI_addtail(&art->paneltypes, pt);
}
-static int image_properties(bContext *C, wmOperator *op)
+static int image_properties(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= image_has_buttons_region(sa);
@@ -1019,7 +1020,7 @@ void IMAGE_OT_properties(wmOperatorType *ot)
ot->flag= 0;
}
-static int image_scopes(bContext *C, wmOperator *op)
+static int image_scopes(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= image_has_scope_region(sa);
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index f29d1bc033f..48524d2728f 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -70,7 +70,7 @@
#define HEADER_HEIGHT 18
-static void image_verify_buffer_float(SpaceImage *sima, Image *ima, ImBuf *ibuf, int color_manage)
+static void image_verify_buffer_float(Image *ima, ImBuf *ibuf, int color_manage)
{
/* detect if we need to redo the curve map.
ibuf->rect is zero for compositor and render results after change
@@ -367,7 +367,7 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image
}
#ifdef WITH_LCMS
else if(sima->flag & SI_COLOR_CORRECTION) {
- image_verify_buffer_float(sima, ima, ibuf, color_manage);
+ image_verify_buffer_float(ima, ibuf, color_manage);
if(sima_draw_colorcorrected_pixels(x, y, ibuf)==0) {
unsigned char col1[3]= {100, 0, 100}, col2[3]= {160, 0, 160}; /* pink says 'warning' in blender land */
@@ -387,7 +387,7 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image
/* we don't draw floats buffers directly but
* convert them, and optionally apply curves */
- image_verify_buffer_float(sima, ima, ibuf, color_manage);
+ image_verify_buffer_float(ima, ibuf, color_manage);
if(ibuf->rect)
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
@@ -440,7 +440,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene,
sima->curtile = ima->xrep*ima->yrep - 1;
/* create char buffer from float if needed */
- image_verify_buffer_float(sima, ima, ibuf, color_manage);
+ image_verify_buffer_float(ima, ibuf, color_manage);
/* retrieve part of image buffer */
dx= ibuf->x/ima->xrep;
@@ -579,7 +579,7 @@ static unsigned char *get_alpha_clone_image(Scene *scene, int *width, int *heigh
return rect;
}
-static void draw_image_paint_helpers(SpaceImage *sima, ARegion *ar, Scene *scene, float zoomx, float zoomy)
+static void draw_image_paint_helpers(ARegion *ar, Scene *scene, float zoomx, float zoomy)
{
Brush *brush;
int x, y, w, h;
@@ -658,7 +658,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
draw_image_buffer(sima, ar, scene, ima, ibuf, 0.0f, 0.0f, zoomx, zoomy);
/* paint helpers */
- draw_image_paint_helpers(sima, ar, scene, zoomx, zoomy);
+ draw_image_paint_helpers(ar, scene, zoomx, zoomy);
/* XXX integrate this code */
diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c
index 7ecb2565e72..498b3b80bd5 100644
--- a/source/blender/editors/space_image/image_header.c
+++ b/source/blender/editors/space_image/image_header.c
@@ -53,7 +53,7 @@
/********************** toolbox operator *********************/
-static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SpaceImage *sima= CTX_wm_space_image(C);
Object *obedit= CTX_data_edit_object(C);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 0bcc2439756..429ba64ed0f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -133,7 +133,7 @@ static int space_image_file_exists_poll(bContext *C)
ibuf= ED_space_image_acquire_buffer(sima, &lock);
if(ibuf) {
BLI_strncpy(name, ibuf->name, FILE_MAX);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
poll= (BLI_exists(name) && BLI_is_writable(name));
}
ED_space_image_release_buffer(sima, lock);
@@ -432,7 +432,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot)
* Default behavior is to reset the position of the image and set the zoom to 1
* If the image will not fit within the window rectangle, the zoom is adjusted */
-static int view_all_exec(bContext *C, wmOperator *op)
+static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima;
ARegion *ar;
@@ -486,7 +486,7 @@ void IMAGE_OT_view_all(wmOperatorType *ot)
/********************** view selected operator *********************/
-static int view_selected_exec(bContext *C, wmOperator *op)
+static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima;
ARegion *ar;
@@ -543,7 +543,7 @@ void IMAGE_OT_view_selected(wmOperatorType *ot)
/********************** view zoom in/out operator *********************/
-static int view_zoom_in_exec(bContext *C, wmOperator *op)
+static int view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -566,7 +566,7 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
ot->poll= space_image_main_area_poll;
}
-static int view_zoom_out_exec(bContext *C, wmOperator *op)
+static int view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -679,7 +679,7 @@ static void open_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int open_cancel(bContext *C, wmOperator *op)
+static int open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata= NULL;
@@ -701,7 +701,7 @@ static int open_exec(bContext *C, wmOperator *op)
errno= 0;
- ima= BKE_add_image_file(str, scene ? scene->r.cfra : 1);
+ ima= BKE_add_image_file(str);
if(!ima) {
if(op->customdata) MEM_freeN(op->customdata);
@@ -736,7 +736,7 @@ static int open_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
SpaceImage *sima= CTX_wm_space_image(C);
char *path=U.textudir;
@@ -806,7 +806,7 @@ static int replace_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int replace_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
SpaceImage *sima= CTX_wm_space_image(C);
@@ -856,7 +856,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
int relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"));
int save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy"));
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
if(scene->r.scemode & R_EXTENSION) {
BKE_add_image_extension(path, sima->imtypenr);
@@ -876,7 +876,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
RE_WriteRenderResult(rr, path, scene->r.quality);
if(relative)
- BLI_path_rel(path, G.sce); /* only after saving */
+ BLI_path_rel(path, G.main->name); /* only after saving */
if(!save_copy) {
if(do_newpath) {
@@ -896,7 +896,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
else if (BKE_write_ibuf(scene, ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) {
if(relative)
- BLI_path_rel(path, G.sce); /* only after saving */
+ BLI_path_rel(path, G.main->name); /* only after saving */
if(!save_copy) {
if(do_newpath) {
@@ -961,7 +961,7 @@ static int save_as_exec(bContext *C, wmOperator *op)
}
-static int save_as_check(bContext *C, wmOperator *op)
+static int save_as_check(bContext *UNUSED(C), wmOperator *op)
{
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
@@ -972,7 +972,7 @@ static int save_as_check(bContext *C, wmOperator *op)
return FALSE;
}
-static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
SpaceImage *sima= CTX_wm_space_image(C);
Image *ima = ED_space_image(sima);
@@ -1071,7 +1071,7 @@ static int save_exec(bContext *C, wmOperator *op)
if(name[0]==0)
BLI_strncpy(name, G.ima, FILE_MAX);
else
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
if(BLI_exists(name) && BLI_is_writable(name)) {
rr= BKE_image_acquire_renderresult(scene, ima);
@@ -1157,7 +1157,7 @@ static int save_sequence_exec(bContext *C, wmOperator *op)
char name[FILE_MAX];
BLI_strncpy(name, ibuf->name, sizeof(name));
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s.", name);
@@ -1188,7 +1188,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot)
/******************** reload image operator ********************/
-static int reload_exec(bContext *C, wmOperator *op)
+static int reload_exec(bContext *C, wmOperator *UNUSED(op))
{
Image *ima= CTX_data_edit_image(C);
SpaceImage *sima= CTX_wm_space_image(C);
@@ -1347,7 +1347,7 @@ static int pack_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int pack_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Image *ima= CTX_data_edit_image(C);
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
@@ -1507,7 +1507,7 @@ static int unpack_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Image *ima= CTX_data_edit_image(C);
@@ -1570,7 +1570,7 @@ typedef struct ImageSampleInfo {
int draw;
} ImageSampleInfo;
-static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
+static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info)
{
ImageSampleInfo *info= arg_info;
@@ -1985,7 +1985,7 @@ static int record_composite_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
RecordCompositeData *rcd= op->customdata;
@@ -2052,7 +2052,7 @@ static int cycle_render_slot_poll(bContext *C)
return (ima && ima->type == IMA_TYPE_R_RESULT);
}
-static int cycle_render_slot_exec(bContext *C, wmOperator *op)
+static int cycle_render_slot_exec(bContext *C, wmOperator *UNUSED(op))
{
Image *ima= CTX_data_edit_image(C);
int a, slot, cur= ima->render_slot;
diff --git a/source/blender/editors/space_image/image_render.c b/source/blender/editors/space_image/image_render.c
index be9d60a5adb..5fa0a2de202 100644
--- a/source/blender/editors/space_image/image_render.c
+++ b/source/blender/editors/space_image/image_render.c
@@ -149,7 +149,7 @@ void imagewindow_toggle_render(bContext *C)
}
/* NOTE: called while render, so no malloc allowed! */
-static void imagewindow_renderinfo_cb(void *handle, RenderStats *rs)
+static void imagewindow_renderinfo_cb(void *UNUSED(handle), RenderStats *UNUSED(rs))
{
if(image_area) {
// XXX BIF_make_render_text(rs);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 66e27993532..d77d153a324 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -369,7 +369,7 @@ ARegion *image_has_scope_region(ScrArea *sa)
/* ******************** default callbacks for image space ***************** */
-static SpaceLink *image_new(const bContext *C)
+static SpaceLink *image_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceImage *simage;
@@ -429,7 +429,7 @@ static void image_free(SpaceLink *sl)
/* spacetype; init callback, add handlers */
-static void image_init(struct wmWindowManager *wm, ScrArea *sa)
+static void image_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
ListBase *lb= WM_dropboxmap_find("Image", SPACE_IMAGE, 0);
@@ -485,6 +485,7 @@ void image_operatortypes(void)
void image_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0);
+ wmKeyMapItem *kmi;
WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
@@ -524,10 +525,15 @@ void image_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_curves_point_set", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "point", 1);
WM_keymap_add_item(keymap, "IMAGE_OT_toolbox", SPACEKEY, KM_PRESS, 0, 0);
+
+ /* toggle editmode is handy to have while UV unwrapping */
+ kmi= WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
+ RNA_enum_set(kmi->ptr, "mode", OB_MODE_EDIT);
+ RNA_boolean_set(kmi->ptr, "toggle", 1);
}
/* dropboxes */
-static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if(drag->type==WM_DRAG_PATH)
if(ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
@@ -551,7 +557,7 @@ static void image_dropboxes(void)
-static void image_refresh(const bContext *C, ScrArea *sa)
+static void image_refresh(const bContext *C, ScrArea *UNUSED(sa))
{
SpaceImage *sima= CTX_wm_space_image(C);
Object *obedit= CTX_data_edit_object(C);
@@ -762,7 +768,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
draw_image_main(sima, ar, scene);
/* and uvs in 0.0-1.0 space */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
draw_uvedit_main(sima, ar, scene, obedit);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
@@ -878,7 +884,7 @@ static void image_scope_area_listener(ARegion *ar, wmNotifier *wmn)
/************************* header region **************************/
/* add handlers, stuff you only do once or on area/region changes */
-static void image_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void image_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 51767d3e006..aeb32cda6bd 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -73,7 +73,7 @@ static int pack_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Main *bmain= CTX_data_main(C);
Image *ima;
@@ -133,7 +133,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Main *bmain= CTX_data_main(C);
uiPopupMenu *pup;
@@ -184,14 +184,14 @@ void FILE_OT_unpack_all(wmOperatorType *ot)
/********************* make paths relative operator *********************/
-static int make_paths_relative_exec(bContext *C, wmOperator *op)
+static int make_paths_relative_exec(bContext *UNUSED(C), wmOperator *op)
{
if(!G.relbase_valid) {
BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file.");
return OPERATOR_CANCELLED;
}
- makeFilesRelative(G.sce, op->reports);
+ makeFilesRelative(G.main->name, op->reports);
return OPERATOR_FINISHED;
}
@@ -211,14 +211,14 @@ void FILE_OT_make_paths_relative(wmOperatorType *ot)
/********************* make paths absolute operator *********************/
-static int make_paths_absolute_exec(bContext *C, wmOperator *op)
+static int make_paths_absolute_exec(bContext *UNUSED(C), wmOperator *op)
{
if(!G.relbase_valid) {
BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file.");
return OPERATOR_CANCELLED;
}
- makeFilesAbsolute(G.sce, op->reports);
+ makeFilesAbsolute(G.main->name, op->reports);
return OPERATOR_FINISHED;
}
@@ -237,14 +237,14 @@ void FILE_OT_make_paths_absolute(wmOperatorType *ot)
/********************* report missing files operator *********************/
-static int report_missing_files_exec(bContext *C, wmOperator *op)
+static int report_missing_files_exec(bContext *UNUSED(C), wmOperator *op)
{
char txtname[24]; /* text block name */
txtname[0] = '\0';
/* run the missing file check */
- checkMissingFiles(G.sce, op->reports);
+ checkMissingFiles(G.main->name, op->reports);
return OPERATOR_FINISHED;
}
@@ -264,18 +264,18 @@ void FILE_OT_report_missing_files(wmOperatorType *ot)
/********************* find missing files operator *********************/
-static int find_missing_files_exec(bContext *C, wmOperator *op)
+static int find_missing_files_exec(bContext *UNUSED(C), wmOperator *op)
{
char *path;
path= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
- findMissingFiles(path, G.sce);
+ findMissingFiles(path, G.main->name);
MEM_freeN(path);
return OPERATOR_FINISHED;
}
-static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
/* XXX file open button text "Find Missing Files" */
WM_event_add_fileselect(C, op);
@@ -313,7 +313,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
#define ERROR_TIMEOUT 10.0
#define ERROR_COLOR_TIMEOUT 6.0
#define COLLAPSE_TIMEOUT 0.2
-static int update_reports_display_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
wmWindowManager *wm= CTX_wm_manager(C);
ReportList *reports= CTX_wm_reports(C);
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index b47c8e8d189..5173621d9c1 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -55,7 +55,7 @@
/* ******************** default callbacks for info space ***************** */
-static SpaceLink *info_new(const bContext *C)
+static SpaceLink *info_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceInfo *sinfo;
@@ -80,7 +80,7 @@ static SpaceLink *info_new(const bContext *C)
}
/* not spacelink itself */
-static void info_free(SpaceLink *sl)
+static void info_free(SpaceLink *UNUSED(sl))
{
// SpaceInfo *sinfo= (SpaceInfo*) sl;
@@ -88,7 +88,7 @@ static void info_free(SpaceLink *sl)
/* spacetype; init callback */
-static void info_init(struct wmWindowManager *wm, ScrArea *sa)
+static void info_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -105,11 +105,11 @@ static SpaceLink *info_duplicate(SpaceLink *sl)
/* add handlers, stuff you only do once or on area/region changes */
-static void info_main_area_init(wmWindowManager *wm, ARegion *ar)
+static void info_main_area_init(wmWindowManager *UNUSED(wm), ARegion *UNUSED(ar))
{
}
-static void info_main_area_draw(const bContext *C, ARegion *ar)
+static void info_main_area_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar))
{
/* clear and setup matrix */
@@ -137,7 +137,7 @@ void info_keymap(struct wmKeyConfig *keyconf)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void info_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void info_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
@@ -147,7 +147,7 @@ static void info_header_area_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
-static void info_main_area_listener(ARegion *ar, wmNotifier *wmn)
+static void info_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
{
/* context changes */
}
@@ -179,7 +179,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
}
-static void recent_files_menu(const bContext *C, Menu *menu)
+static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu)
{
struct RecentFile *recent;
uiLayout *layout= menu->layout;
@@ -200,7 +200,7 @@ void recent_files_menu_register()
mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files");
strcpy(mt->idname, "INFO_MT_file_open_recent");
strcpy(mt->label, "Open Recent...");
- mt->draw= recent_files_menu;
+ mt->draw= recent_files_menu_draw;
WM_menutype_add(mt);
}
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index d8dfd8cb52d..e41627ad0a4 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -83,7 +83,7 @@ static void logic_panel_view_properties(const bContext *C, Panel *pa)
}
#endif
-void logic_buttons_register(ARegionType *art)
+void logic_buttons_register(ARegionType *UNUSED(art))
{
#if 0
PanelType *pt;
@@ -103,7 +103,7 @@ void logic_buttons_register(ARegionType *art)
}
-static int logic_properties(bContext *C, wmOperator *op)
+static int logic_properties(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= logic_has_buttons_region(sa);
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
index 4641fd2ce61..5c498a59884 100644
--- a/source/blender/editors/space_logic/logic_ops.c
+++ b/source/blender/editors/space_logic/logic_ops.c
@@ -238,7 +238,7 @@ static int sensor_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- static int sensor_remove_invoke(bContext *C, wmOperator *op, wmEvent *event)
+ static int sensor_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_sensor_invoke_properties(C, op))
return sensor_remove_exec(C, op);
@@ -341,7 +341,7 @@ static int controller_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- static int controller_remove_invoke(bContext *C, wmOperator *op, wmEvent *event)
+ static int controller_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_controller_invoke_properties(C, op))
return controller_remove_exec(C, op);
@@ -455,7 +455,7 @@ static int actuator_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_actuator_invoke_properties(C, op))
return actuator_remove_exec(C, op);
@@ -562,7 +562,7 @@ static int sensor_move_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_sensor_invoke_properties(C, op)) {
return sensor_move_exec(C, op);
@@ -607,7 +607,7 @@ static int controller_move_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_controller_invoke_properties(C, op)) {
return controller_move_exec(C, op);
@@ -652,7 +652,7 @@ static int actuator_move_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (edit_actuator_invoke_properties(C, op)) {
return actuator_move_exec(C, op);
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 4b778e80b0e..c8d6e960132 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -182,7 +182,7 @@ void make_unique_prop_names(bContext *C, char *str)
MEM_freeN(names);
}
-static void make_unique_prop_names_cb(bContext *C, void *strv, void *redraw_view3d_flagv)
+static void make_unique_prop_names_cb(bContext *C, void *strv, void *UNUSED(redraw_view3d_flagv))
{
char *str= strv;
// int redraw_view3d_flag= GET_INT_FROM_POINTER(redraw_view3d_flagv);
@@ -354,7 +354,7 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up)
}
}
-void do_logic_buts(bContext *C, void *arg, int event)
+void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
{
Main *bmain= CTX_data_main(C);
bSensor *sens;
@@ -964,7 +964,7 @@ static void set_col_sensor(int type, int medium)
}
-static void verify_logicbutton_func(bContext *C, void *data1, void *data2)
+static void verify_logicbutton_func(bContext *UNUSED(C), void *data1, void *data2)
{
bSensor *sens= (bSensor*)data1;
@@ -1017,7 +1017,7 @@ static void test_scenepoin_but(struct bContext *C, char *name, ID **idpp)
id_us_plus(*idpp);
}
-static void test_keyboard_event(struct bContext *C, void *arg_ks, void *arg_unused)
+static void test_keyboard_event(struct bContext *UNUSED(C), void *arg_ks, void *UNUSED(arg))
{
bKeyboardSensor *ks= (bKeyboardSensor*)arg_ks;
@@ -1116,7 +1116,7 @@ static void check_armature_sensor(bContext *C, void *arg1_but, void *arg2_sens)
check_armature_bone_constraint(ob, sens->posechannel, sens->constraint);
}
-static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width,char* objectname)
+static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width)
{
bNearSensor *ns = NULL;
bTouchSensor *ts = NULL;
@@ -1734,7 +1734,7 @@ static void set_col_actuator(int item, int medium)
}
-static void change_object_actuator(bContext *C, void *act, void *arg)
+static void change_object_actuator(bContext *UNUSED(C), void *act, void *UNUSED(arg))
{
bObjectActuator *oa = act;
@@ -1758,7 +1758,7 @@ static void change_object_actuator(bContext *C, void *act, void *arg)
}
}
-static void change_ipo_actuator(bContext *C, void *arg1_but, void *arg2_ia)
+static void change_ipo_actuator(bContext *UNUSED(C), void *arg1_but, void *arg2_ia)
{
bIpoActuator *ia = arg2_ia;
uiBut *but = arg1_but;
@@ -1770,7 +1770,7 @@ static void change_ipo_actuator(bContext *C, void *arg1_but, void *arg2_ia)
but->retval = B_REDR;
}
-void update_object_actuator_PID(bContext *C, void *act, void *arg)
+void update_object_actuator_PID(bContext *UNUSED(C), void *act, void *UNUSED(arg))
{
bObjectActuator *oa = act;
oa->forcerot[0] = 60.0f*oa->forcerot[1];
@@ -2920,7 +2920,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
return yco-4;
}
-static void do_sensor_menu(bContext *C, void *arg, int event)
+static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event)
{
SpaceLogic *slogic= CTX_wm_space_logic(C);
ID **idar;
@@ -2949,7 +2949,7 @@ static void do_sensor_menu(bContext *C, void *arg, int event)
if(idar) MEM_freeN(idar);
}
-static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *arg_unused)
+static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
{
uiBlock *block;
int yco=0;
@@ -2969,7 +2969,7 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *arg_unused)
return block;
}
-static void do_controller_menu(bContext *C, void *arg, int event)
+static void do_controller_menu(bContext *C, void *UNUSED(arg), int event)
{
SpaceLogic *slogic= CTX_wm_space_logic(C);
ID **idar;
@@ -2998,7 +2998,7 @@ static void do_controller_menu(bContext *C, void *arg, int event)
if(idar) MEM_freeN(idar);
}
-static uiBlock *controller_menu(bContext *C, ARegion *ar, void *arg_unused)
+static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
{
uiBlock *block;
int yco=0;
@@ -3018,7 +3018,7 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *arg_unused)
return block;
}
-static void do_actuator_menu(bContext *C, void *arg, int event)
+static void do_actuator_menu(bContext *C, void *UNUSED(arg), int event)
{
SpaceLogic *slogic= CTX_wm_space_logic(C);
ID **idar;
@@ -3047,7 +3047,7 @@ static void do_actuator_menu(bContext *C, void *arg, int event)
if(idar) MEM_freeN(idar);
}
-static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *arg_unused)
+static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
{
uiBlock *block;
int xco=0;
@@ -3069,7 +3069,7 @@ static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *arg_unused)
-static void check_controller_state_mask(bContext *C, void *arg1_but, void *arg2_mask)
+static void check_controller_state_mask(bContext *UNUSED(C), void *arg1_but, void *arg2_mask)
{
unsigned int *cont_mask = arg2_mask;
uiBut *but = arg1_but;
@@ -3122,7 +3122,7 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c
return block;
}
-static void do_object_state_menu(bContext *C, void *arg, int event)
+static void do_object_state_menu(bContext *UNUSED(C), void *arg, int event)
{
Object *ob = arg;
@@ -3579,7 +3579,7 @@ static void draw_controller_python(uiLayout *layout, PointerRNA *ptr)
}
}
-static void draw_controller_state(uiLayout *layout, PointerRNA *ptr)
+static void draw_controller_state(uiLayout *UNUSED(layout), PointerRNA *UNUSED(ptr))
{
}
@@ -3712,7 +3712,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
break;
case ACT_ARM_ENABLE:
case ACT_ARM_DISABLE:
- if (&pose_ptr.data) {
+ if (ob->pose) {
uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
@@ -3720,7 +3720,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
}
break;
case ACT_ARM_SETTARGET:
- if (&pose_ptr.data) {
+ if (ob->pose) {
uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
@@ -3731,7 +3731,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "secondary_target", 0, NULL, 0);
break;
case ACT_ARM_SETWEIGHT:
- if (&pose_ptr.data) {
+ if (ob->pose) {
uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
@@ -4955,7 +4955,7 @@ void logic_buttons(bContext *C, ARegion *ar)
uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0);
sens->otype= sens->type;
- yco= draw_sensorbuttons(ob, sens, block, xco, yco, width,ob->id.name);
+ yco= draw_sensorbuttons(ob, sens, block, xco, yco, width);
if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
}
else {
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 01af324334b..9a3cac02c50 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -82,7 +82,7 @@ ARegion *logic_has_buttons_region(ScrArea *sa)
/* ******************** default callbacks for image space ***************** */
-static SpaceLink *logic_new(const bContext *C)
+static SpaceLink *logic_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceLogic *slogic;
@@ -145,7 +145,7 @@ static SpaceLink *logic_new(const bContext *C)
}
/* not spacelink itself */
-static void logic_free(SpaceLink *sl)
+static void logic_free(SpaceLink *UNUSED(sl))
{
// Spacelogic *slogic= (SpaceLogic*) sl;
@@ -156,7 +156,7 @@ static void logic_free(SpaceLink *sl)
/* spacetype; init callback */
-static void logic_init(struct wmWindowManager *wm, ScrArea *sa)
+static void logic_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -183,7 +183,7 @@ void logic_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0);
}
-static void logic_refresh(const bContext *C, ScrArea *sa)
+static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa))
{
// SpaceLogic *slogic= CTX_wm_space_logic(C);
// Object *obedit= CTX_data_edit_object(C);
@@ -217,11 +217,9 @@ static void logic_listener(ARegion *ar, wmNotifier *wmn)
}
}
-static int logic_context(const bContext *C, const char *member, bContextDataResult *result)
+static int logic_context(const bContext *UNUSED(C), const char *UNUSED(member), bContextDataResult *UNUSED(result))
{
// SpaceLogic *slogic= CTX_wm_space_logic(C);
-
-
return 0;
}
@@ -251,7 +249,7 @@ static void logic_main_area_draw(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
logic_buttons((bContext *)C, ar);
@@ -287,7 +285,7 @@ static void logic_buttons_area_draw(const bContext *C, ARegion *ar)
/************************* header region **************************/
/* add handlers, stuff you only do once or on area/region changes */
-static void logic_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void logic_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index a728cc900c2..49cd09043c2 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -66,7 +66,7 @@
/* -------------- */
-static void do_nla_region_buttons(bContext *C, void *arg, int event)
+static void do_nla_region_buttons(bContext *C, void *UNUSED(arg), int event)
{
//Scene *scene= CTX_data_scene(C);
@@ -172,25 +172,25 @@ static int nla_panel_poll(const bContext *C, PanelType *pt)
}
#endif
-static int nla_animdata_panel_poll(const bContext *C, PanelType *pt)
+static int nla_animdata_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
PointerRNA ptr;
return (nla_panel_context(C, &ptr, NULL, NULL) && (ptr.data != NULL));
}
-static int nla_track_panel_poll(const bContext *C, PanelType *pt)
+static int nla_track_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
PointerRNA ptr;
return (nla_panel_context(C, NULL, &ptr, NULL) && (ptr.data != NULL));
}
-static int nla_strip_panel_poll(const bContext *C, PanelType *pt)
+static int nla_strip_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
PointerRNA ptr;
return (nla_panel_context(C, NULL, NULL, &ptr) && (ptr.data != NULL));
}
-static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *pt)
+static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
PointerRNA ptr;
NlaStrip *strip;
@@ -477,7 +477,7 @@ void nla_buttons_register(ARegionType *art)
BLI_addtail(&art->paneltypes, pt);
}
-static int nla_properties(bContext *C, wmOperator *op)
+static int nla_properties(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= nla_has_buttons_region(sa);
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index b00cba676d0..3cf1dcb5f68 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -433,7 +433,7 @@ void NLA_OT_tracks_add (wmOperatorType *ot)
/* ******************** Delete Tracks Operator ***************************** */
/* Delete selected NLA Tracks */
-static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *op)
+static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index ef9c46c8042..98550b7e452 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -219,7 +219,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co
}
/* helper call for drawing influence/time control curves for a given NLA-strip */
-static void nla_draw_strip_curves (NlaStrip *strip, View2D *v2d, float yminc, float ymaxc)
+static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc)
{
const float yheight = ymaxc - yminc;
@@ -280,7 +280,7 @@ static void nla_draw_strip_curves (NlaStrip *strip, View2D *v2d, float yminc, fl
}
/* main call for drawing a single NLA-strip */
-static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStrip *strip, View2D *v2d, float yminc, float ymaxc)
+static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *UNUSED(nlt), NlaStrip *strip, View2D *v2d, float yminc, float ymaxc)
{
float color[3];
@@ -351,7 +351,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr
* - only if user hasn't hidden them...
*/
if ((snla->flag & SNLA_NOSTRIPCURVES) == 0)
- nla_draw_strip_curves(strip, v2d, yminc, ymaxc);
+ nla_draw_strip_curves(strip, yminc, ymaxc);
/* draw strip outline
* - color used here is to indicate active vs non-active
@@ -414,7 +414,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr
}
/* add the relevant text to the cache of text-strings to draw in pixelspace */
-static void nla_draw_strip_text (NlaTrack *nlt, NlaStrip *strip, int index, View2D *v2d, float yminc, float ymaxc)
+static void nla_draw_strip_text (NlaTrack *UNUSED(nlt), NlaStrip *strip, int UNUSED(index), View2D *v2d, float yminc, float ymaxc)
{
char str[256], dir[3];
rctf rect;
@@ -477,8 +477,6 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
v2d->tot.ymin= (float)(-height);
- /* need to do a view-sync here, so that the strips area doesn't jump around */
- UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL);
/* loop through channels, and set up drawing depending on their type */
y= (float)(-NLACHANNEL_HEIGHT);
@@ -812,7 +810,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
}
}
-void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar)
+void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -837,6 +835,8 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegi
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
v2d->tot.ymin= (float)(-height);
+ /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
+ UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY);
/* draw channels */
{ /* first pass: backdrops + oldstyle drawing */
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 247987cda9f..e13a229fdd1 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -457,7 +457,7 @@ void NLA_OT_transition_add (wmOperatorType *ot)
/* Add new meta-strips incorporating the selected strips */
/* add the specified action as new strip */
-static int nlaedit_add_meta_exec (bContext *C, wmOperator *op)
+static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -518,7 +518,7 @@ void NLA_OT_meta_add (wmOperatorType *ot)
/* ******************** Remove Meta-Strip Operator ***************************** */
/* Separate out the strips held by the selected meta-strips */
-static int nlaedit_remove_meta_exec (bContext *C, wmOperator *op)
+static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -572,7 +572,7 @@ void NLA_OT_meta_remove (wmOperatorType *ot)
* the originals were housed in.
*/
-static int nlaedit_duplicate_exec (bContext *C, wmOperator *op)
+static int nlaedit_duplicate_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -645,7 +645,7 @@ static int nlaedit_duplicate_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
nlaedit_duplicate_exec(C, op);
@@ -677,7 +677,7 @@ void NLA_OT_duplicate (wmOperatorType *ot)
/* ******************** Delete Strips Operator ***************************** */
/* Deletes the selected NLA-Strips */
-static int nlaedit_delete_exec (bContext *C, wmOperator *op)
+static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -810,7 +810,7 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip
}
/* split a given Meta strip */
-static void nlaedit_split_strip_meta (AnimData *adt, NlaTrack *nlt, NlaStrip *strip)
+static void nlaedit_split_strip_meta (NlaTrack *nlt, NlaStrip *strip)
{
/* simply ungroup it for now... */
BKE_nlastrips_clear_metastrip(&nlt->strips, strip);
@@ -818,7 +818,7 @@ static void nlaedit_split_strip_meta (AnimData *adt, NlaTrack *nlt, NlaStrip *st
/* ----- */
-static int nlaedit_split_exec (bContext *C, wmOperator *op)
+static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -852,7 +852,7 @@ static int nlaedit_split_exec (bContext *C, wmOperator *op)
break;
case NLASTRIP_TYPE_META: /* meta-strips need special handling */
- nlaedit_split_strip_meta(adt, nlt, strip);
+ nlaedit_split_strip_meta(nlt, strip);
break;
default: /* for things like Transitions, do not split! */
@@ -893,7 +893,7 @@ void NLA_OT_split (wmOperatorType *ot)
/* ******************** Bake Strips Operator ***************************** */
/* Bakes the NLA Strips for the active AnimData blocks */
-static int nlaedit_bake_exec (bContext *C, wmOperator *op)
+static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -949,7 +949,7 @@ void NLA_OT_bake (wmOperatorType *ot)
/* ******************** Toggle Muting Operator ************************** */
/* Toggles whether strips are muted or not */
-static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *op)
+static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1008,7 +1008,7 @@ void NLA_OT_mute_toggle (wmOperatorType *ot)
/* ******************** Move Strips Up Operator ************************** */
/* Tries to move the selected strips into the track above if possible. */
-static int nlaedit_move_up_exec (bContext *C, wmOperator *op)
+static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1082,7 +1082,7 @@ void NLA_OT_move_up (wmOperatorType *ot)
/* ******************** Move Strips Down Operator ************************** */
/* Tries to move the selected strips into the track above if possible. */
-static int nlaedit_move_down_exec (bContext *C, wmOperator *op)
+static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1250,7 +1250,7 @@ static short bezt_apply_nlamapping (KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
-static int nlaedit_apply_scale_exec (bContext *C, wmOperator *op)
+static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1333,7 +1333,7 @@ void NLA_OT_apply_scale (wmOperatorType *ot)
/* ******************** Clear Scale Operator ***************************** */
/* Reset the scaling of the selected strips to 1.0f */
-static int nlaedit_clear_scale_exec (bContext *C, wmOperator *op)
+static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1544,7 +1544,7 @@ void NLA_OT_snap (wmOperatorType *ot)
/* ******************** Add F-Modifier Operator *********************** */
/* present a special customised popup menu for this, with some filtering */
-static int nla_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *event)
+static int nla_fmodifier_add_invoke (bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
uiPopupMenu *pup;
uiLayout *layout;
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 7570969158b..6906a151936 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -45,7 +45,7 @@ void NLA_OT_properties(wmOperatorType *ot);
/* nla_draw.c */
void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
-void draw_nla_channel_list(bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar);
+void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar);
/* **************************************** */
/* nla_header.c */
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 85a169f2bb0..13380cd17f7 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -156,7 +156,7 @@ void nla_operatortypes(void)
/* ************************** registration - keymaps **********************************/
-static void nla_keymap_channels (wmKeyConfig *keyconf, wmKeyMap *keymap)
+static void nla_keymap_channels(wmKeyMap *keymap)
{
/* NLA-specific (different to standard channels keymap) -------------------------- */
/* selection */
@@ -287,7 +287,7 @@ void nla_keymap(wmKeyConfig *keyconf)
* However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead
*/
keymap= WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0);
- nla_keymap_channels(keyconf, keymap);
+ nla_keymap_channels(keymap);
/* data */
keymap= WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0);
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 92c5ef6c410..25c53687597 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -148,16 +148,17 @@ static SpaceLink *nla_new(const bContext *C)
ar->v2d.cur = ar->v2d.tot;
ar->v2d.min[0]= 0.0f;
- ar->v2d.min[1]= 0.0f;
+ ar->v2d.min[1]= 0.0f;
ar->v2d.max[0]= MAXFRAMEF;
- ar->v2d.max[1]= 10000.0f;
+ ar->v2d.max[1]= 10000.0f;
ar->v2d.minzoom= 0.01f;
ar->v2d.maxzoom= 50;
ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
+ ar->v2d.keepofs= V2D_KEEPOFS_Y;
ar->v2d.align= V2D_ALIGN_NO_POS_Y;
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
@@ -177,7 +178,7 @@ static void nla_free(SpaceLink *sl)
/* spacetype; init callback */
-static void nla_init(struct wmWindowManager *wm, ScrArea *sa)
+static void nla_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
SpaceNla *snla= (SpaceNla *)sa->spacedata.first;
@@ -218,7 +219,6 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
/* draw entirely, view changes should be handled here */
static void nla_channel_area_draw(const bContext *C, ARegion *ar)
{
- SpaceNla *snla= CTX_wm_space_nla(C);
bAnimContext ac;
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
@@ -227,11 +227,11 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
- draw_nla_channel_list((bContext *)C, &ac, snla, ar);
+ draw_nla_channel_list((bContext *)C, &ac, ar);
}
/* reset view matrix */
@@ -272,12 +272,12 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* time grid */
unit= (snla->flag & SNLA_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES;
- grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
- UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL);
+ grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
+ UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL);
UI_view2d_grid_free(grid);
/* data */
@@ -289,7 +289,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_text_cache_draw(ar);
}
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* current frame */
if (snla->flag & SNLA_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS;
@@ -297,11 +297,11 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
ANIM_draw_cfra(C, v2d, flag);
/* markers */
- UI_view2d_view_orthoSpecial(C, v2d, 1);
+ UI_view2d_view_orthoSpecial(ar, v2d, 1);
draw_markers_time(C, 0);
/* preview range */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
ANIM_draw_previewrange(C, v2d);
/* reset view matrix */
@@ -315,7 +315,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
/* add handlers, stuff you only do once or on area/region changes */
-static void nla_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void nla_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 5e0926da216..78ae82c57b0 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -77,7 +77,7 @@ void node_buts_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, "");
}
-static void node_buts_value(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
PointerRNA sockptr;
PropertyRNA *prop;
@@ -89,7 +89,7 @@ static void node_buts_value(uiLayout *layout, bContext *C, PointerRNA *ptr)
uiItemR(layout, &sockptr, "default_value", 0, "", 0);
}
-static void node_buts_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
PointerRNA sockptr;
@@ -104,7 +104,7 @@ static void node_buts_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr)
uiItemR(col, &sockptr, "default_value", 0, "", 0);
}
-static void node_buts_mix_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *row;
@@ -116,7 +116,7 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr)
uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA);
}
-static void node_buts_time(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *row;
#if 0
@@ -138,12 +138,12 @@ static void node_buts_time(uiLayout *layout, bContext *C, PointerRNA *ptr)
uiItemR(row, ptr, "frame_end", 0, "End", 0);
}
-static void node_buts_colorramp(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiTemplateColorRamp(layout, ptr, "color_ramp", 0);
}
-static void node_buts_curvevec(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0);
}
@@ -154,7 +154,7 @@ void node_curvemap_sample(float *col)
_sample_col= col;
}
-static void node_buts_curvecol(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
bNode *node= ptr->data;
CurveMapping *cumap= node->storage;
@@ -169,7 +169,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *C, PointerRNA *ptr)
uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0);
}
-static void node_buts_normal(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiBlock *block= uiLayoutAbsoluteBlock(layout);
bNode *node= ptr->data;
@@ -212,7 +212,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
node->menunr= 0;
}
#endif
-static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v)
+static void node_dynamic_update_cb(bContext *C, void *UNUSED(ntree_v), void *node_v)
{
Main *bmain= CTX_data_main(C);
Material *ma;
@@ -244,7 +244,7 @@ static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v)
// XXX BIF_preview_changed(ID_MA);
}
-static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
bNode *node= ptr->data;
@@ -263,7 +263,7 @@ static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr)
}
}
-static void node_buts_math(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", 0);
}
@@ -312,7 +312,7 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA
uiItemR(col, ptr, "invert_normal", 0, NULL, 0);
}
-static void node_shader_buts_mapping(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *row;
@@ -338,7 +338,7 @@ static void node_shader_buts_mapping(uiLayout *layout, bContext *C, PointerRNA *
}
-static void node_shader_buts_vect_math(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", 0);
}
@@ -524,7 +524,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
}
-static void node_composit_buts_blur(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -548,7 +548,7 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *C, PointerRNA *p
}
}
-static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -572,7 +572,7 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA *
uiItemR(layout, ptr, "zoom", 0, NULL, 0);
}
-static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -582,7 +582,7 @@ static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *C, Poin
uiItemR(col, ptr, "sigma_space", 0, NULL, 0);
}
-static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_defocus(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *sub, *col;
@@ -614,7 +614,7 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA
}
/* qdn: glare node */
-static void node_composit_buts_glare(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_glare(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "glare_type", 0, "", 0);
uiItemR(layout, ptr, "quality", 0, "", 0);
@@ -644,7 +644,7 @@ static void node_composit_buts_glare(uiLayout *layout, bContext *C, PointerRNA *
}
}
-static void node_composit_buts_tonemap(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_tonemap(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -663,7 +663,7 @@ static void node_composit_buts_tonemap(uiLayout *layout, bContext *C, PointerRNA
}
}
-static void node_composit_buts_lensdist(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -676,7 +676,7 @@ static void node_composit_buts_lensdist(uiLayout *layout, bContext *C, PointerRN
uiItemR(col, ptr, "use_fit", 0, NULL, 0);
}
-static void node_composit_buts_vecblur(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -692,17 +692,17 @@ static void node_composit_buts_vecblur(uiLayout *layout, bContext *C, PointerRNA
uiItemR(layout, ptr, "use_curved", 0, NULL, 0);
}
-static void node_composit_buts_filter(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_filter(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "filter_type", 0, "", 0);
}
-static void node_composit_buts_flip(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_flip(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "axis", 0, "", 0);
}
-static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -723,7 +723,7 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *p
}
}
-static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *row, *col;
@@ -733,7 +733,7 @@ static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, Pointe
uiItemR(col, ptr, "factor", 0, NULL, 0);
}
-static void node_composit_buts_map_value(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *sub, *col;
@@ -754,7 +754,7 @@ static void node_composit_buts_map_value(uiLayout *layout, bContext *C, PointerR
uiItemR(sub, ptr, "max", 0, "", 0);
}
-static void node_composit_buts_alphaover(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -763,7 +763,7 @@ static void node_composit_buts_alphaover(uiLayout *layout, bContext *C, PointerR
uiItemR(col, ptr, "premul", 0, NULL, 0);
}
-static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_hue_sat(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -773,12 +773,12 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA
uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0);
}
-static void node_composit_buts_dilateerode(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "distance", 0, NULL, 0);
}
-static void node_composit_buts_diff_matte(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -787,7 +787,7 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *C, Pointer
uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0);
}
-static void node_composit_buts_distance_matte(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -796,7 +796,7 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *C, Poi
uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0);
}
-static void node_composit_buts_color_spill(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *row, *col;
@@ -822,7 +822,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *C, Pointe
}
}
-static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -836,7 +836,7 @@ static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, Point
/*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, NULL, 0); Removed for now*/
}
-static void node_composit_buts_color_matte(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -846,7 +846,7 @@ static void node_composit_buts_color_matte(uiLayout *layout, bContext *C, Pointe
uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0);
}
-static void node_composit_buts_channel_matte(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col, *row;
@@ -872,7 +872,7 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *C, Poin
uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0);
}
-static void node_composit_buts_luma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -881,17 +881,17 @@ static void node_composit_buts_luma_matte(uiLayout *layout, bContext *C, Pointer
uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0);
}
-static void node_composit_buts_map_uv(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "alpha", 0, NULL, 0);
}
-static void node_composit_buts_id_mask(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "index", 0, NULL, 0);
}
-static void node_composit_buts_file_output(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col, *row;
@@ -916,17 +916,17 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *C, Pointe
uiItemR(row, ptr, "frame_end", 0, "End", 0);
}
-static void node_composit_buts_scale(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "space", 0, "", 0);
}
-static void node_composit_buts_rotate(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "filter_type", 0, "", 0);
}
-static void node_composit_buts_invert(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -935,17 +935,17 @@ static void node_composit_buts_invert(uiLayout *layout, bContext *C, PointerRNA
uiItemR(col, ptr, "invert_alpha", 0, NULL, 0);
}
-static void node_composit_buts_premulkey(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_premulkey(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mapping", 0, "", 0);
}
-static void node_composit_buts_view_levels(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_view_levels(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "channel", UI_ITEM_R_EXPAND, NULL, 0);
}
-static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *split, *col, *row;
@@ -990,7 +990,7 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, Point
}
-static void node_composit_buts_huecorrect(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiTemplateCurveMapping(layout, ptr, "mapping", 'h', 0, 0);
}
@@ -1143,7 +1143,7 @@ static void node_composit_set_butfunc(bNodeType *ntype)
/* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */
-static void node_texture_buts_bricks(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_texture_buts_bricks(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -1156,7 +1156,7 @@ static void node_texture_buts_bricks(uiLayout *layout, bContext *C, PointerRNA *
uiItemR(col, ptr, "squash_frequency", 0, "Frequency", 0);
}
-static void node_texture_buts_proc(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
PointerRNA tex_ptr;
bNode *node= ptr->data;
@@ -1215,7 +1215,7 @@ static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *p
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
}
-static void node_texture_buts_output(uiLayout *layout, bContext *C, PointerRNA *ptr)
+static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "filepath", 0, "", 0);
}
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 11319d817c7..954018bfd4f 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -63,7 +63,7 @@
#define B_NOP 1
#define B_REDR 2
-static void do_node_region_buttons(bContext *C, void *arg, int event)
+static void do_node_region_buttons(bContext *C, void *UNUSED(arg), int event)
{
//SpaceNode *snode= CTX_wm_space_node(C);
@@ -75,7 +75,7 @@ static void do_node_region_buttons(bContext *C, void *arg, int event)
}
/* poll callback for active node */
-static int active_node_poll(const bContext *C, PanelType *pt)
+static int active_node_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceNode *snode= CTX_wm_space_node(C);
@@ -135,7 +135,7 @@ void node_buttons_register(ARegionType *art)
BLI_addtail(&art->paneltypes, pt);
}
-static int node_properties(bContext *C, wmOperator *op)
+static int node_properties(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= node_has_buttons_region(sa);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 0b33196c646..a81d6e3b0ce 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -111,7 +111,7 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
return 0;
}
-void ED_node_generic_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node)
+void ED_node_generic_update(Main *bmain, bNodeTree *ntree, bNode *node)
{
Material *ma;
Tex *tex;
@@ -309,7 +309,7 @@ static void node_update(const bContext *C, bNodeTree *ntree, bNode *node)
}
/* based on settings in node, sets drawing rect info. each redraw! */
-static void node_update_hidden(const bContext *C, bNode *node)
+static void node_update_hidden(bNode *node)
{
bNodeSocket *nsock;
float rad, drad, hiddenrad= HIDDEN_RAD;
@@ -392,7 +392,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
node->locy+= gnode->locy;
if(node->flag & NODE_HIDDEN)
- node_update_hidden(C, node);
+ node_update_hidden(node);
else
node_update(C, ntree, node);
node->locx-= gnode->locx;
@@ -483,7 +483,7 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
/* nice AA filled circle */
/* this might have some more generic use */
-static void circle_draw(float x, float y, float size, int type, int col[3])
+static void circle_draw(float x, float y, float size, int col[3])
{
/* 16 values of sin function */
static float si[16] = {
@@ -538,11 +538,11 @@ static void socket_circle_draw(bNodeSocket *sock, float size)
else {
col[0]= 100; col[1]= 200; col[2]= 100;
}
-
- circle_draw(sock->locx, sock->locy, size, sock->type, col);
+
+ circle_draw(sock->locx, sock->locy, size, col);
}
-static void node_sync_cb(bContext *C, void *snode_v, void *node_v)
+static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v)
{
SpaceNode *snode= snode_v;
@@ -1031,9 +1031,14 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
else
BLI_strncpy(showname, ngroup->id.name+2, sizeof(showname));
- // XXX this shows some scaling artifacts
- UI_DrawString(rect.xmin+8.0f, rect.ymax+5.0f, showname);
-
+
+ uiDefBut(gnode->block, LABEL, 0, showname, (short)(rect.xmin+15), (short)(rect.ymax),
+ (int)(rect.xmax - rect.xmin-18.0f), NODE_DY, NULL, 0, 0, 0, 0, "");
+ uiEndBlock(C, gnode->block);
+ uiDrawBlock(C, gnode->block);
+ gnode->block= NULL;
+
+
/* links from groupsockets to the internal nodes */
node_draw_group_links(&ar->v2d, snode, gnode);
@@ -1045,6 +1050,8 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
socket_circle_draw(sock, NODE_SOCKSIZE);
+
+
/* and finally the whole tree */
node_draw_nodetree(C, ar, snode, ngroup);
}
@@ -1059,7 +1066,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
//uiFreeBlocksWin(&sa->uiblocks, sa->win);
@@ -1071,7 +1078,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
snode->aspect= (v2d->cur.xmax - v2d->cur.xmin)/((float)ar->winx);
// XXX snode->curfont= uiSetCurFont_ext(snode->aspect);
- UI_view2d_constant_grid_draw(C, v2d);
+ UI_view2d_constant_grid_draw(v2d);
/* backdrop */
draw_nodespace_back_pix(ar, snode, color_manage);
@@ -1096,7 +1103,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
if(node->flag & NODE_GROUP_EDIT)
node_update_group(C, snode->nodetree, node);
else if(node->flag & NODE_HIDDEN)
- node_update_hidden(C, node);
+ node_update_hidden(node);
else
node_update(C, snode->nodetree, node);
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 968391f271e..b8bfed2b75e 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -98,7 +98,7 @@ static int compo_breakjob(void *cjv)
}
/* called by compo, wmJob sends notifier */
-static void compo_redrawjob(void *cjv, char *str)
+static void compo_redrawjob(void *cjv, char *UNUSED(str))
{
CompoJob *cj= cjv;
@@ -541,7 +541,7 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
ntreeSolveOrder(snode->nodetree);
}
-static int node_group_edit_exec(bContext *C, wmOperator *op)
+static int node_group_edit_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode = CTX_wm_space_node(C);
bNode *gnode;
@@ -556,7 +556,7 @@ static int node_group_edit_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
SpaceNode *snode = CTX_wm_space_node(C);
bNode *gnode;
@@ -1100,7 +1100,7 @@ static void node_link_viewer(SpaceNode *snode, bNode *tonode)
}
-static int node_active_link_viewer(bContext *C, wmOperator *op)
+static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
bNode *node;
@@ -1472,12 +1472,21 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float
/* ****************** Duplicate *********************** */
-static int node_duplicate_exec(bContext *C, wmOperator *op)
+static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
+ bNode *node;
ED_preview_kill_jobs(C);
+ /* simple id user adjustment, node internal functions dont touch this
+ * but operators and readfile.c do. */
+ for(node= snode->edittree->nodes.first; node; node= node->next) {
+ if(node->flag & SELECT) {
+ id_us_plus(node->id);
+ }
+ }
+
ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */
ntreeSolveOrder(snode->edittree);
@@ -1851,7 +1860,7 @@ void NODE_OT_links_cut(wmOperatorType *ot)
// XXX some code needing updating to operators...
/* goes over all scenes, reads render layers */
-static int node_read_renderlayers_exec(bContext *C, wmOperator *op)
+static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
SpaceNode *snode= CTX_wm_space_node(C);
@@ -1893,7 +1902,7 @@ void NODE_OT_read_renderlayers(wmOperatorType *ot)
ot->flag= 0;
}
-static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *op)
+static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
Scene *curscene= CTX_data_scene(C);
@@ -2015,7 +2024,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
}
}
-static int node_hide_exec(bContext *C, wmOperator *op)
+static int node_hide_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
@@ -2045,7 +2054,7 @@ void NODE_OT_hide_toggle(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int node_preview_exec(bContext *C, wmOperator *op)
+static int node_preview_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
@@ -2077,7 +2086,7 @@ void NODE_OT_preview_toggle(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int node_socket_toggle_exec(bContext *C, wmOperator *op)
+static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
bNode *node;
@@ -2128,7 +2137,7 @@ void NODE_OT_hide_socket_toggle(wmOperatorType *ot)
/* ****************** Mute operator *********************** */
-static int node_mute_exec(bContext *C, wmOperator *op)
+static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
bNode *node;
@@ -2170,7 +2179,7 @@ void NODE_OT_mute_toggle(wmOperatorType *ot)
/* ****************** Delete operator ******************* */
-static int node_delete_exec(bContext *C, wmOperator *op)
+static int node_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
bNode *node, *next;
@@ -2211,7 +2220,7 @@ void NODE_OT_delete(wmOperatorType *ot)
/* ****************** Show Cyclic Dependencies Operator ******************* */
-static int node_show_cycles_exec(bContext *C, wmOperator *op)
+static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
@@ -2255,7 +2264,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
errno= 0;
- ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1);
+ ima= BKE_add_image_file(path);
if(!ima) {
BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", path, errno ? strerror(errno) : "Unsupported image format");
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 0711ef66497..64e4bc4cbc8 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -55,7 +55,7 @@
/* ************************ add menu *********************** */
-static void do_node_add(bContext *C, void *arg, int event)
+static void do_node_add(bContext *C, void *UNUSED(arg), int event)
{
SpaceNode *snode= CTX_wm_space_node(C);
bNode *node;
@@ -202,7 +202,7 @@ static void node_menu_add(const bContext *C, Menu *menu)
}
}
-void node_menus_register(ARegionType *art)
+void node_menus_register(void)
{
MenuType *mt;
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 77fda0627e7..cba491deb01 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -41,7 +41,7 @@ ARegion *node_has_buttons_region(ScrArea *sa);
/* node_header.c */
void node_header_buttons(const bContext *C, ARegion *ar);
-void node_menus_register(struct ARegionType *art);
+void node_menus_register(void);
/* node_draw.c */
void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index ec08cdf07ac..402e1b2d1cd 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -241,7 +241,7 @@ void NODE_OT_select_border(wmOperatorType *ot)
/* ****** Select/Deselect All ****** */
-static int node_select_all_exec(bContext *C, wmOperator *op)
+static int node_select_all_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode = CTX_wm_space_node(C);
bNode *first = snode->edittree->nodes.first;
@@ -282,7 +282,7 @@ void NODE_OT_select_all(wmOperatorType *ot)
/* ****** Select Linked To ****** */
-static int node_select_linked_to_exec(bContext *C, wmOperator *op)
+static int node_select_linked_to_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode = CTX_wm_space_node(C);
bNodeLink *link;
@@ -322,7 +322,7 @@ void NODE_OT_select_linked_to(wmOperatorType *ot)
/* ****** Select Linked From ****** */
-static int node_select_linked_from_exec(bContext *C, wmOperator *op)
+static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode = CTX_wm_space_node(C);
bNodeLink *link;
@@ -362,7 +362,7 @@ void NODE_OT_select_linked_from(wmOperatorType *ot)
/* ****** Select Same Type ****** */
-static int node_select_same_type_exec(bContext *C, wmOperator *op)
+static int node_select_same_type_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -388,7 +388,7 @@ void NODE_OT_select_same_type(wmOperatorType *ot)
/* ****** Select The Next/Prev Node Of The Same Type ****** */
-static int node_select_same_type_next_exec(bContext *C, wmOperator *op)
+static int node_select_same_type_next_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -412,7 +412,7 @@ void NODE_OT_select_same_type_next(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int node_select_same_type_prev_exec(bContext *C, wmOperator *op)
+static int node_select_same_type_prev_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode = CTX_wm_space_node(C);
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index b4f09f960d6..48801d4369d 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -140,7 +140,7 @@ static int do_header_node(SpaceNode *snode, bNode *node, float mx, float my)
return 0;
}
-static int do_header_hidden_node(SpaceNode *snode, bNode *node, float mx, float my)
+static int do_header_hidden_node(bNode *node, float mx, float my)
{
rctf totr= node->totr;
@@ -164,7 +164,7 @@ static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, short *mval)
for(next_node(snode->edittree); (node=next_node(NULL));) {
if(node->flag & NODE_HIDDEN) {
- if(do_header_hidden_node(snode, node, mx, my)) {
+ if(do_header_hidden_node(node, mx, my)) {
ED_region_tag_redraw(ar);
return 1;
}
@@ -227,7 +227,7 @@ void NODE_OT_visibility_toggle(wmOperatorType *ot)
/* **************** View All Operator ************** */
-static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode)
+static void snode_home(ScrArea *UNUSED(sa), ARegion *ar, SpaceNode* snode)
{
bNode *node;
rctf *cur, *tot;
@@ -278,7 +278,7 @@ static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode)
UI_view2d_curRect_validate(&ar->v2d);
}
-static int node_view_all_exec(bContext *C, wmOperator *op)
+static int node_view_all_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index c94fcb52e38..d38e2af734b 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -89,7 +89,7 @@ ARegion *node_has_buttons_region(ScrArea *sa)
/* ******************** default callbacks for node space ***************** */
-static SpaceLink *node_new(const bContext *C)
+static SpaceLink *node_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceNode *snode;
@@ -145,14 +145,14 @@ static SpaceLink *node_new(const bContext *C)
}
/* not spacelink itself */
-static void node_free(SpaceLink *sl)
+static void node_free(SpaceLink *UNUSED(sl))
{
}
/* spacetype; init callback */
-static void node_init(struct wmWindowManager *wm, ScrArea *sa)
+static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -306,7 +306,7 @@ static void node_main_area_draw(const bContext *C, ARegion *ar)
/* ************* dropboxes ************* */
-static int node_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if(drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
@@ -345,7 +345,7 @@ static void node_dropboxes(void)
/* add handlers, stuff you only do once or on area/region changes */
-static void node_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void node_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
@@ -452,7 +452,7 @@ void ED_spacetype_node(void)
BLI_addhead(&st->regiontypes, art);
- node_menus_register(art);
+ node_menus_register();
/* regions: listview/buttons */
art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index aaeab9e7843..1f0725c5458 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -120,7 +120,7 @@
/* ************* XXX **************** */
-static void error(const char *dummy, ...) {}
+static void error(const char *UNUSED(arg), ...) {}
/* ********************************** */
@@ -1556,7 +1556,7 @@ static void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short
/* same check needed for both object operation and restrict column button func
* return 0 when in edit mode (cannot restrict view or select)
* otherwise return 1 */
-static int common_restrict_check(bContext *C, Scene *scene, Object *ob)
+static int common_restrict_check(bContext *C, Object *ob)
{
/* Don't allow hide an object in edit mode,
* check the bug #22153 and #21609, #23977
@@ -1575,13 +1575,13 @@ static int common_restrict_check(bContext *C, Scene *scene, Object *ob)
return 1;
}
-void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
Object *ob = (Object *)tselem->id;
/* add check for edit mode */
- if(!common_restrict_check(C, scene, ob)) return;
+ if(!common_restrict_check(C, ob)) return;
if(base || (base= object_in_scene(ob, scene))) {
if((base->object->restrictflag ^= OB_RESTRICT_VIEW)) {
@@ -1590,7 +1590,7 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre
}
}
-static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -1620,7 +1620,7 @@ void OUTLINER_OT_visibility_toggle(wmOperatorType *ot)
/* --- */
-static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -1630,7 +1630,7 @@ static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElemen
}
}
-static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -1658,7 +1658,7 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -1668,7 +1668,7 @@ void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te,
}
}
-static int outliner_toggle_renderability_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -1697,7 +1697,7 @@ void OUTLINER_OT_renderability_toggle(wmOperatorType *ot)
/* --- */
-static int outliner_toggle_expanded_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
ARegion *ar= CTX_wm_region(C);
@@ -1728,7 +1728,7 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
/* --- */
-static int outliner_toggle_selected_exec(bContext *C, wmOperator *op)
+static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
ARegion *ar= CTX_wm_region(C);
@@ -1820,6 +1820,8 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep.");
}
+/* This is not used anywhere at the moment */
+#if 0
/* return 1 when levels were opened */
static int outliner_open_back(SpaceOops *soops, TreeElement *te)
{
@@ -1836,8 +1838,6 @@ static int outliner_open_back(SpaceOops *soops, TreeElement *te)
return retval;
}
-/* This is not used anywhere at the moment */
-#if 0
static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *teFind, int *found)
{
TreeElement *te;
@@ -1863,7 +1863,7 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te
#endif
// XXX just use View2D ops for this?
-void outliner_page_up_down(Scene *scene, ARegion *ar, SpaceOops *soops, int up)
+void outliner_page_up_down(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int up)
{
int dy= ar->v2d.mask.ymax-ar->v2d.mask.ymin;
@@ -1931,15 +1931,14 @@ static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
scene_deselect_all(scene);
ED_base_object_select(base, BA_SELECT);
}
- if(C)
+ if(C) {
ED_base_object_activate(C, base); /* adds notifier */
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ }
}
if(ob!=scene->obedit)
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
-
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
-
}
static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
@@ -2050,12 +2049,14 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
}
}
- WM_event_add_notifier(C, NC_TEXTURE, NULL);
+ if(set)
+ WM_event_add_notifier(C, NC_TEXTURE, NULL);
+
return 0;
}
-static int tree_element_active_lamp(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
+static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set)
{
Object *ob;
@@ -2203,7 +2204,7 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
/* ebones only draw in editmode armature */
-static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
EditBone *ebone= te->directdata;
@@ -2228,7 +2229,7 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te,
return 0;
}
-static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
if(set) {
Object *ob= (Object *)tselem->id;
@@ -2241,7 +2242,7 @@ static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreE
return 0;
}
-static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
if(set) {
Object *ob= (Object *)tselem->id;
@@ -2254,7 +2255,7 @@ static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te,
return 0;
}
-static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
if(set) {
Object *ob= (Object *)tselem->id;
@@ -2266,7 +2267,7 @@ static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStor
return 0;
}
-static int tree_element_active_text(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
+static int tree_element_active_text(bContext *UNUSED(C), Scene *UNUSED(scene), SpaceOops *UNUSED(soops), TreeElement *UNUSED(te), int UNUSED(set))
{
// XXX removed
return 0;
@@ -2291,7 +2292,7 @@ static int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, Tree
return 0;
}
-static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
{
Object *ob= (Object *)tselem->id;
Base *base= object_in_scene(ob, scene);
@@ -2311,7 +2312,7 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te,
return 0;
}
-static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
Sequence *seq= (Sequence*) te->directdata;
@@ -2325,7 +2326,7 @@ static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreE
return(0);
}
-static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
Sequence *seq, *p;
Editing *ed= seq_give_editing(scene, FALSE);
@@ -2352,7 +2353,7 @@ static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeEleme
return(0);
}
-static int tree_element_active_keymap_item(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
+static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
wmKeyMapItem *kmi= te->directdata;
@@ -2397,9 +2398,9 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops,
case TSE_POSEGRP:
return tree_element_active_posegroup(C, scene, te, tselem, set);
case TSE_SEQUENCE:
- return tree_element_active_sequence(C, te, tselem, set);
+ return tree_element_active_sequence(te, tselem, set);
case TSE_SEQUENCE_DUP:
- return tree_element_active_sequence_dup(C, scene, te, tselem, set);
+ return tree_element_active_sequence_dup(scene, te, tselem, set);
case TSE_KEYMAP_ITEM:
return tree_element_active_keymap_item(C, te, tselem, set);
@@ -2659,7 +2660,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T
return 0;
}
-static int outliner_item_rename(bContext *C, wmOperator *op, wmEvent *event)
+static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
SpaceOops *soops= CTX_wm_space_outliner(C);
@@ -2686,39 +2687,6 @@ void OUTLINER_OT_item_rename(wmOperatorType *ot)
ot->poll= ED_operator_outliner_active;
}
-
-
-/* recursive helper for function below */
-static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty)
-{
- TreeStoreElem *tselem= TREESTORE(te);
-
- /* store coord and continue, we need coordinates for elements outside view too */
- te->xs= (float)startx;
- te->ys= (float)(*starty);
- *starty-= OL_H;
-
- if((tselem->flag & TSE_CLOSED)==0) {
- TreeElement *ten;
- for(ten= te->subtree.first; ten; ten= ten->next) {
- outliner_set_coordinates_element(soops, ten, startx+OL_X, starty);
- }
- }
-
-}
-
-/* to retrieve coordinates with redrawing the entire tree */
-static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops)
-{
- TreeElement *te;
- int starty= (int)(ar->v2d.tot.ymax)-OL_H;
- int startx= 0;
-
- for(te= soops->tree.first; te; te= te->next) {
- outliner_set_coordinates_element(soops, te, startx, &starty);
- }
-}
-
static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
{
TreeElement *te, *tes;
@@ -2738,7 +2706,7 @@ static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
return NULL;
}
-static int outliner_show_active_exec(bContext *C, wmOperator *op)
+static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *so= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -2788,6 +2756,66 @@ void OUTLINER_OT_show_active(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/* tse is not in the treestore, we use its contents to find a match */
+static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse)
+{
+ TreeStore *ts= soops->treestore;
+ TreeStoreElem *tselem;
+ int a;
+
+ if(tse->id==NULL) return NULL;
+
+ /* check if 'tse' is in treestore */
+ tselem= ts->data;
+ for(a=0; a<ts->usedelem; a++, tselem++) {
+ if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
+ if(tselem->id==tse->id) {
+ break;
+ }
+ }
+ }
+ if(tselem)
+ return outliner_find_tree_element(&soops->tree, a);
+
+ return NULL;
+}
+
+
+/* Called to find an item based on name.
+ */
+#if 0
+
+/* recursive helper for function below */
+static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty)
+{
+ TreeStoreElem *tselem= TREESTORE(te);
+
+ /* store coord and continue, we need coordinates for elements outside view too */
+ te->xs= (float)startx;
+ te->ys= (float)(*starty);
+ *starty-= OL_H;
+
+ if((tselem->flag & TSE_CLOSED)==0) {
+ TreeElement *ten;
+ for(ten= te->subtree.first; ten; ten= ten->next) {
+ outliner_set_coordinates_element(soops, ten, startx+OL_X, starty);
+ }
+ }
+
+}
+
+/* to retrieve coordinates with redrawing the entire tree */
+static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops)
+{
+ TreeElement *te;
+ int starty= (int)(ar->v2d.tot.ymax)-OL_H;
+ int startx= 0;
+
+ for(te= soops->tree.first; te; te= te->next) {
+ outliner_set_coordinates_element(soops, te, startx, &starty);
+ }
+}
+
/* find next element that has this name */
static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound)
{
@@ -2817,34 +2845,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na
return NULL;
}
-/* tse is not in the treestore, we use its contents to find a match */
-static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse)
-{
- TreeStore *ts= soops->treestore;
- TreeStoreElem *tselem;
- int a;
-
- if(tse->id==NULL) return NULL;
-
- /* check if 'tse' is in treestore */
- tselem= ts->data;
- for(a=0; a<ts->usedelem; a++, tselem++) {
- if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
- if(tselem->id==tse->id) {
- break;
- }
- }
- }
- if(tselem)
- return outliner_find_tree_element(&soops->tree, a);
-
- return NULL;
-}
-
-
-/* Called to find an item based on name.
- */
-void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again, int flags)
+static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags)
{
TreeElement *te= NULL;
TreeElement *last_find;
@@ -2916,6 +2917,7 @@ void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again,
error("Not found: %s", name);
}
}
+#endif
/* helper function for tree_element_shwo_hierarchy() - recursively checks whether subtrees have any objects*/
static int subtree_has_objects(SpaceOops *soops, ListBase *lb)
@@ -2958,7 +2960,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
}
/* show entire object level hierarchy */
-static int outliner_show_hierarchy_exec(bContext *C, wmOperator *op)
+static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops= CTX_wm_space_outliner(C);
ARegion *ar= CTX_wm_region(C);
@@ -3076,7 +3078,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
}
}
-static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem))
{
Material **matar=NULL;
int a, totcol=0;
@@ -3110,7 +3112,7 @@ static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeS
}
}
-static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem))
{
MTex **mtex= NULL;
int a;
@@ -3139,7 +3141,7 @@ static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeSt
}
}
-static void unlink_group_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem)
{
Group *group= (Group *)tselem->id;
@@ -3176,7 +3178,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
/* */
-static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -3187,7 +3189,7 @@ static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
}
}
-static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -3198,7 +3200,7 @@ static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeS
}
}
-static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
@@ -3216,7 +3218,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
}
-static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
if(tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) {
tselem->id->lib= NULL;
@@ -3225,7 +3227,7 @@ static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreEle
}
}
-static void group_linkobs2scene_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
+static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
Group *group= (Group *)tselem->id;
GroupObject *gob;
@@ -3278,7 +3280,7 @@ static void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOop
/* ******************************************** */
-static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem)
+static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
bPoseChannel *pchan= (bPoseChannel *)te->directdata;
@@ -3294,7 +3296,7 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem)
pchan->bone->flag &= ~BONE_HIDDEN_P;
}
-static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
+static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
Bone *bone= (Bone *)te->directdata;
@@ -3310,7 +3312,7 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
bone->flag &= ~BONE_HIDDEN_P;
}
-static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
+static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
EditBone *ebone= (EditBone *)te->directdata;
@@ -3326,7 +3328,7 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem)
ebone->flag &= ~BONE_HIDDEN_A;
}
-static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem)
+static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem))
{
// Sequence *seq= (Sequence*) te->directdata;
if(event==1) {
@@ -3353,7 +3355,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li
}
}
-void outliner_del(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops)
+void outliner_del(bContext *C, Scene *scene, ARegion *UNUSED(ar), SpaceOops *soops)
{
if(soops->outlinevis==SO_SEQUENCE)
@@ -3713,7 +3715,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
}
-static int outliner_operation(bContext *C, wmOperator *op, wmEvent *event)
+static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C);
@@ -3763,7 +3765,7 @@ static int ed_operator_outliner_datablocks_active(bContext *C)
* this function does not do that yet
*/
static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem,
- ID **id, char **path, int *array_index, short *flag, short *groupmode)
+ ID **id, char **path, int *array_index, short *flag, short *UNUSED(groupmode))
{
ListBase hierarchy = {NULL, NULL};
LinkData *ld;
@@ -3979,7 +3981,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m
/* Add Operator ---------------------------------- */
-static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
+static int outliner_drivers_addsel_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soutliner= CTX_wm_space_outliner(C);
@@ -4014,7 +4016,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
/* Remove Operator ---------------------------------- */
-static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
+static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soutliner= CTX_wm_space_outliner(C);
@@ -4189,7 +4191,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
/* Remove Operator ---------------------------------- */
-static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *op)
+static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soutliner= CTX_wm_space_outliner(C);
Scene *scene= CTX_data_scene(C);
@@ -4815,7 +4817,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
}
-static void outliner_back(ARegion *ar, SpaceOops *soops)
+static void outliner_back(ARegion *ar)
{
int ystart;
@@ -4829,7 +4831,7 @@ static void outliner_back(ARegion *ar, SpaceOops *soops)
}
}
-static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops)
+static void outliner_draw_restrictcols(ARegion *ar)
{
int ystart;
@@ -4872,7 +4874,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
- if(!common_restrict_check(C, scene, ob)) return;
+ if(!common_restrict_check(C, ob)) return;
/* deselect objects that are invisible */
if (ob->restrictflag & OB_RESTRICT_VIEW) {
@@ -4889,7 +4891,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
- if(!common_restrict_check(C, scene, ob)) return;
+ if(!common_restrict_check(C, ob)) return;
/* if select restriction has just been turned on */
if (ob->restrictflag & OB_RESTRICT_SELECT) {
@@ -4901,17 +4903,17 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
}
-static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_rend_cb(bContext *C, void *poin, void *UNUSED(poin2))
{
WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, poin);
}
-static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2))
{
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, poin);
}
-static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *poin2)
{
Object *ob = (Object *)poin2;
@@ -4920,7 +4922,7 @@ static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2)
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
}
-static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2)
{
Bone *bone= (Bone *)poin2;
if(bone && (bone->flag & BONE_HIDDEN_P))
@@ -4928,7 +4930,7 @@ static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2)
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
}
-static void restrictbutton_ebone_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2)
{
EditBone *ebone= (EditBone *)poin2;
if(ebone && (ebone->flag & BONE_HIDDEN_A))
@@ -4960,7 +4962,7 @@ static int group_select_flag(Group *gr)
return 0;
}
-static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2, int flag)
+static void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
{
Scene *scene = (Scene *)poin;
GroupObject *gob;
@@ -4988,17 +4990,17 @@ static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2
static void restrictbutton_gr_restrict_view(bContext *C, void *poin, void *poin2)
{
- restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_VIEW);
+ restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_VIEW);
WM_event_add_notifier(C, NC_GROUP, NULL);
}
static void restrictbutton_gr_restrict_select(bContext *C, void *poin, void *poin2)
{
- restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_SELECT);
+ restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_SELECT);
WM_event_add_notifier(C, NC_GROUP, NULL);
}
static void restrictbutton_gr_restrict_render(bContext *C, void *poin, void *poin2)
{
- restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_RENDER);
+ restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_RENDER);
WM_event_add_notifier(C, NC_GROUP, NULL);
}
@@ -5033,7 +5035,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
if (te->idcode == ID_LI) {
char expanded[FILE_MAXDIR + FILE_MAXFILE];
BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE);
- BLI_path_abs(expanded, G.sce);
+ BLI_path_abs(expanded, G.main->name);
if (!BLI_exists(expanded)) {
error("This path does not exist, correct this before saving");
}
@@ -5244,7 +5246,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
}
}
-static void outliner_draw_rnacols(ARegion *ar, SpaceOops *soops, int sizex)
+static void outliner_draw_rnacols(ARegion *ar, int sizex)
{
View2D *v2d= &ar->v2d;
@@ -5296,7 +5298,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
}
}
-static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2)
+static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *arg2)
{
wmOperatorType *ot= arg2;
wmKeyMapItem *kmi= arg_kmi;
@@ -5305,7 +5307,7 @@ static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2)
BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME);
}
-static void operator_search_cb(const struct bContext *C, void *arg_kmi, char *str, uiSearchItems *items)
+static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(arg_kmi), char *str, uiSearchItems *items)
{
wmOperatorType *ot = WM_operatortype_first();
@@ -5456,7 +5458,7 @@ static char *keymap_tweak_dir_menu(void)
}
-static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v)
+static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v))
{
wmKeyMapItem *kmi= kmi_v;
short maptype= keymap_menu_type(kmi->type);
@@ -5543,7 +5545,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
uiDefButS(block, OPTION, 0, "Shift", xstart, (int)te->ys+1, butw3+5, OL_H-1, &kmi->shift, 0, 0, 0, 0, "Modifier"); xstart+= butw3+5;
uiDefButS(block, OPTION, 0, "Ctrl", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->ctrl, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
uiDefButS(block, OPTION, 0, "Alt", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->alt, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
- uiDefButS(block, OPTION, 0, "Cmd", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
+ uiDefButS(block, OPTION, 0, "OS", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
xstart+= 5;
uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->keymodifier, "Key Modifier code");
xstart+= butw3+5;
@@ -5658,16 +5660,16 @@ void draw_outliner(const bContext *C)
UI_view2d_totRect_set(v2d, sizex, sizey);
/* set matrix for 2d-view controls */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* draw outliner stuff (background, hierachy lines and names) */
- outliner_back(ar, soops);
+ outliner_back(ar);
block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS);
outliner_draw_tree((bContext *)C, block, scene, ar, soops);
if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
/* draw rna buttons */
- outliner_draw_rnacols(ar, soops, sizex_rna);
+ outliner_draw_rnacols(ar, sizex_rna);
outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree);
}
else if(soops->outlinevis == SO_KEYMAP) {
@@ -5675,7 +5677,7 @@ void draw_outliner(const bContext *C)
}
else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) {
/* draw restriction columns */
- outliner_draw_restrictcols(ar, soops);
+ outliner_draw_restrictcols(ar);
outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree);
}
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index d91c8caa14c..f31910d8289 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -84,11 +84,11 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
}
-static void outliner_main_area_free(ARegion *ar)
+static void outliner_main_area_free(ARegion *UNUSED(ar))
{
+
}
-
static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
@@ -104,6 +104,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_FRAME:
case ND_RENDER_OPTIONS:
case ND_LAYER:
+ case ND_WORLD:
ED_region_tag_redraw(ar);
break;
}
@@ -116,6 +117,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_PARENT:
+ case ND_OB_SHADING:
ED_region_tag_redraw(ar);
break;
case ND_CONSTRAINT:
@@ -150,6 +152,25 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
if(wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
+ case NC_MATERIAL:
+ switch(wmn->data) {
+ case ND_SHADING:
+ case ND_SHADING_DRAW:
+ ED_region_tag_redraw(ar);
+ break;
+ }
+ break;
+ case NC_TEXTURE:
+ ED_region_tag_redraw(ar);
+ break;
+ case NC_GEOM:
+ switch(wmn->data) {
+ case ND_DATA:
+ /* needed for vertex groups only, no special notifier atm so use NC_GEOM|ND_DATA */
+ ED_region_tag_redraw(ar);
+ break;
+ }
+ break;
}
}
@@ -158,7 +179,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
/* ************************ header outliner area region *********************** */
/* add handlers, stuff you only do once or on area/region changes */
-static void outliner_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void outliner_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
@@ -168,7 +189,7 @@ static void outliner_header_area_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
-static void outliner_header_area_free(ARegion *ar)
+static void outliner_header_area_free(ARegion *UNUSED(ar))
{
}
@@ -189,7 +210,7 @@ static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn)
/* ******************** default callbacks for outliner space ***************** */
-static SpaceLink *outliner_new(const bContext *C)
+static SpaceLink *outliner_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceOops *soutliner;
@@ -233,7 +254,7 @@ static void outliner_free(SpaceLink *sl)
}
/* spacetype; init callback */
-static void outliner_init(wmWindowManager *wm, ScrArea *sa)
+static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 610fecaa543..7e3b14ca04a 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -80,7 +80,7 @@ void SCRIPT_OT_python_file_run(wmOperatorType *ot)
}
-static int script_reload_exec(bContext *C, wmOperator *op)
+static int script_reload_exec(bContext *C, wmOperator *UNUSED(op))
{
#ifndef DISABLE_PYTHON
/* TODO, this crashes on netrender and keying sets, need to look into why
diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c
index 6e65d458451..1159139eff5 100644
--- a/source/blender/editors/space_script/script_header.c
+++ b/source/blender/editors/space_script/script_header.c
@@ -32,7 +32,7 @@
#include "BLI_blenlib.h"
-
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "ED_screen.h"
@@ -50,12 +50,12 @@
/* ************************ header area region *********************** */
-static void do_viewmenu(bContext *C, void *arg, int event)
+static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
{
}
-static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg))
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
@@ -81,7 +81,7 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
return block;
}
-static void do_script_buttons(bContext *C, void *arg, int event)
+static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event)
{
switch(event) {
}
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index f93ddc6efbe..66f630bb5b3 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -61,7 +61,7 @@
/* ******************** default callbacks for script space ***************** */
-static SpaceLink *script_new(const bContext *C)
+static SpaceLink *script_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceScript *sscript;
@@ -107,7 +107,7 @@ static void script_free(SpaceLink *sl)
/* spacetype; init callback */
-static void script_init(struct wmWindowManager *wm, ScrArea *sa)
+static void script_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -145,7 +145,7 @@ static void script_main_area_draw(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* data... */
// BPY_run_python_script(C, "/root/blender-svn/blender25/test.py", NULL);
@@ -164,7 +164,7 @@ static void script_main_area_draw(const bContext *C, ARegion *ar)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void script_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void script_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
@@ -174,7 +174,7 @@ static void script_header_area_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
-static void script_main_area_listener(ARegion *ar, wmNotifier *wmn)
+static void script_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
{
/* context changes */
// XXX - Todo, need the ScriptSpace accessible to get the python script to run.
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index b9db18f7850..5f0693dc43c 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -101,7 +101,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
if(last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
char path[sizeof(last_seq->strip->dir)];
BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
RNA_string_set(op->ptr, identifier, path);
}
}
@@ -152,7 +152,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
}
if((is_file != -1) && relative)
- BLI_path_rel(seq_load->path, G.sce);
+ BLI_path_rel(seq_load->path, G.main->name);
if (RNA_struct_find_property(op->ptr, "frame_end")) {
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index 4394e334614..aa0686bc9bb 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -47,13 +47,13 @@
#include "sequencer_intern.h"
-static void do_sequencer_panel_events(bContext *C, void *arg, int event)
+static void do_sequencer_panel_events(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
{
}
-static void sequencer_panel_view_properties(const bContext *C, Panel *pa)
+static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa)
{
uiBlock *block;
@@ -63,7 +63,7 @@ static void sequencer_panel_view_properties(const bContext *C, Panel *pa)
}
-static void sequencer_panel_properties(const bContext *C, Panel *pa)
+static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa)
{
uiBlock *block;
@@ -92,7 +92,7 @@ void sequencer_buttons_register(ARegionType *art)
/* **************** operator to open/close properties view ************* */
-static int sequencer_properties(bContext *C, wmOperator *op)
+static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= sequencer_has_buttons_region(sa);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 7c6fd83c6aa..c4ae658ce37 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -357,7 +357,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
}
}
-static void draw_seq_extensions(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq)
+static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
{
float x1, x2, y1, y2, pixely, a;
char col[3], blendcol[3];
@@ -586,7 +586,7 @@ Draw a sequence strip, bounds check already made
ARegion is currently only used to get the windows width in pixels
so wave file sample drawing precision is zoom adjusted
*/
-static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq, int outline_tint, float pixelx)
+static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx)
{
View2D *v2d= &ar->v2d;
float x1, x2, y1, y2;
@@ -616,7 +616,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *
/* draw additional info and controls */
if (!is_single_image)
- draw_seq_extensions(scene, ar, sseq, seq);
+ draw_seq_extensions(scene, ar, seq);
draw_seq_handle(v2d, seq, pixelx, SEQ_LEFTHANDLE);
draw_seq_handle(v2d, seq, pixelx, SEQ_RIGHTHANDLE);
@@ -772,7 +772,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
}
/* setting up the view - actual drawing starts here */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
last_texid= glaGetOneInteger(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
@@ -866,7 +866,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
UI_view2d_view_restore(C);
}
-void drawprefetchseqspace(Scene *scene, ARegion *ar, SpaceSeq *sseq)
+void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq)
{
int rectx, recty;
int render_size = sseq->render_size;
@@ -936,7 +936,6 @@ static void draw_seq_backdrop(View2D *v2d)
static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
{
Scene *scene= CTX_data_scene(C);
- SpaceSeq *sseq= CTX_wm_space_seq(C);
View2D *v2d= &ar->v2d;
Sequence *last_seq = seq_active_get(scene);
int sel = 0, j;
@@ -958,7 +957,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
else if (seq->machine > v2d->cur.ymax) continue;
/* strip passed all tests unscathed... so draw it now */
- draw_seq_strip(scene, ar, sseq, seq, outline_tint, pixelx);
+ draw_seq_strip(scene, ar, seq, outline_tint, pixelx);
}
/* draw selected next time round */
@@ -967,14 +966,11 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
/* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */
if (last_seq)
- draw_seq_strip(scene, ar, sseq, last_seq, 120, pixelx);
+ draw_seq_strip(scene, ar, last_seq, 120, pixelx);
}
-static void seq_draw_sfra_efra(const bContext *C, SpaceSeq *sseq, ARegion *ar)
-{
- View2D *v2d= UI_view2d_fromcontext(C);
- Scene *scene= CTX_data_scene(C);
-
+static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
+{
glEnable(GL_BLEND);
/* draw darkened area outside of active timeline
@@ -1016,7 +1012,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* calculate extents of sequencer strips/data
@@ -1029,9 +1025,9 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
draw_seq_backdrop(v2d);
/* regular grid-pattern over the rest of the view (i.e. frame grid lines) */
- UI_view2d_constant_grid_draw(C, v2d);
+ UI_view2d_constant_grid_draw(v2d);
- seq_draw_sfra_efra(C, sseq, ar);
+ seq_draw_sfra_efra(scene, v2d);
/* sequence strips (if there is data available to be drawn) */
if (ed) {
@@ -1043,17 +1039,17 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
}
/* current frame */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
if ((sseq->flag & SEQ_DRAWFRAMES)==0) flag |= DRAWCFRA_UNIT_SECONDS;
if ((sseq->flag & SEQ_NO_DRAW_CFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX;
ANIM_draw_cfra(C, v2d, flag);
/* markers */
- UI_view2d_view_orthoSpecial(C, v2d, 1);
+ UI_view2d_view_orthoSpecial(ar, v2d, 1);
draw_markers_time(C, DRAW_MARKERS_LINES);
/* preview range */
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
ANIM_draw_previewrange(C, v2d);
/* overlap playhead */
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index d1654dc5d37..35f27953633 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -69,11 +69,11 @@
/* own include */
#include "sequencer_intern.h"
-static void error(const char *dummy) {}
-static void waitcursor(int val) {}
-static void activate_fileselect(int d1, char *d2, char *d3, void *d4) {}
-static int pupmenu(const char *dummy) {return 0;}
-static int okee(const char *dummy) {return 0;}
+static void error(const char *UNUSED(dummy)) {}
+static void waitcursor(int UNUSED(val)) {}
+static void activate_fileselect(int UNUSED(d1), char *UNUSED(d2), char *UNUSED(d3), void *UNUSED(d4)) {}
+static int pupmenu(const char *UNUSED(dummy)) {return 0;}
+static int okee(const char *UNUSED(dummy)) {return 0;}
/* XXX */
@@ -159,7 +159,7 @@ static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect
struct SeqEffectHandle sh;
Sequence *last_seq= seq_active_get(scene);
- if(last_seq && last_seq->type != SEQ_PLUGIN) return;
+ if(last_seq==NULL || last_seq->type != SEQ_PLUGIN) return;
sh = get_sequence_effect(last_seq);
sh.free(last_seq);
@@ -468,7 +468,7 @@ static void reload_sound_strip(Scene *scene, char *name)
}
#endif
-static void reload_image_strip(Scene *scene, char *name)
+static void reload_image_strip(Scene *scene, char *UNUSED(name))
{
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq=NULL, *seqact;
@@ -735,7 +735,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
}
-static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cutframe)
+static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
{
TransSeq ts;
Sequence *seqn = 0;
@@ -782,13 +782,13 @@ static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cut
}
}
- reload_sequence_new_file(bmain, scene, seq, FALSE);
+ reload_sequence_new_file(scene, seq, FALSE);
calc_sequence(scene, seq);
new_tstripdata(seq);
if (!skip_dup) {
/* Duplicate AFTER the first change */
- seqn = seq_dupli_recursive(scene, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
+ seqn = seq_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
}
if (seqn) {
@@ -822,14 +822,14 @@ static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cut
seqn->startstill = 0;
}
- reload_sequence_new_file(bmain, scene, seqn, FALSE);
+ reload_sequence_new_file(scene, seqn, FALSE);
calc_sequence(scene, seqn);
new_tstripdata(seqn);
}
return seqn;
}
-static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cutframe)
+static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
{
TransSeq ts;
Sequence *seqn = 0;
@@ -879,7 +879,7 @@ static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cut
if (!skip_dup) {
/* Duplicate AFTER the first change */
- seqn = seq_dupli_recursive(scene, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
+ seqn = seq_dupli_recursive(scene, NULL, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
}
if (seqn) {
@@ -919,8 +919,8 @@ static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cut
/* like duplicate, but only duplicate and cut overlapping strips,
* strips to the left of the cutframe are ignored and strips to the right are moved into the new list */
-static int cut_seq_list(Main *bmain, Scene *scene, ListBase *old, ListBase *new, int cutframe,
- Sequence * (*cut_seq)(Main *, Scene *, Sequence *, int))
+static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe,
+ Sequence * (*cut_seq)(Scene *, Sequence *, int))
{
int did_something = FALSE;
Sequence *seq, *seq_next;
@@ -934,7 +934,7 @@ static int cut_seq_list(Main *bmain, Scene *scene, ListBase *old, ListBase *new,
if(seq->flag & SELECT) {
if(cutframe > seq->startdisp &&
cutframe < seq->enddisp) {
- Sequence * seqn = cut_seq(bmain, scene, seq, cutframe);
+ Sequence * seqn = cut_seq(scene, seq, cutframe);
if (seqn) {
BLI_addtail(new, seqn);
}
@@ -992,7 +992,7 @@ void touch_seq_files(Scene *scene)
if(seq->flag & SELECT) {
if(seq->type==SEQ_MOVIE) {
if(seq->strip && seq->strip->stripdata) {
- BLI_make_file_string(G.sce, str, seq->strip->dir, seq->strip->stripdata->name);
+ BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name);
BLI_touch(seq->name);
}
}
@@ -1004,7 +1004,8 @@ void touch_seq_files(Scene *scene)
waitcursor(0);
}
-void set_filter_seq(Main *bmain, Scene *scene)
+/*
+static void set_filter_seq(Scene *scene)
{
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
@@ -1018,15 +1019,15 @@ void set_filter_seq(Main *bmain, Scene *scene)
if(seq->flag & SELECT) {
if(seq->type==SEQ_MOVIE) {
seq->flag |= SEQ_FILTERY;
- reload_sequence_new_file(bmain, scene, seq, FALSE);
+ reload_sequence_new_file(scene, seq, FALSE);
calc_sequence(scene, seq);
}
}
}
SEQ_END
-
}
+*/
void seq_remap_paths(Scene *scene)
{
@@ -1185,7 +1186,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene = CTX_data_scene(C);
@@ -1310,7 +1311,7 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
/* lock operator */
-static int sequencer_lock_exec(bContext *C, wmOperator *op)
+static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -1343,7 +1344,7 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot)
}
/* unlock operator */
-static int sequencer_unlock_exec(bContext *C, wmOperator *op)
+static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -1376,7 +1377,7 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot)
}
/* reload operator */
-static int sequencer_reload_exec(bContext *C, wmOperator *op)
+static int sequencer_reload_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -1409,7 +1410,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot)
}
/* reload operator */
-static int sequencer_refresh_all_exec(bContext *C, wmOperator *op)
+static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -1506,7 +1507,6 @@ static EnumPropertyItem prop_cut_types[] = {
static int sequencer_cut_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
int cut_side, cut_hard, cut_frame;
@@ -1521,11 +1521,9 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
newlist.first= newlist.last= NULL;
if (cut_hard==SEQ_CUT_HARD) {
- changed = cut_seq_list(bmain, scene,
- ed->seqbasep, &newlist, cut_frame, cut_seq_hard);
+ changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard);
} else {
- changed = cut_seq_list(bmain, scene,
- ed->seqbasep, &newlist, cut_frame, cut_seq_soft);
+ changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft);
}
if (newlist.first) { /* got new strips ? */
@@ -1609,7 +1607,7 @@ static int apply_unique_name_cb(Sequence *seq, void *arg_pt)
}
-static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op)
+static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -1619,7 +1617,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op)
if(ed==NULL)
return OPERATOR_CANCELLED;
- seqbase_dupli_recursive(scene, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT);
+ seqbase_dupli_recursive(scene, NULL, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT);
if(nseqbase.first) {
Sequence * seq= nseqbase.first;
@@ -1636,7 +1634,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
sequencer_add_duplicate_exec(C, op);
@@ -1666,7 +1664,7 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
}
/* delete operator */
-static int sequencer_delete_exec(bContext *C, wmOperator *op)
+static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -1840,7 +1838,7 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot)
/* META Operators */
/* separate_meta_toggle operator */
-static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op)
+static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -1985,7 +1983,7 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm)
}
/* separate_meta_make operator */
-static int sequencer_meta_separate_exec(bContext *C, wmOperator *op)
+static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -2046,7 +2044,7 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
}
/* view_all operator */
-static int sequencer_view_all_exec(bContext *C, wmOperator *op)
+static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op))
{
//Scene *scene= CTX_data_scene(C);
bScreen *sc= CTX_wm_screen(C);
@@ -2078,7 +2076,7 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot)
}
/* view_all operator */
-static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op)
+static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
{
bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
@@ -2189,7 +2187,7 @@ static EnumPropertyItem view_type_items[] = {
#endif
/* view_all operator */
-static int sequencer_view_toggle_exec(bContext *C, wmOperator *op)
+static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C);
@@ -2218,7 +2216,7 @@ void SEQUENCER_OT_view_toggle(wmOperatorType *ot)
/* view_selected operator */
-static int sequencer_view_selected_exec(bContext *C, wmOperator *op)
+static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
View2D *v2d= UI_view2d_fromcontext(C);
@@ -2354,7 +2352,7 @@ static int next_prev_edit_internal(Scene *scene, int side)
}
/* move frame to next edit point operator */
-static int sequencer_next_edit_exec(bContext *C, wmOperator *op)
+static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
@@ -2384,7 +2382,7 @@ void SEQUENCER_OT_next_edit(wmOperatorType *ot)
}
/* move frame to previous edit point operator */
-static int sequencer_previous_edit_exec(bContext *C, wmOperator *op)
+static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
@@ -2518,7 +2516,7 @@ void SEQUENCER_OT_swap(wmOperatorType *ot)
RNA_def_enum(ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap");
}
-static int sequencer_rendersize_exec(bContext *C, wmOperator *op)
+static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
{
int retval = OPERATOR_CANCELLED;
Scene *scene= CTX_data_scene(C);
@@ -2595,7 +2593,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- seqbase_dupli_recursive(scene, &seqbase_clipboard, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME);
+ seqbase_dupli_recursive(scene, NULL, &seqbase_clipboard, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME);
seqbase_clipboard_frame= scene->r.cfra;
/* Need to remove anything that references the current scene */
@@ -2638,7 +2636,7 @@ static void seq_offset(Scene *scene, Sequence *seq, int ofs)
calc_sequence_disp(scene, seq);
}
-static int sequencer_paste_exec(bContext *C, wmOperator *op)
+static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */
@@ -2649,7 +2647,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op)
deselect_all_seq(scene);
ofs = scene->r.cfra - seqbase_clipboard_frame;
- seqbase_dupli_recursive(scene, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME);
+ seqbase_dupli_recursive(scene, NULL, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME);
/* transform pasted strips before adding */
if(ofs) {
diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c
index d9d027823bc..f5c8388bf67 100644
--- a/source/blender/editors/space_sequencer/sequencer_scopes.c
+++ b/source/blender/editors/space_sequencer/sequencer_scopes.c
@@ -143,7 +143,7 @@ static void wform_put_grid(unsigned char * tgt, int w, int h)
static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
{
- struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0);
+ struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
int x,y;
unsigned char* src = (unsigned char*) ibuf->rect;
unsigned char* tgt = (unsigned char*) rval->rect;
@@ -189,7 +189,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf)
{
- struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0);
+ struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
int x,y;
float* src = ibuf->rect_float;
unsigned char* tgt = (unsigned char*) rval->rect;
@@ -249,7 +249,7 @@ struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf)
static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(
- ibuf->x + 3, 515, 32, IB_rect, 0);
+ ibuf->x + 3, 515, 32, IB_rect);
int x,y;
unsigned char* src = (unsigned char*) ibuf->rect;
unsigned char* tgt = (unsigned char*) rval->rect;
@@ -299,7 +299,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
struct ImBuf * ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(
- ibuf->x + 3, 515, 32, IB_rect, 0);
+ ibuf->x + 3, 515, 32, IB_rect);
int x,y;
float* src = ibuf->rect_float;
unsigned char* tgt = (unsigned char*) rval->rect;
@@ -422,7 +422,7 @@ static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc)
struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc)
{
- struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect, 0);
+ struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect);
if (src->rect_float) {
draw_zebra_float(src, ibuf, perc);
@@ -463,7 +463,7 @@ static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col)
static struct ImBuf *make_histogram_view_from_ibuf_byte(
struct ImBuf * ibuf)
{
- struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect, 0);
+ struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect);
int n,c,x,y;
unsigned char* src = (unsigned char*) ibuf->rect;
@@ -517,7 +517,7 @@ static int get_bin_float(float f)
static struct ImBuf *make_histogram_view_from_ibuf_float(
struct ImBuf * ibuf)
{
- struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect, 0);
+ struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect);
int n,c,x,y;
float* src = ibuf->rect_float;
@@ -596,7 +596,7 @@ static void vectorscope_put_cross(unsigned char r, unsigned char g,
static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
{
- struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0);
+ struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect);
int x,y;
char* src = (char*) ibuf->rect;
char* tgt = (char*) rval->rect;
@@ -643,7 +643,7 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
{
- struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0);
+ struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect);
int x,y;
float* src = ibuf->rect_float;
char* tgt = (char*) rval->rect;
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index a61e05517d9..720aa098ff6 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -58,7 +58,7 @@
/* own include */
#include "sequencer_intern.h"
-static void *find_nearest_marker(int d1, int d2) {return NULL;}
+static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2)) {return NULL;}
void select_surrounding_handles(Scene *scene, Sequence *test) /* XXX BRING BACK */
{
@@ -209,7 +209,7 @@ void select_neighbor_from_last(Scene *scene, int lr)
/* (de)select operator */
-static int sequencer_deselect_exec(bContext *C, wmOperator *op)
+static int sequencer_deselect_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -255,7 +255,7 @@ void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot)
/* (de)select operator */
-static int sequencer_select_inverse_exec(bContext *C, wmOperator *op)
+static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -582,7 +582,7 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) {
/* select more operator */
-static int sequencer_select_more_exec(bContext *C, wmOperator *op)
+static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
@@ -613,7 +613,7 @@ void SEQUENCER_OT_select_more(wmOperatorType *ot)
/* select less operator */
-static int sequencer_select_less_exec(bContext *C, wmOperator *op)
+static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
@@ -700,7 +700,7 @@ void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot)
/* select linked operator */
-static int sequencer_select_linked_exec(bContext *C, wmOperator *op)
+static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
int selected;
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index a4b7a17ec13..84daf04e4aa 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -236,7 +236,7 @@ static SpaceLink *sequencer_new(const bContext *C)
}
/* not spacelink itself */
-static void sequencer_free(SpaceLink *sl)
+static void sequencer_free(SpaceLink *UNUSED(sl))
{
// SpaceSeq *sseq= (SpaceSequencer*) sl;
@@ -246,7 +246,7 @@ static void sequencer_free(SpaceLink *sl)
/* spacetype; init callback */
-static void sequencer_init(struct wmWindowManager *wm, ScrArea *sa)
+static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -296,7 +296,7 @@ static void sequencer_main_area_draw(const bContext *C, ARegion *ar)
/* ************* dropboxes ************* */
-static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if(drag->type==WM_DRAG_PATH)
if(ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
@@ -304,7 +304,7 @@ static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
return 0;
}
-static int movie_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int movie_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if(drag->type==WM_DRAG_PATH)
if(ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
@@ -312,7 +312,7 @@ static int movie_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
return 0;
}
-static int sound_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if(drag->type==WM_DRAG_PATH)
if(ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */
@@ -352,7 +352,7 @@ static void sequencer_dropboxes(void)
/* ************* end drop *********** */
/* add handlers, stuff you only do once or on area/region changes */
-static void sequencer_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void sequencer_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c
index fbf6d8c85c9..c857d33bcab 100644
--- a/source/blender/editors/space_sound/sound_header.c
+++ b/source/blender/editors/space_sound/sound_header.c
@@ -34,6 +34,7 @@
#include "BLI_blenlib.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "ED_screen.h"
@@ -53,12 +54,12 @@
/* ************************ header area region *********************** */
-static void do_viewmenu(bContext *C, void *arg, int event)
+static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
{
}
-static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg))
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
@@ -84,7 +85,7 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
return block;
}
-static void do_sound_buttons(bContext *C, void *arg, int event)
+static void do_sound_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event)
{
switch(event) {
}
diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c
index 905e1d6cdd9..99b24479967 100644
--- a/source/blender/editors/space_sound/space_sound.c
+++ b/source/blender/editors/space_sound/space_sound.c
@@ -55,7 +55,7 @@
/* ******************** default callbacks for sound space ***************** */
-static SpaceLink *sound_new(const bContext *C)
+static SpaceLink *sound_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceSound *ssound;
@@ -106,7 +106,7 @@ static SpaceLink *sound_new(const bContext *C)
}
/* not spacelink itself */
-static void sound_free(SpaceLink *sl)
+static void sound_free(SpaceLink *UNUSED(sl))
{
// SpaceSound *ssound= (SpaceSound*) sl;
@@ -115,7 +115,7 @@ static void sound_free(SpaceLink *sl)
/* spacetype; init callback */
-static void sound_init(struct wmWindowManager *wm, ScrArea *sa)
+static void sound_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -153,7 +153,7 @@ static void sound_main_area_draw(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* data... */
@@ -169,13 +169,13 @@ void sound_operatortypes(void)
}
-void sound_keymap(struct wmKeyConfig *keyconf)
+void sound_keymap(struct wmKeyConfig *UNUSED(keyconf))
{
}
/* add handlers, stuff you only do once or on area/region changes */
-static void sound_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void sound_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
}
@@ -194,7 +194,7 @@ static void sound_header_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
- UI_view2d_view_ortho(C, &ar->v2d);
+ UI_view2d_view_ortho(&ar->v2d);
sound_header_buttons(C, ar);
@@ -202,7 +202,7 @@ static void sound_header_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
}
-static void sound_main_area_listener(ARegion *ar, wmNotifier *wmn)
+static void sound_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
{
/* context changes */
}
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 7f7a07f8cf7..06346bc89ed 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -59,7 +59,7 @@
/* ******************** default callbacks for text space ***************** */
-static SpaceLink *text_new(const bContext *C)
+static SpaceLink *text_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceText *stext;
@@ -92,11 +92,12 @@ static void text_free(SpaceLink *sl)
SpaceText *stext= (SpaceText*) sl;
stext->text= NULL;
+ text_free_caches(stext);
}
/* spacetype; init callback */
-static void text_init(struct wmWindowManager *wm, ScrArea *sa)
+static void text_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -104,9 +105,11 @@ static void text_init(struct wmWindowManager *wm, ScrArea *sa)
static SpaceLink *text_duplicate(SpaceLink *sl)
{
SpaceText *stextn= MEM_dupallocN(sl);
-
+
/* clear or remove stuff from old */
-
+
+ stextn->drawcache= NULL; /* space need it's own cache */
+
return (SpaceLink *)stextn;
}
@@ -132,8 +135,11 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
switch(wmn->action) {
case NA_EDITED:
- if(st->text)
+ if(st->text) {
+ text_drawcache_tag_update(st, 1);
text_update_edited(st->text);
+ }
+
ED_area_tag_redraw(sa);
/* no break -- fall down to tag redraw */
case NA_ADDED:
@@ -378,7 +384,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- // UI_view2d_view_ortho(C, v2d);
+ // UI_view2d_view_ortho(v2d);
/* data... */
draw_text_main(st, ar);
@@ -389,7 +395,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar)
/* scrollers? */
}
-static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
+static void text_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar))
{
WM_cursor_set(win, BC_TEXTEDITCURSOR);
}
@@ -398,7 +404,7 @@ static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
/* ************* dropboxes ************* */
-static int text_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int text_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if(drag->type==WM_DRAG_PATH)
if(ELEM(drag->icon, 0, ICON_FILE_BLANK)) /* rule might not work? */
@@ -427,7 +433,7 @@ static void text_dropboxes(void)
/****************** header region ******************/
/* add handlers, stuff you only do once or on area/region changes */
-static void text_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void text_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index be2d993dab5..024eef9092a 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -10,7 +10,6 @@
*
* 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
@@ -68,11 +67,11 @@ static void text_font_begin(SpaceText *st)
BLF_size(mono, st->lheight, 72);
}
-static void text_font_end(SpaceText *st)
+static void text_font_end(SpaceText *UNUSED(st))
{
}
-static int text_font_draw(SpaceText *st, int x, int y, char *str)
+static int text_font_draw(SpaceText *UNUSED(st), int x, int y, char *str)
{
BLF_position(mono, x, y, 0);
BLF_draw(mono, str);
@@ -93,7 +92,7 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c)
return st->cwidth;
}
-int text_font_width(SpaceText *st, char *str)
+int text_font_width(SpaceText *UNUSED(st), char *str)
{
return BLF_width(mono, str);
}
@@ -521,9 +520,22 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *
linep= text->lines.first;
i= st->top;
while(i>0 && linep) {
- if(linep == linein) return; /* Line before top */
- linep= linep->next;
- i--;
+ int lines= text_get_visible_lines(st, ar, linep->line);
+
+ /* Line before top */
+ if(linep == linein) {
+ if(lines <= i)
+ /* no visible part of line */
+ return;
+ }
+
+ if (i-lines<0) {
+ break;
+ } else {
+ linep= linep->next;
+ (*offl)+= lines-1;
+ i-= lines;
+ }
}
max= wrap_width(st, ar);
@@ -548,10 +560,18 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *
while(chars--) {
if(i-start>=max) {
- if(chop && linep==linein && i >= cursin)
+ if(chop && linep==linein && i >= cursin) {
+ if (i==cursin) {
+ (*offl)++;
+ *offc -= end-start;
+ }
+
return;
+ }
+
(*offl)++;
*offc -= end-start;
+
start= end;
end += max;
chop= 1;
@@ -570,7 +590,66 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *
}
}
-static int get_char_pos(SpaceText *st, char *line, int cur)
+void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc)
+{
+ int i, j, start, end, chars, max, chop;
+ char ch;
+
+ *offl= *offc= 0;
+
+ if(!st->text) return;
+ if(!st->wordwrap) return;
+
+ max= wrap_width(st, ar);
+
+ start= 0;
+ end= max;
+ chop= 1;
+ chars= 0;
+ *offc= 0;
+
+ for(i=0, j=0; linein->line[j]!='\0'; j++) {
+
+ /* Mimic replacement of tabs */
+ ch= linein->line[j];
+ if(ch=='\t') {
+ chars= st->tabnumber-i%st->tabnumber;
+ if(i<cursin) cursin += chars-1;
+ ch= ' ';
+ }
+ else
+ chars= 1;
+
+ while(chars--) {
+ if(i-start>=max) {
+ if(chop && i >= cursin) {
+ if (i==cursin) {
+ (*offl)++;
+ *offc -= end-start;
+ }
+
+ return;
+ }
+
+ (*offl)++;
+ *offc -= end-start;
+
+ start= end;
+ end += max;
+ chop= 1;
+ }
+ else if(ch==' ' || ch=='-') {
+ end = i+1;
+ chop= 0;
+ if(i >= cursin)
+ return;
+ }
+ i++;
+ }
+ }
+}
+
+int text_get_char_pos(SpaceText *st, char *line, int cur)
{
int a=0, i;
@@ -583,7 +662,7 @@ static int get_char_pos(SpaceText *st, char *line, int cur)
return a;
}
-static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char *format)
+static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char *format, int skip)
{
FlattenString fs;
int basex, i, a, len, start, end, max, lines;
@@ -599,6 +678,14 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char
end= max;
for(i=0; i<len; i++) {
if(i-start >= max) {
+ /* skip hidden part of line */
+ if(skip) {
+ skip--;
+ start= end;
+ end += max;
+ continue;
+ }
+
/* Draw the visible portion of text on the overshot line */
for(a=start; a<end; a++) {
if(st->showsyntax && format) format_draw_color(format[a]);
@@ -609,6 +696,8 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char
lines++;
start= end;
end += max;
+
+ if(y<=0) break;
}
else if(str[i]==' ' || str[i]=='-') {
end = i+1;
@@ -616,7 +705,7 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char
}
/* Draw the remaining text */
- for(a=start; a<len; a++) {
+ for(a=start; a<len && y > 0; a++) {
if(st->showsyntax && format)
format_draw_color(format[a]);
@@ -631,7 +720,7 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char
static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, char *format)
{
FlattenString fs;
- int r=0, w= 0;
+ int r=0, w= 0, amount;
int *acc;
char *in;
@@ -647,18 +736,26 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra
if(draw) {
if(st->showsyntax && format) {
- int amount, a;
+ int a;
format = format+cshift;
amount = strlen(in);
+ if(maxwidth)
+ amount= MIN2(amount, maxwidth);
for(a = 0; a < amount; a++) {
format_draw_color(format[a]);
x += text_font_draw_character(st, x, y, in[a]);
}
}
- else
+ else {
+ amount = strlen(in);
+ if(maxwidth)
+ amount= MIN2(amount, maxwidth);
+
+ in[amount]= 0;
text_font_draw(st, x, y, in);
+ }
}
else {
while(w-- && *acc++ < maxwidth)
@@ -675,18 +772,307 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra
return r+TXT_OFFSET;
}
+/************************ cache utilities *****************************/
+
+typedef struct DrawCache {
+ int *line_height;
+ int total_lines, nlines;
+
+ /* this is needed to check cache relevance */
+ int winx, wordwrap, showlinenrs, tabnumber;
+ short lheight;
+ char cwidth;
+ char text_id[MAX_ID_NAME];
+
+ /* for partial lines recalculation */
+ short update_flag;
+ int valid_head, valid_tail; /* amount of unchanged lines */
+} DrawCache;
+
+static void text_drawcache_init(SpaceText *st)
+{
+ DrawCache *drawcache= MEM_callocN(sizeof (DrawCache), "text draw cache");
+
+ drawcache->winx= -1;
+ drawcache->nlines= BLI_countlist(&st->text->lines);
+ drawcache->text_id[0]= '\0';
+
+ st->drawcache= drawcache;
+}
+
+static void text_update_drawcache(SpaceText *st, ARegion *ar)
+{
+ DrawCache *drawcache;
+ int full_update= 0, nlines= 0;
+ Text *txt= st->text;
+
+ if(!st->drawcache) text_drawcache_init(st);
+
+ text_update_character_width(st);
+
+ drawcache= (DrawCache *)st->drawcache;
+ nlines= drawcache->nlines;
+
+ /* check if full cache update is needed */
+ full_update|= drawcache->winx != ar->winx; /* area was resized */
+ full_update|= drawcache->wordwrap != st->wordwrap; /* word-wrapping option was toggled */
+ full_update|= drawcache->showlinenrs != st->showlinenrs; /* word-wrapping option was toggled */
+ full_update|= drawcache->tabnumber != st->tabnumber; /* word-wrapping option was toggled */
+ full_update|= drawcache->lheight != st->lheight; /* word-wrapping option was toggled */
+ full_update|= drawcache->cwidth != st->cwidth; /* word-wrapping option was toggled */
+ full_update|= strncmp(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */
+
+ if(st->wordwrap) {
+ /* update line heights */
+ if(full_update || !drawcache->line_height) {
+ drawcache->valid_head = 0;
+ drawcache->valid_tail = 0;
+ drawcache->update_flag = 1;
+ }
+
+ if(drawcache->update_flag) {
+ TextLine *line= st->text->lines.first;
+ int lineno= 0, size, lines_count;
+ int *fp= drawcache->line_height, *new_tail, *old_tail;
+
+ nlines= BLI_countlist(&txt->lines);
+ size= sizeof(int)*nlines;
+
+ if(fp) fp= MEM_reallocN(fp, size);
+ else fp= MEM_callocN(size, "text drawcache line_height");
+
+ drawcache->valid_tail= drawcache->valid_head= 0;
+ old_tail= fp + drawcache->nlines - drawcache->valid_tail;
+ new_tail= fp + nlines - drawcache->valid_tail;
+ memmove(new_tail, old_tail, drawcache->valid_tail);
+
+ drawcache->total_lines= 0;
+
+ if(st->showlinenrs)
+ st->linenrs_tot= (int)floor(log10((float)nlines)) + 1;
+
+ while(line) {
+ if(drawcache->valid_head) { /* we're inside valid head lines */
+ lines_count= fp[lineno];
+ drawcache->valid_head--;
+ } else if (lineno > new_tail - fp) { /* we-re inside valid tail lines */
+ lines_count= fp[lineno];
+ } else {
+ lines_count= text_get_visible_lines(st, ar, line->line);
+ }
+
+ fp[lineno]= lines_count;
+
+ line= line->next;
+ lineno++;
+ drawcache->total_lines+= lines_count;
+ }
+
+ drawcache->line_height= fp;
+ }
+ } else {
+ if(drawcache->line_height) {
+ MEM_freeN(drawcache->line_height);
+ drawcache->line_height= NULL;
+ }
+
+ if(full_update || drawcache->update_flag) {
+ nlines= BLI_countlist(&txt->lines);
+
+ if(st->showlinenrs)
+ st->linenrs_tot= (int)floor(log10((float)nlines)) + 1;
+ }
+
+ drawcache->total_lines= nlines;
+ }
+
+ drawcache->nlines= nlines;
+
+ /* store settings */
+ drawcache->winx = ar->winx;
+ drawcache->wordwrap = st->wordwrap;
+ drawcache->lheight = st->lheight;
+ drawcache->cwidth = st->cwidth;
+ drawcache->showlinenrs = st->showlinenrs;
+ drawcache->tabnumber = st->tabnumber;
+
+ strncpy(drawcache->text_id, txt->id.name, MAX_ID_NAME);
+
+ /* clear update flag */
+ drawcache->update_flag = 0;
+ drawcache->valid_head = 0;
+ drawcache->valid_tail = 0;
+}
+
+void text_drawcache_tag_update(SpaceText *st, int full)
+{
+ DrawCache *drawcache= (DrawCache *)st->drawcache;
+
+ if(drawcache) {
+ Text *txt= st->text;
+
+ if(drawcache->update_flag) {
+ /* happens when tagging update from space listener */
+ /* should do nothing to prevent locally tagged cache be fully recalculated */
+ return;
+ }
+
+ if(!full) {
+ int sellno= BLI_findindex(&txt->lines, txt->sell);
+ int curlno= BLI_findindex(&txt->lines, txt->curl);
+
+ if(curlno < sellno) {
+ drawcache->valid_head= curlno;
+ drawcache->valid_tail= drawcache->nlines - sellno - 1;
+ } else {
+ drawcache->valid_head= sellno;
+ drawcache->valid_tail= drawcache->nlines - curlno - 1;
+ }
+
+ /* quick cache recalculation is also used in delete operator,
+ which could merge lines which are adjusent to current selection lines
+ expand recalculate area to this lines */
+ if(drawcache->valid_head>0) drawcache->valid_head--;
+ if(drawcache->valid_tail>0) drawcache->valid_tail--;
+ } else {
+ drawcache->valid_head= 0;
+ drawcache->valid_tail= 0;
+ }
+
+ drawcache->update_flag= 1;
+ }
+}
+
+void text_free_caches(SpaceText *st)
+{
+ DrawCache *drawcache= (DrawCache *)st->drawcache;
+
+ if(drawcache) {
+ if(drawcache->line_height)
+ MEM_freeN(drawcache->line_height);
+
+ MEM_freeN(drawcache);
+ }
+}
+
+/************************ word-wrap utilities *****************************/
+
+/* cache should be updated in caller */
+int text_get_visible_lines_no(SpaceText *st, int lineno)
+{
+ DrawCache *drawcache= (DrawCache *)st->drawcache;
+
+ return drawcache->line_height[lineno];
+}
+
+int text_get_visible_lines(SpaceText *st, ARegion *ar, char *str)
+{
+ int i, j, start, end, max, lines, chars;
+ char ch;
+
+ max= wrap_width(st, ar);
+ lines= 1;
+ start= 0;
+ end= max;
+ for(i= 0, j= 0; str[j] != '\0'; j++) {
+ /* Mimic replacement of tabs */
+ ch= str[j];
+ if(ch=='\t') {
+ chars= st->tabnumber-i%st->tabnumber;
+ ch= ' ';
+ }
+ else chars= 1;
+
+ while(chars--) {
+ if(i-start >= max) {
+ lines++;
+ start= end;
+ end += max;
+ }
+ else if(ch==' ' || ch=='-') {
+ end= i+1;
+ }
+
+ i++;
+ }
+ }
+
+ return lines;
+}
+
+int text_get_span_wrap(SpaceText *st, ARegion *ar, TextLine *from, TextLine *to)
+{
+ if(st->wordwrap) {
+ int ret=0;
+ TextLine *tmp= from;
+
+ /* Look forwards */
+ while (tmp) {
+ if (tmp == to) return ret;
+ ret+= text_get_visible_lines(st, ar, tmp->line);
+ tmp= tmp->next;
+ }
+
+ return ret;
+ } else return txt_get_span(from, to);
+}
+
+int text_get_total_lines(SpaceText *st, ARegion *ar)
+{
+ DrawCache *drawcache;
+
+ text_update_drawcache(st, ar);
+ drawcache= (DrawCache *)st->drawcache;
+
+ return drawcache->total_lines;
+}
+
+/* Move pointer to first visible line (top) */
+static TextLine *first_visible_line(SpaceText *st, ARegion *ar, int *wrap_top)
+{
+ Text *text= st->text;
+ TextLine* pline= text->lines.first;
+ int i= st->top, lineno= 0;
+ DrawCache *drawcache;
+
+ text_update_drawcache(st, ar);
+ drawcache= (DrawCache *)st->drawcache;
+
+ if(wrap_top) *wrap_top= 0;
+
+ if(st->wordwrap) {
+ while(i>0 && pline) {
+ int lines= text_get_visible_lines_no(st, lineno);
+
+ if (i-lines<0) {
+ if(wrap_top) *wrap_top= i;
+ break;
+ } else {
+ pline= pline->next;
+ i-= lines;
+ lineno++;
+ }
+ }
+ } else {
+ for(i=st->top, pline= text->lines.first; pline->next && i>0; i--)
+ pline= pline->next;
+ }
+
+ return pline;
+}
+
/************************ draw scrollbar *****************************/
static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll)
{
- int lhlstart, lhlend, ltexth;
+ int lhlstart, lhlend, ltexth, sell_off, curl_off;
short barheight, barstart, hlstart, hlend, blank_lines;
short pix_available, pix_top_margin, pix_bottom_margin, pix_bardiff;
pix_top_margin = 8;
pix_bottom_margin = 4;
pix_available = ar->winy - pix_top_margin - pix_bottom_margin;
- ltexth= txt_get_span(st->text->lines.first, st->text->lines.last);
+ ltexth= text_get_total_lines(st, ar);
blank_lines = st->viewlines / 2;
/* nicer code: use scroll rect for entire bar */
@@ -722,10 +1108,10 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll)
st->pix_per_line= (pix_available > 0)? (float) ltexth/pix_available: 0;
if(st->pix_per_line<.1) st->pix_per_line=.1f;
- lhlstart = MIN2(txt_get_span(st->text->lines.first, st->text->curl),
- txt_get_span(st->text->lines.first, st->text->sell));
- lhlend = MAX2(txt_get_span(st->text->lines.first, st->text->curl),
- txt_get_span(st->text->lines.first, st->text->sell));
+ curl_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl);
+ sell_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell);
+ lhlstart = MIN2(curl_off, sell_off);
+ lhlend = MAX2(curl_off, sell_off);
if(ltexth > 0) {
hlstart = (lhlstart * pix_available)/ltexth;
@@ -787,7 +1173,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll)
CLAMP(st->txtscroll.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
}
-static void draw_textscroll(SpaceText *st, ARegion *ar, rcti *scroll)
+static void draw_textscroll(SpaceText *st, rcti *scroll)
{
bTheme *btheme= U.themes.first;
uiWidgetColors wcol= btheme->tui.wcol_scroll;
@@ -811,78 +1197,80 @@ static void draw_markers(SpaceText *st, ARegion *ar)
{
Text *text= st->text;
TextMarker *marker, *next;
- TextLine *top, *bottom, *line;
- int offl, offc, i, cy, x1, x2, y1, y2, x, y;
+ TextLine *top, *line;
+ int offl, offc, i, x1, x2, y1, y2, x, y;
+ int topi, topy;
+
+ /* Move pointer to first visible line (top) */
+ top= first_visible_line(st, ar, NULL);
+ topi= BLI_findindex(&text->lines, top);
- for(i=st->top, top= text->lines.first; top->next && i>0; i--)
- top= top->next;
+ topy= txt_get_span(text->lines.first, top);
- for(i=st->viewlines-1, bottom=top; bottom->next && i>0; i--)
- bottom= bottom->next;
-
for(marker= text->markers.first; marker; marker= next) {
next= marker->next;
- for(cy= 0, line= top; line; cy++, line= line->next) {
- if(cy+st->top==marker->lineno) {
- /* Remove broken markers */
- if(marker->end>line->len || marker->start>marker->end) {
- BLI_freelinkN(&text->markers, marker);
- break;
- }
+ /* invisible line (before top) */
+ if(marker->lineno<topi) continue;
- wrap_offset(st, ar, line, marker->start, &offl, &offc);
- x1= get_char_pos(st, line->line, marker->start) - st->left + offc;
- y1= cy + offl;
- wrap_offset(st, ar, line, marker->end, &offl, &offc);
- x2= get_char_pos(st, line->line, marker->end) - st->left + offc;
- y2= cy + offl;
-
- glColor3ub(marker->color[0], marker->color[1], marker->color[2]);
- x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
- y= ar->winy-3;
-
- if(y1==y2) {
- y -= y1*st->lheight;
- glBegin(GL_LINE_LOOP);
- glVertex2i(x+x2*st->cwidth+1, y);
- glVertex2i(x+x1*st->cwidth-2, y);
- glVertex2i(x+x1*st->cwidth-2, y-st->lheight);
- glVertex2i(x+x2*st->cwidth+1, y-st->lheight);
- glEnd();
- }
- else {
- y -= y1*st->lheight;
- glBegin(GL_LINE_STRIP);
- glVertex2i(ar->winx, y);
- glVertex2i(x+x1*st->cwidth-2, y);
- glVertex2i(x+x1*st->cwidth-2, y-st->lheight);
- glVertex2i(ar->winx, y-st->lheight);
- glEnd();
- y-=st->lheight;
-
- for(i=y1+1; i<y2; i++) {
- glBegin(GL_LINES);
- glVertex2i(x, y);
- glVertex2i(ar->winx, y);
- glVertex2i(x, y-st->lheight);
- glVertex2i(ar->winx, y-st->lheight);
- glEnd();
- y-=st->lheight;
- }
+ line= BLI_findlink(&text->lines, marker->lineno);
- glBegin(GL_LINE_STRIP);
- glVertex2i(x, y);
- glVertex2i(x+x2*st->cwidth+1, y);
- glVertex2i(x+x2*st->cwidth+1, y-st->lheight);
- glVertex2i(x, y-st->lheight);
- glEnd();
- }
+ /* Remove broken markers */
+ if(marker->end>line->len || marker->start>marker->end) {
+ BLI_freelinkN(&text->markers, marker);
+ continue;
+ }
- break;
+ wrap_offset(st, ar, line, marker->start, &offl, &offc);
+ y1 = txt_get_span(top, line) - st->top + offl + topy;
+ x1 = text_get_char_pos(st, line->line, marker->start) - st->left + offc;
+
+ wrap_offset(st, ar, line, marker->end, &offl, &offc);
+ y2 = txt_get_span(top, line) - st->top + offl + topy;
+ x2 = text_get_char_pos(st, line->line, marker->end) - st->left + offc;
+
+ /* invisible part of line (before top, after last visible line) */
+ if(y2 < 0 || y1 > st->top+st->viewlines) continue;
+
+ glColor3ub(marker->color[0], marker->color[1], marker->color[2]);
+ x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+ y= ar->winy-3;
+
+ if(y1==y2) {
+ y -= y1*st->lheight;
+ glBegin(GL_LINE_LOOP);
+ glVertex2i(x+x2*st->cwidth+1, y);
+ glVertex2i(x+x1*st->cwidth-2, y);
+ glVertex2i(x+x1*st->cwidth-2, y-st->lheight);
+ glVertex2i(x+x2*st->cwidth+1, y-st->lheight);
+ glEnd();
+ }
+ else {
+ y -= y1*st->lheight;
+ glBegin(GL_LINE_STRIP);
+ glVertex2i(ar->winx, y);
+ glVertex2i(x+x1*st->cwidth-2, y);
+ glVertex2i(x+x1*st->cwidth-2, y-st->lheight);
+ glVertex2i(ar->winx, y-st->lheight);
+ glEnd();
+ y-=st->lheight;
+
+ for(i=y1+1; i<y2; i++) {
+ glBegin(GL_LINES);
+ glVertex2i(x, y);
+ glVertex2i(ar->winx, y);
+ glVertex2i(x, y-st->lheight);
+ glVertex2i(ar->winx, y-st->lheight);
+ glEnd();
+ y-=st->lheight;
}
- if(line==bottom) break;
+ glBegin(GL_LINE_STRIP);
+ glVertex2i(x, y);
+ glVertex2i(x+x2*st->cwidth+1, y);
+ glVertex2i(x+x2*st->cwidth+1, y-st->lheight);
+ glVertex2i(x, y-st->lheight);
+ glEnd();
}
}
}
@@ -1058,16 +1446,16 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
Text *text= st->text;
int vcurl, vcurc, vsell, vselc, hidden=0;
int offl, offc, x, y, w, i;
-
+
/* Draw the selection */
if(text->curl!=text->sell || text->curc!=text->selc) {
/* Convert all to view space character coordinates */
wrap_offset(st, ar, text->curl, text->curc, &offl, &offc);
vcurl = txt_get_span(text->lines.first, text->curl) - st->top + offl;
- vcurc = get_char_pos(st, text->curl->line, text->curc) - st->left + offc;
+ vcurc = text_get_char_pos(st, text->curl->line, text->curc) - st->left + offc;
wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl;
- vselc = get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
+ vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
if(vcurc<0) vcurc=0;
if(vselc<0) vselc=0, hidden=1;
@@ -1106,7 +1494,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
else {
wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl;
- vselc = get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
+ vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
if(vselc<0) {
vselc= 0;
@@ -1115,17 +1503,30 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
}
if(st->line_hlight) {
- y= ar->winy-2 - vsell*st->lheight;
- if(!(y<0 || y > ar->winy)) { /* check we need to draw */
- int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
- int x2= x1 + ar->winx;
- y= ar->winy-2 - vsell*st->lheight;
-
+ int x1, x2, y1, y2;
+
+ if(st->wordwrap) {
+ int visible_lines = text_get_visible_lines(st, ar, text->sell->line);
+ int offl, offc;
+
+ wrap_offset_in_line(st, ar, text->sell, text->selc, &offl, &offc);
+
+ y1= ar->winy-2 - (vsell-offl)*st->lheight;
+ y2= y1-st->lheight*visible_lines+1;
+ } else {
+ y1= ar->winy-2 - vsell*st->lheight;
+ y2= y1-st->lheight+1;
+ }
+
+ if(!(y1<0 || y2 > ar->winy)) { /* check we need to draw */
+ x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+ x2= x1 + ar->winx;
+
glColor4ub(255, 255, 255, 32);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- glRecti(x1-4, y, x2, y-st->lheight+1);
+ glRecti(x1-4, y1, x2, y2);
glDisable(GL_BLEND);
}
}
@@ -1138,8 +1539,10 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
if(st->overwrite) {
char ch= text->sell->line[text->selc];
- if(!ch) ch= ' ';
+
w= st->cwidth;
+ if(ch=='\t') w*= st->tabnumber-(vselc+st->left)%st->tabnumber;
+
UI_ThemeColor(TH_HILITE);
glRecti(x, y-st->lheight-1, x+w, y-st->lheight+1);
}
@@ -1243,7 +1646,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
/* draw opening bracket */
ch= startl->line[startc];
wrap_offset(st, ar, startl, startc, &offl, &offc);
- viewc= get_char_pos(st, startl->line, startc) - st->left + offc;
+ viewc= text_get_char_pos(st, startl->line, startc) - st->left + offc;
if(viewc >= 0){
viewl= txt_get_span(text->lines.first, startl) - st->top + offl;
@@ -1255,7 +1658,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
/* draw closing bracket */
ch= endl->line[endc];
wrap_offset(st, ar, endl, endc, &offl, &offc);
- viewc= get_char_pos(st, endl->line, endc) - st->left + offc;
+ viewc= text_get_char_pos(st, endl->line, endc) - st->left + offc;
if(viewc >= 0) {
viewl= txt_get_span(text->lines.first, endl) - st->top + offl;
@@ -1273,12 +1676,15 @@ void draw_text_main(SpaceText *st, ARegion *ar)
TextLine *tmp;
rcti scroll;
char linenr[12];
- int i, x, y, winx, linecount= 0;
+ int i, x, y, winx, linecount= 0, lineno= 0;
+ int wraplinecount= 0, wrap_skip= 0;
/* if no text, nothing to do */
if(!text)
return;
+ text_update_drawcache(st, ar);
+
/* make sure all the positional pointers exist */
if(!text->curl || !text->sell || !text->lines.first || !text->lines.last)
txt_clean_text(text);
@@ -1291,12 +1697,28 @@ void draw_text_main(SpaceText *st, ARegion *ar)
/* update syntax formatting if needed */
tmp= text->lines.first;
+ lineno= 0;
for(i= 0; i<st->top && tmp; i++) {
if(st->showsyntax && !tmp->format)
txt_format_line(st, tmp, 0);
- tmp= tmp->next;
- linecount++;
+ if(st->wordwrap) {
+ int lines= text_get_visible_lines_no(st, lineno);
+
+ if (wraplinecount+lines>st->top) {
+ wrap_skip= st->top-wraplinecount;
+ break;
+ } else {
+ wraplinecount+= lines;
+ tmp= tmp->next;
+ linecount++;
+ }
+ } else {
+ tmp= tmp->next;
+ linecount++;
+ }
+
+ lineno++;
}
text_font_begin(st);
@@ -1305,7 +1727,6 @@ void draw_text_main(SpaceText *st, ARegion *ar)
/* draw line numbers background */
if(st->showlinenrs) {
- st->linenrs_tot = (int)floor(log10((float)(linecount + st->viewlines))) + 1;
x= TXT_OFFSET + TEXTXLOC;
UI_ThemeColor(TH_GRID);
@@ -1328,7 +1749,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
if(st->showsyntax && !tmp->format)
txt_format_line(st, tmp, 0);
- if(st->showlinenrs) {
+ if(st->showlinenrs && !wrap_skip) {
/* draw line number */
if(tmp == text->curl)
UI_ThemeColor(TH_HILITE);
@@ -1344,21 +1765,23 @@ void draw_text_main(SpaceText *st, ARegion *ar)
if(st->wordwrap) {
/* draw word wrapped text */
- int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format);
+ int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format, wrap_skip);
y -= lines*st->lheight;
}
else {
/* draw unwrapped text */
- text_draw(st, tmp->line, st->left, 0, 1, x, y, tmp->format);
+ text_draw(st, tmp->line, st->left, ar->winx/st->cwidth, 1, x, y, tmp->format);
y -= st->lheight;
}
+
+ wrap_skip= 0;
}
/* draw other stuff */
draw_brackets(st, ar);
draw_markers(st, ar);
glTranslatef(0.375f, 0.375f, 0.0f); /* XXX scroll requires exact pixel space */
- draw_textscroll(st, ar, &scroll);
+ draw_textscroll(st, &scroll);
draw_documentation(st, ar);
draw_suggestion_list(st, ar);
@@ -1398,6 +1821,12 @@ void text_update_cursor_moved(bContext *C)
text_update_character_width(st);
i= txt_get_span(text->lines.first, text->sell);
+ if(st->wordwrap) {
+ int offl, offc;
+ wrap_offset(st, CTX_wm_region(C), text->sell, text->selc, &offl, &offc);
+ i+= offl;
+ }
+
if(st->top+st->viewlines <= i || st->top > i)
st->top= i - st->viewlines/2;
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 672940cf3cb..464e144515f 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -101,7 +101,7 @@ static int properties_poll(bContext *C)
return (CTX_wm_space_text(C) != NULL);
}
-static int properties_exec(bContext *C, wmOperator *op)
+static int properties_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= text_has_properties_region(sa);
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index a93f30ac62a..c229e685aba 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -53,7 +53,7 @@ int text_check_whitespace(char ch);
int text_font_width_character(struct SpaceText *st);
int text_font_width(struct SpaceText *st, char *str);
-void text_update_line_edited(struct Text *text, struct TextLine *line);
+void text_update_line_edited(struct TextLine *line);
void text_update_edited(struct Text *text);
void text_update_character_width(struct SpaceText *st);
void text_update_cursor_moved(struct bContext *C);
@@ -90,12 +90,20 @@ void flatten_string_free(FlattenString *fs);
int wrap_width(struct SpaceText *st, struct ARegion *ar);
void wrap_offset(struct SpaceText *st, struct ARegion *ar, struct TextLine *linein, int cursin, int *offl, int *offc);
+void wrap_offset_in_line(struct SpaceText *st, struct ARegion *ar, struct TextLine *linep, int cursin, int *offl, int *offc);
+int text_get_char_pos(struct SpaceText *st, char *line, int cur);
+
+void text_drawcache_tag_update(struct SpaceText *st, int full);
+void text_free_caches(struct SpaceText *st);
int text_file_modified(struct Text *text);
int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar);
void text_pop_suggest_list();
+int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, char *str);
+int text_get_span_wrap(struct SpaceText *st, struct ARegion *ar, struct TextLine *from, struct TextLine *to);
+int text_get_total_lines(struct SpaceText *st, struct ARegion *ar);
/* text_ops.c */
enum { LINE_BEGIN, LINE_END, FILE_TOP, FILE_BOTTOM, PREV_CHAR, NEXT_CHAR,
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index ed70f31f970..8d4f3f87f66 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -66,7 +66,7 @@
/************************ poll ***************************/
-static int text_new_poll(bContext *C)
+static int text_new_poll(bContext *UNUSED(C))
{
return 1;
}
@@ -125,7 +125,7 @@ static int text_region_edit_poll(bContext *C)
/********************** updates *********************/
-void text_update_line_edited(Text *text, TextLine *line)
+void text_update_line_edited(TextLine *line)
{
if(!line)
return;
@@ -142,12 +142,12 @@ void text_update_edited(Text *text)
TextLine *line;
for(line=text->lines.first; line; line=line->next)
- text_update_line_edited(text, line);
+ text_update_line_edited(line);
}
/******************* new operator *********************/
-static int new_exec(bContext *C, wmOperator *op)
+static int new_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st= CTX_wm_space_text(C);
Text *text;
@@ -173,6 +173,7 @@ static int new_exec(bContext *C, wmOperator *op)
st->top= 0;
}
+ text_drawcache_tag_update(st, 1);
WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text);
return OPERATOR_FINISHED;
@@ -203,7 +204,7 @@ static void open_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int open_cancel(bContext *C, wmOperator *op)
+static int open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
return OPERATOR_CANCELLED;
@@ -220,7 +221,7 @@ static int open_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", str);
- text= add_text(str, G.sce);
+ text= add_text(str, G.main->name);
if(!text) {
if(op->customdata) MEM_freeN(op->customdata);
@@ -254,6 +255,7 @@ static int open_exec(bContext *C, wmOperator *op)
text->name = NULL;
}
+ text_drawcache_tag_update(st, 1);
WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text);
MEM_freeN(op->customdata);
@@ -261,10 +263,10 @@ static int open_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Text *text= CTX_data_edit_text(C);
- char *path= (text && text->name)? text->name: G.sce;
+ char *path= (text && text->name)? text->name: G.main->name;
if(RNA_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
@@ -315,6 +317,7 @@ static int reload_exec(bContext *C, wmOperator *op)
text_update_edited(text);
text_update_cursor_moved(C);
+ text_drawcache_tag_update(CTX_wm_space_text(C), 1);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
return OPERATOR_FINISHED;
@@ -335,7 +338,7 @@ void TEXT_OT_reload(wmOperatorType *ot)
/******************* delete operator *********************/
-static int unlink_exec(bContext *C, wmOperator *op)
+static int unlink_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
SpaceText *st= CTX_wm_space_text(C);
@@ -357,6 +360,8 @@ static int unlink_exec(bContext *C, wmOperator *op)
unlink_text(bmain, text);
free_libblock(&bmain->text, text);
+
+ text_drawcache_tag_update(st, 1);
WM_event_add_notifier(C, NC_TEXT|NA_REMOVED, NULL);
return OPERATOR_FINISHED;
@@ -380,7 +385,7 @@ void TEXT_OT_unlink(wmOperatorType *ot)
/******************* make internal operator *********************/
-static int make_internal_exec(bContext *C, wmOperator *op)
+static int make_internal_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -433,7 +438,7 @@ static void txt_write_file(Text *text, ReportList *reports)
char file[FILE_MAXDIR+FILE_MAXFILE];
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_path_abs(file, G.sce);
+ BLI_path_abs(file, G.main->name);
fp= fopen(file, "w");
if(fp==NULL) {
@@ -506,7 +511,7 @@ static int save_as_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Text *text= CTX_data_edit_text(C);
char *str;
@@ -519,7 +524,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event)
else if(text->flags & TXT_ISMEM)
str= text->id.name+2;
else
- str= G.sce;
+ str= G.main->name;
RNA_string_set(op->ptr, "filepath", str);
WM_event_add_fileselect(C, op);
@@ -588,7 +593,7 @@ void TEXT_OT_run_script(wmOperatorType *ot)
/******************* refresh pyconstraints operator *********************/
-static int refresh_pyconstraints_exec(bContext *C, wmOperator *op)
+static int refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
{
#ifndef DISABLE_PYTHON
#if 0
@@ -738,6 +743,8 @@ static int paste_exec(bContext *C, wmOperator *op)
if(!buf)
return OPERATOR_CANCELLED;
+ text_drawcache_tag_update(CTX_wm_space_text(C), 0);
+
txt_insert_buf(text, buf);
text_update_edited(text);
@@ -782,7 +789,7 @@ static void txt_copy_clipboard(Text *text)
}
}
-static int copy_exec(bContext *C, wmOperator *op)
+static int copy_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -809,6 +816,8 @@ static int cut_exec(bContext *C, wmOperator *op)
{
Text *text= CTX_data_edit_text(C);
+ text_drawcache_tag_update(CTX_wm_space_text(C), 0);
+
txt_copy_clipboard(text);
txt_delete_selected(text);
@@ -836,10 +845,12 @@ void TEXT_OT_cut(wmOperatorType *ot)
/******************* indent operator *********************/
-static int indent_exec(bContext *C, wmOperator *op)
+static int indent_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
+ text_drawcache_tag_update(CTX_wm_space_text(C), 0);
+
if(txt_has_sel(text)) {
txt_order_cursors(text);
indent(text);
@@ -869,11 +880,13 @@ void TEXT_OT_indent(wmOperatorType *ot)
/******************* unindent operator *********************/
-static int unindent_exec(bContext *C, wmOperator *op)
+static int unindent_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
if(txt_has_sel(text)) {
+ text_drawcache_tag_update(CTX_wm_space_text(C), 0);
+
txt_order_cursors(text);
unindent(text);
@@ -902,13 +915,15 @@ void TEXT_OT_unindent(wmOperatorType *ot)
/******************* line break operator *********************/
-static int line_break_exec(bContext *C, wmOperator *op)
+static int line_break_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
int a, curts;
int space = (text->flags & TXT_TABSTOSPACES) ? st->tabnumber : 1;
+ text_drawcache_tag_update(st, 0);
+
// double check tabs/spaces before splitting the line
curts= setcurr_tab_spaces(text, space);
txt_split_curline(text);
@@ -923,8 +938,8 @@ static int line_break_exec(bContext *C, wmOperator *op)
if(text->curl) {
if(text->curl->prev)
- text_update_line_edited(text, text->curl->prev);
- text_update_line_edited(text, text->curl);
+ text_update_line_edited(text->curl->prev);
+ text_update_line_edited(text->curl);
}
text_update_cursor_moved(C);
@@ -947,11 +962,13 @@ void TEXT_OT_line_break(wmOperatorType *ot)
/******************* comment operator *********************/
-static int comment_exec(bContext *C, wmOperator *op)
+static int comment_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
if(txt_has_sel(text)) {
+ text_drawcache_tag_update(CTX_wm_space_text(C), 0);
+
txt_order_cursors(text);
comment(text);
text_update_edited(text);
@@ -978,11 +995,13 @@ void TEXT_OT_comment(wmOperatorType *ot)
/******************* uncomment operator *********************/
-static int uncomment_exec(bContext *C, wmOperator *op)
+static int uncomment_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
if(txt_has_sel(text)) {
+ text_drawcache_tag_update(CTX_wm_space_text(C), 0);
+
txt_order_cursors(text);
uncomment(text);
text_update_edited(text);
@@ -1130,6 +1149,7 @@ static int convert_whitespace_exec(bContext *C, wmOperator *op)
text_update_edited(text);
text_update_cursor_moved(C);
+ text_drawcache_tag_update(st, 1);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
return OPERATOR_FINISHED;
@@ -1152,7 +1172,7 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot)
/******************* select all operator *********************/
-static int select_all_exec(bContext *C, wmOperator *op)
+static int select_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -1178,7 +1198,7 @@ void TEXT_OT_select_all(wmOperatorType *ot)
/******************* select line operator *********************/
-static int select_line_exec(bContext *C, wmOperator *op)
+static int select_line_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -1204,7 +1224,7 @@ void TEXT_OT_select_line(wmOperatorType *ot)
/******************* previous marker operator *********************/
-static int previous_marker_exec(bContext *C, wmOperator *op)
+static int previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
TextMarker *mrk;
@@ -1240,7 +1260,7 @@ void TEXT_OT_previous_marker(wmOperatorType *ot)
/******************* next marker operator *********************/
-static int next_marker_exec(bContext *C, wmOperator *op)
+static int next_marker_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
TextMarker *mrk;
@@ -1276,7 +1296,7 @@ void TEXT_OT_next_marker(wmOperatorType *ot)
/******************* clear all markers operator *********************/
-static int clear_all_markers_exec(bContext *C, wmOperator *op)
+static int clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text= CTX_data_edit_text(C);
@@ -1317,146 +1337,360 @@ static EnumPropertyItem move_type_items[]= {
{NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""},
{0, NULL, 0, NULL, NULL}};
+/* get cursor position in line by relative wrapped line and column positions */
+static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int rell, int relc)
+{
+ int i, j, start, end, chars, max, chop, curs, loop, endj, found, selc;
+ char ch;
+
+ max= wrap_width(st, ar);
+
+ selc= start= chars= endj= curs= found= 0;
+ end= max;
+ chop= loop= 1;
+
+ for(i=0, j=0; loop; j++) {
+ /* Mimic replacement of tabs */
+ ch= linein->line[j];
+ if(ch=='\t') {
+ chars= st->tabnumber-i%st->tabnumber;
+ ch= ' ';
+ }
+ else chars= 1;
+
+ while(chars--) {
+ if(rell==0 && i-start==relc) {
+ /* current position could be wrapped to next line */
+ /* this should be checked when end of current line would be reached */
+ selc= j;
+ found= 1;
+ }
+ else if(i-end==relc) {
+ curs= j;
+ }
+ if(i-start>=max) {
+ if(found) {
+ /* exact cursor position was found, check if it's */
+ /* still on needed line (hasn't been wrapped) */
+ if(selc>endj && !chop) selc= endj;
+ loop= 0;
+ break;
+ }
+
+ if(chop) endj= j;
+
+ start= end;
+ end += max;
+ chop= 1;
+ rell--;
+
+ if(rell==0 && i-start>=relc) {
+ selc= curs;
+ loop= 0;
+ break;
+ }
+ }
+ else if (ch=='\0') {
+ if(!found) selc= linein->len;
+ loop= 0;
+ break;
+ }
+ else if(ch==' ' || ch=='-') {
+ if(found) {
+ loop= 0;
+ break;
+ }
+
+ if(rell==0 && i-start>=relc) {
+ selc= curs;
+ loop= 0;
+ break;
+ }
+ end= i+1;
+ endj= j;
+ chop= 0;
+ }
+ i++;
+ }
+ }
+
+ return selc;
+}
+
+static int cursor_skip_find_line(SpaceText* st, ARegion *ar,
+ int lines, TextLine **linep, int *charp, int *rell, int *relc)
+{
+ int offl, offc, visible_lines;
+
+ wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
+ *relc= text_get_char_pos(st, (*linep)->line, *charp) + offc;
+ *rell= lines;
+
+ /* handle current line */
+ if(lines>0) {
+ visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
+
+ if(*rell-visible_lines+offl>=0) {
+ if(!(*linep)->next) {
+ if(offl < visible_lines-1) {
+ *rell= visible_lines-1;
+ return 1;
+ }
+
+ *charp= (*linep)->len;
+ return 0;
+ }
+
+ *rell-= visible_lines-offl;
+ *linep=(*linep)->next;
+ } else {
+ *rell+= offl;
+ return 1;
+ }
+ } else {
+ if(*rell+offl<=0) {
+ if(!(*linep)->prev) {
+ if(offl) {
+ *rell= 0;
+ return 1;
+ }
+
+ *charp= 0;
+ return 0;
+ }
+
+ *rell+= offl;
+ *linep=(*linep)->prev;
+ } else {
+ *rell+= offl;
+ return 1;
+ }
+ }
+
+ /* skip lines and find destination line and offsets */
+ while(*linep) {
+ visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
+
+ if(lines<0) { /* moving top */
+ if(*rell+visible_lines >= 0) {
+ *rell+= visible_lines;
+ break;
+ }
+
+ if(!(*linep)->prev) {
+ *rell= 0;
+ break;
+ }
+
+ *rell+= visible_lines;
+ *linep=(*linep)->prev;
+ } else { /* moving bottom */
+ if(*rell-visible_lines < 0) break;
+
+ if(!(*linep)->next) {
+ *rell= visible_lines-1;
+ break;
+ }
+
+ *rell-= visible_lines;
+ *linep=(*linep)->next;
+ }
+ }
+
+ return 1;
+}
+
static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
{
Text *text= st->text;
- int offl, offc, lin;
+ TextLine **linep;
+ int *charp;
+ int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop;
+ char ch;
text_update_character_width(st);
- lin= txt_get_span(text->lines.first, text->sell);
- wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
+ if (sel) linep= &text->sell, charp= &text->selc;
+ else linep= &text->curl, charp= &text->curc;
- if (sel) {
- txt_undo_add_toop(text, UNDO_STO, lin, text->selc, lin, -offc);
- text->selc= -offc;
- } else {
- txt_undo_add_toop(text, UNDO_CTO, lin, text->curc, lin, -offc);
- text->curc= -offc;
- txt_pop_sel(text);
+ oldc= *charp;
+ oldl= txt_get_span(text->lines.first, *linep);
+
+ max= wrap_width(st, ar);
+
+ start= chars= endj= 0;
+ end= max;
+ chop= loop= 1;
+ *charp= 0;
+
+ for(i=0, j=0; loop; j++) {
+ /* Mimic replacement of tabs */
+ ch= (*linep)->line[j];
+ if(ch=='\t') {
+ chars= st->tabnumber-i%st->tabnumber;
+ ch= ' ';
+ }
+ else chars= 1;
+
+ while(chars--) {
+ if(i-start>=max) {
+ *charp= endj;
+
+ if(j>=oldc) {
+ loop= 0;
+ break;
+ }
+
+ if(chop) endj= j;
+
+ start= end;
+ end += max;
+ chop= 0;
+ }
+ else if(ch==' ' || ch=='-' || ch=='\0') {
+ if(j>=oldc) {
+ loop= 0;
+ break;
+ }
+
+ end= i+1;
+ endj= j+1;
+ chop= 0;
+ }
+ i++;
+ }
}
+
+ if (!sel) txt_pop_sel(text);
+ txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp);
}
static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
{
Text *text= st->text;
- int offl, offc, lin, startl, c;
+ TextLine **linep;
+ int *charp;
+ int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop;
+ char ch;
text_update_character_width(st);
- lin= txt_get_span(text->lines.first, text->sell);
- wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
- startl= offl;
- c= text->selc;
- while (offl==startl && text->sell->line[c]!='\0') {
- c++;
- wrap_offset(st, ar, text->sell, c, &offl, &offc);
- } if (offl!=startl) c--;
-
- if (sel) {
- txt_undo_add_toop(text, UNDO_STO, lin, text->selc, lin, c);
- text->selc= c;
- } else {
- txt_undo_add_toop(text, UNDO_CTO, lin, text->curc, lin, c);
- text->curc= c;
- txt_pop_sel(text);
+ if (sel) linep= &text->sell, charp= &text->selc;
+ else linep= &text->curl, charp= &text->curc;
+
+ oldc= *charp;
+ oldl= txt_get_span(text->lines.first, *linep);
+
+ max= wrap_width(st, ar);
+
+ start= chars= endj= 0;
+ end= max;
+ chop= loop= 1;
+ *charp= 0;
+
+ for(i=0, j=0; loop; j++) {
+ /* Mimic replacement of tabs */
+ ch= (*linep)->line[j];
+ if(ch=='\t') {
+ chars= st->tabnumber-i%st->tabnumber;
+ ch= ' ';
+ }
+ else chars= 1;
+
+ while(chars--) {
+ if(i-start>=max) {
+ if(endj>=oldc) {
+ *charp= endj;
+ loop= 0;
+ break;
+ }
+
+ if(chop) endj= j;
+
+ start= end;
+ end += max;
+ chop= 0;
+ } else if(ch=='\0') {
+ *charp= (*linep)->len;
+ loop= 0;
+ break;
+ } else if(ch==' ' || ch=='-') {
+ end= i+1;
+ endj= j;
+ chop= 0;
+ }
+ i++;
+ }
}
+
+ if (!sel) txt_pop_sel(text);
+ txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp);
}
static void wrap_move_up(SpaceText *st, ARegion *ar, short sel)
{
Text *text= st->text;
- int offl, offl_1, offc, fromline, toline, c, target;
+ TextLine **linep;
+ int *charp;
+ int oldl, oldc, offl, offc, col, newl;
text_update_character_width(st);
- wrap_offset(st, ar, text->sell, 0, &offl_1, &offc);
- wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
- fromline= toline= txt_get_span(text->lines.first, text->sell);
- target= text->selc + offc;
+ if (sel) linep= &text->sell, charp= &text->selc;
+ else linep= &text->curl, charp= &text->curc;
- if (offl==offl_1) {
- if (!text->sell->prev) {
- txt_move_bol(text, sel);
- return;
- }
- toline--;
- c= text->sell->prev->len; /* End of prev. line */
- wrap_offset(st, ar, text->sell->prev, c, &offl, &offc);
- c= -offc+target;
+ /* store previous position */
+ oldc= *charp;
+ newl= oldl= txt_get_span(text->lines.first, *linep);
+
+ wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
+ col= text_get_char_pos(st, (*linep)->line, *charp) + offc;
+ if(offl) {
+ *charp= text_get_cursor_rel(st, ar, *linep, offl-1, col);
} else {
- c= -offc-1; /* End of prev. line */
- wrap_offset(st, ar, text->sell, c, &offl, &offc);
- c= -offc+target;
- }
- if (c<0) c=0;
-
- if (sel) {
- txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c);
- if (toline<fromline) text->sell= text->sell->prev;
- if(text->sell) {
- if (c>text->sell->len) c= text->sell->len;
- text->selc= c;
- }
- }
- else if(text->curl) {
- txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c);
- if (toline<fromline) text->curl= text->curl->prev;
- if(text->curl) {
- if (c>text->curl->len) c= text->curl->len;
- text->curc= c;
- txt_pop_sel(text);
- }
+ if((*linep)->prev) {
+ int visible_lines;
+
+ *linep= (*linep)->prev;
+ visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
+ *charp= text_get_cursor_rel(st, ar, *linep, visible_lines-1, col);
+ } else *charp= 0;
}
+
+ if (!sel) txt_pop_sel(text);
+ txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp);
}
static void wrap_move_down(SpaceText *st, ARegion *ar, short sel)
{
Text *text= st->text;
- int offl, startoff, offc, fromline, toline, c, target;
+ TextLine **linep;
+ int *charp;
+ int oldl, oldc, offl, offc, col, newl, visible_lines;
text_update_character_width(st);
- wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
- fromline= toline= txt_get_span(text->lines.first, text->sell);
- target= text->selc + offc;
- startoff= offl;
- c= text->selc;
- while (offl==startoff && text->sell->line[c]!='\0') {
- c++;
- wrap_offset(st, ar, text->sell, c, &offl, &offc);
- }
+ if (sel) linep= &text->sell, charp= &text->selc;
+ else linep= &text->curl, charp= &text->curc;
- if (text->sell->line[c]=='\0') {
- if (!text->sell->next) {
- txt_move_eol(text, sel);
- return;
- }
- toline++;
- c= target;
+ /* store previous position */
+ oldc= *charp;
+ newl= oldl= txt_get_span(text->lines.first, *linep);
+
+ wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
+ col= text_get_char_pos(st, (*linep)->line, *charp) + offc;
+ visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
+ if(offl<visible_lines-1) {
+ *charp= text_get_cursor_rel(st, ar, *linep, offl+1, col);
} else {
- c += target;
- if (c > text->sell->len) c= text->sell->len;
- }
- if (c<0) c=0;
-
- if (sel) {
- txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c);
- if (toline>fromline) text->sell= text->sell->next;
- if(text->sell) {
- if (c>text->sell->len) c= text->sell->len;
- text->selc= c;
- }
- }
- else if(text->curl) {
- txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c);
- if (toline>fromline) text->curl= text->curl->next;
- if(text->curl) {
- if (c > text->curl->len) c= text->curl->len;
- text->curc= c;
- txt_pop_sel(text);
- }
+ if((*linep)->next) {
+ *linep= (*linep)->next;
+ *charp= text_get_cursor_rel(st, ar, *linep, 0, col);
+ } else *charp= (*linep)->len;
}
+
+ if (!sel) txt_pop_sel(text);
+ txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp);
}
/* Moves the cursor vertically by the specified number of lines.
@@ -1465,7 +1699,7 @@ static void wrap_move_down(SpaceText *st, ARegion *ar, short sel)
This is to replace screen_skip for PageUp/Down operations.
*/
-static void cursor_skip(Text *text, int lines, int sel)
+static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int sel)
{
TextLine **linep;
int oldl, oldc, *charp;
@@ -1475,13 +1709,21 @@ static void cursor_skip(Text *text, int lines, int sel)
oldl= txt_get_span(text->lines.first, *linep);
oldc= *charp;
- while (lines>0 && (*linep)->next) {
- *linep= (*linep)->next;
- lines--;
- }
- while (lines<0 && (*linep)->prev) {
- *linep= (*linep)->prev;
- lines++;
+ if(st && ar && st->wordwrap) {
+ int rell, relc;
+
+ /* find line and offsets inside it needed to set cursor position */
+ if(cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc))
+ *charp= text_get_cursor_rel (st, ar, *linep, rell, relc);
+ } else {
+ while (lines>0 && (*linep)->next) {
+ *linep= (*linep)->next;
+ lines--;
+ }
+ while (lines<0 && (*linep)->prev) {
+ *linep= (*linep)->prev;
+ lines++;
+ }
}
if (*charp > (*linep)->len) *charp= (*linep)->len;
@@ -1546,18 +1788,18 @@ static int move_cursor(bContext *C, int type, int select)
break;
case PREV_PAGE:
- if(st) cursor_skip(text, -st->viewlines, select);
- else cursor_skip(text, -10, select);
+ if(st) cursor_skip(st, ar, st->text, -st->viewlines, select);
+ else cursor_skip(NULL, NULL, text, -10, select);
break;
case NEXT_PAGE:
- if(st) cursor_skip(text, st->viewlines, select);
- else cursor_skip(text, 10, select);
+ if(st) cursor_skip(st, ar, st->text, st->viewlines, select);
+ else cursor_skip(NULL, NULL, text, 10, select);
break;
}
text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+ WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
return OPERATOR_FINISHED;
}
@@ -1629,7 +1871,7 @@ static int jump_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int jump_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
return WM_operator_props_dialog_popup(C,op,200,100);
@@ -1665,6 +1907,8 @@ static int delete_exec(bContext *C, wmOperator *op)
Text *text= CTX_data_edit_text(C);
int type= RNA_enum_get(op->ptr, "type");
+ text_drawcache_tag_update(CTX_wm_space_text(C), 0);
+
if(type == DEL_PREV_WORD)
txt_backspace_word(text);
else if(type == DEL_PREV_CHAR)
@@ -1674,7 +1918,7 @@ static int delete_exec(bContext *C, wmOperator *op)
else if(type == DEL_NEXT_CHAR)
txt_delete_char(text);
- text_update_line_edited(text, text->curl);
+ text_update_line_edited(text->curl);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
@@ -1703,7 +1947,7 @@ void TEXT_OT_delete(wmOperatorType *ot)
/******************* toggle overwrite operator **********************/
-static int toggle_overwrite_exec(bContext *C, wmOperator *op)
+static int toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st= CTX_wm_space_text(C);
@@ -1729,13 +1973,13 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
/******************* scroll operator **********************/
/* Moves the view vertically by the specified number of lines */
-static void screen_skip(SpaceText *st, int lines)
+static void screen_skip(SpaceText *st, ARegion *ar, int lines)
{
int last;
- st->top += lines;
+ st->top += lines;
- last= txt_get_span(st->text->lines.first, st->text->lines.last);
+ last= text_get_total_lines(st, ar);
last= last - (st->viewlines/2);
if(st->top>last) st->top= last;
@@ -1756,12 +2000,14 @@ typedef struct TextScroll {
static int scroll_exec(bContext *C, wmOperator *op)
{
SpaceText *st= CTX_wm_space_text(C);
+ ARegion *ar= CTX_wm_region(C);
+
int lines= RNA_int_get(op->ptr, "lines");
if(lines == 0)
return OPERATOR_CANCELLED;
- screen_skip(st, lines*U.wheellinescroll);
+ screen_skip(st, ar, lines*U.wheellinescroll);
ED_area_tag_redraw(CTX_wm_area(C));
@@ -1771,6 +2017,7 @@ static int scroll_exec(bContext *C, wmOperator *op)
static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
+ ARegion *ar= CTX_wm_region(C);
TextScroll *tsc= op->customdata;
short *mval= event->mval;
@@ -1792,7 +2039,7 @@ static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
tsc->delta[1]= (tsc->hold[1]-mval[1])*st->pix_per_line;
if(tsc->delta[0] || tsc->delta[1]) {
- screen_skip(st, tsc->delta[1]);
+ screen_skip(st, ar, tsc->delta[1]);
tsc->lines += tsc->delta[1];
@@ -1969,7 +2216,7 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
Text *text= st->text;
TextLine **linep;
int *charp;
- int w;
+ int w, tabs;
text_update_character_width(st);
@@ -1987,16 +2234,28 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
x = (x/st->cwidth) + st->left;
if(st->wordwrap) {
- int i, j, endj, curs, max, chop, start, end, chars, loop;
+ int i, j, endj, curs, max, chop, start, end, chars, loop, found;
char ch;
/* Point to first visible line */
*linep= text->lines.first;
- for(i=0; i<st->top && (*linep)->next; i++) *linep= (*linep)->next;
+ i= st->top;
+ while(i>0 && *linep) {
+ int lines= text_get_visible_lines(st, ar, (*linep)->line);
+
+ if (i-lines<0) {
+ y+= i;
+ break;
+ } else {
+ *linep= (*linep)->next;
+ i-= lines;
+ }
+ }
max= wrap_width(st, ar);
loop= 1;
+ found= 0;
while(loop && *linep) {
start= 0;
end= max;
@@ -2004,12 +2263,14 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
chars= 0;
curs= 0;
endj= 0;
+ tabs= 0;
for(i=0, j=0; loop; j++) {
/* Mimic replacement of tabs */
ch= (*linep)->line[j];
if(ch=='\t') {
chars= st->tabnumber-i%st->tabnumber;
+ tabs+= chars-1;
ch= ' ';
}
else
@@ -2021,22 +2282,34 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
*charp= endj;
loop= 0;
break;
- /* Exactly at the cursor, done */
+ /* Exactly at the cursor */
}
else if(y==0 && i-start==x) {
+ /* current position could be wrapped to next line */
+ /* this should be checked when end of current line would be reached */
*charp= curs= j;
- loop= 0;
- break;
+ found= 1;
/* Prepare curs for next wrap */
}
else if(i-end==x) {
curs= j;
}
if(i-start>=max) {
+ if(found) {
+ /* exact cursor position was found, check if it's */
+ /* still on needed line (hasn't been wrapped) */
+ if(*charp>endj && !chop) (*charp)= endj;
+ loop= 0;
+ break;
+ }
+
if(chop) endj= j;
- y--;
start= end;
end += max;
+
+ if(start-tabs<(*linep)->len)
+ y--;
+
chop= 1;
if(y==0 && i-start>=x) {
*charp= curs;
@@ -2045,6 +2318,11 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
}
}
else if(ch==' ' || ch=='-' || ch=='\0') {
+ if(found) {
+ loop= 0;
+ break;
+ }
+
if(y==0 && i-start>=x) {
*charp= curs;
loop= 0;
@@ -2102,7 +2380,7 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event)
if(event->mval[1]<0 || event->mval[1]>ar->winy) {
int d= (scu->old[1]-event->mval[1])*st->pix_per_line;
- if(d) screen_skip(st, d);
+ if(d) screen_skip(st, ar, d);
set_cursor_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1);
@@ -2234,7 +2512,7 @@ void TEXT_OT_cursor_set(wmOperatorType *ot)
/******************* line number operator **********************/
-static int line_number_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -2290,6 +2568,8 @@ static int insert_exec(bContext *C, wmOperator *op)
char *str;
int done = 0, i;
+ text_drawcache_tag_update(st, 0);
+
str= RNA_string_get_alloc(op->ptr, "text", NULL, 0);
if(st && st->overwrite) {
@@ -2307,7 +2587,7 @@ static int insert_exec(bContext *C, wmOperator *op)
if(!done)
return OPERATOR_CANCELLED;
- text_update_line_edited(text, text->curl);
+ text_update_line_edited(text->curl);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
@@ -2317,18 +2597,18 @@ static int insert_exec(bContext *C, wmOperator *op)
static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- char str[2];
int ret;
- /* XXX old code from winqreadtextspace, is it still needed somewhere? */
- /* smartass code to prevent the CTRL/ALT events below from not working! */
- /*if(qual & (LR_ALTKEY|LR_CTRLKEY))
- if(!ispunct(ascii))
- ascii= 0;*/
- str[0]= event->ascii;
- str[1]= '\0';
+ // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
+ if(!RNA_string_length(op->ptr, "text")) {
+ char str[2] = {event->ascii, '\0'};
+ /* if alt/ctrl/super are pressed pass through */
+ if(event->ctrl || event->oskey)
+ return OPERATOR_PASS_THROUGH;
+
+ RNA_string_set(op->ptr, "text", str);
+ }
- RNA_string_set(op->ptr, "text", str);
ret = insert_exec(C, op);
/* run the script while editing, evil but useful */
@@ -2396,6 +2676,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode)
}
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+ text_drawcache_tag_update(CTX_wm_space_text(C), 1);
}
else if(mode==TEXT_MARK_ALL) {
char color[4];
@@ -2529,7 +2810,7 @@ void TEXT_OT_find_set_selected(wmOperatorType *ot)
/******************* replace set selected *********************/
-static int replace_set_selected_exec(bContext *C, wmOperator *op)
+static int replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -2579,7 +2860,7 @@ int text_file_modified(Text *text)
return 0;
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_path_abs(file, G.sce);
+ BLI_path_abs(file, G.main->name);
if(!BLI_exists(file))
return 2;
@@ -2607,7 +2888,7 @@ static void text_ignore_modified(Text *text)
if(!text || !text->name) return;
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_path_abs(file, G.sce);
+ BLI_path_abs(file, G.main->name);
if(!BLI_exists(file)) return;
@@ -2639,7 +2920,7 @@ static int resolve_conflict_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Text *text= CTX_data_edit_text(C);
uiPopupMenu *pup;
@@ -2741,6 +3022,7 @@ void ED_text_undo_step(bContext *C, int step)
text_update_edited(text);
text_update_cursor_moved(C);
+ text_drawcache_tag_update(CTX_wm_space_text(C), 1);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
}
diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c
index aee1a7ecfd6..6e64bef4c85 100644
--- a/source/blender/editors/space_text/text_python.c
+++ b/source/blender/editors/space_text/text_python.c
@@ -182,7 +182,7 @@ static void confirm_suggestion(Text *text, int skipleft)
#define LR_SHIFTKEY 0
#define LR_ALTKEY 0
#define LR_CTRLKEY 0
-#define LR_COMMANDKEY 0
+#define LR_OSKEY 0
// XXX
static int doc_scroll= 0;
@@ -204,7 +204,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val)
if(tools & TOOL_SUGG_LIST) {
if((ascii != '_' && ascii != '*' && ispunct(ascii)) || text_check_whitespace(ascii)) {
confirm_suggestion(st->text, 0);
- text_update_line_edited(st->text, st->text->curl);
+ text_update_line_edited(st->text->curl);
}
else if((st->overwrite && txt_replace_char(st->text, ascii)) || txt_add_char(st->text, ascii)) {
get_suggest_prefix(st->text, 0);
@@ -230,7 +230,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val)
case MIDDLEMOUSE:
if(text_do_suggest_select(st, ar)) {
confirm_suggestion(st->text, 0);
- text_update_line_edited(st->text, st->text->curl);
+ text_update_line_edited(st->text->curl);
swallow= 1;
}
else {
@@ -248,7 +248,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val)
case RETKEY:
if(tools & TOOL_SUGG_LIST) {
confirm_suggestion(st->text, 0);
- text_update_line_edited(st->text, st->text->curl);
+ text_update_line_edited(st->text->curl);
swallow= 1;
draw= 1;
}
@@ -430,11 +430,11 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val)
if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1);
if(st->overwrite) {
if(txt_replace_char(text, ascii))
- text_update_line_edited(st->text, st->text->curl);
+ text_update_line_edited(st->text->curl);
}
else {
if(txt_add_char(text, ascii)) {
- text_update_line_edited(st->text, st->text->curl);
+ text_update_line_edited(st->text->curl);
}
}
@@ -459,7 +459,7 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val)
txt_move_to(text, mrk->lineno, mrk->start+c, 0);
if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1);
txt_backspace_char(text);
- text_update_line_edited(st->text, st->text->curl);
+ text_update_line_edited(st->text->curl);
if(mrk==marker || mrk==nxt) break;
mrk= nxt;
}
@@ -479,7 +479,7 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val)
txt_move_to(text, mrk->lineno, mrk->start+c, 0);
if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1);
txt_delete_char(text);
- text_update_line_edited(st->text, st->text->curl);
+ text_update_line_edited(st->text->curl);
if(mrk==marker || mrk==nxt) break;
mrk= nxt;
}
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index ca7dc29ad85..a03baa2fa72 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -61,11 +61,8 @@
/* ************************ main time area region *********************** */
-static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar)
-{
- View2D *v2d= UI_view2d_fromcontext(C);
- Scene *scene= CTX_data_scene(C);
-
+static void time_draw_sfra_efra(Scene *scene, View2D *v2d)
+{
/* draw darkened area outside of active timeline
* frame range used is preview range or scene range */
UI_ThemeColorShade(TH_BACK, -25);
@@ -86,7 +83,7 @@ static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar
#define CACHE_DRAW_HEIGHT 3.0f
-static void time_draw_cache(const bContext *C, SpaceTime *stime, ARegion *ar)
+static void time_draw_cache(SpaceTime *stime)
{
SpaceTimeCache *stc;
float yoffs=0.f;
@@ -162,7 +159,7 @@ static void time_cache_free(SpaceTime *stime)
BLI_freelistN(&stime->caches);
}
-static void time_cache_refresh(const bContext *C, SpaceTime *stime, ARegion *ar)
+static void time_cache_refresh(const bContext *C, SpaceTime *stime)
{
Object *ob = CTX_data_active_object(C);
PTCacheID *pid;
@@ -389,7 +386,7 @@ static void time_refresh(const bContext *C, ScrArea *sa)
/* find the main timeline region and refresh cache display*/
for (ar= sa->regionbase.first; ar; ar= ar->next) {
if (ar->regiontype==RGN_TYPE_WINDOW) {
- time_cache_refresh(C, stime, ar);
+ time_cache_refresh(C, stime);
break;
}
}
@@ -457,6 +454,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar)
static void time_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
+ Scene *scene= CTX_data_scene(C);
SpaceTime *stime= CTX_wm_space_time(C);
View2D *v2d= &ar->v2d;
View2DGrid *grid;
@@ -467,15 +465,15 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- UI_view2d_view_ortho(C, v2d);
+ UI_view2d_view_ortho(v2d);
/* start and end frame */
- time_draw_sfra_efra(C, stime, ar);
+ time_draw_sfra_efra(scene, v2d);
/* grid */
unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS;
- grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
- UI_view2d_grid_draw(C, v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS));
+ grid= UI_view2d_grid_calc(scene, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
+ UI_view2d_grid_draw(v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS));
UI_view2d_grid_free(grid);
/* keyframes */
@@ -488,11 +486,11 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
ANIM_draw_cfra(C, v2d, flag);
/* markers */
- UI_view2d_view_orthoSpecial(C, v2d, 1);
+ UI_view2d_view_orthoSpecial(ar, v2d, 1);
draw_markers_time(C, 0);
/* caches */
- time_draw_cache(C, stime, ar);
+ time_draw_cache(stime);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -519,6 +517,7 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
case NC_SCENE:
switch (wmn->data) {
case ND_OB_SELECT:
+ case ND_OB_ACTIVE:
case ND_FRAME:
case ND_FRAME_RANGE:
case ND_KEYINGSET:
@@ -532,7 +531,7 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
/* ************************ header time area region *********************** */
/* add handlers, stuff you only do once or on area/region changes */
-static void time_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void time_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
@@ -631,7 +630,7 @@ static void time_free(SpaceLink *sl)
/* spacetype; init callback in ED_area_initialize() */
/* init is called to (re)initialize an existing editor (file read, screen changes) */
/* validate spacedata, add own area level handlers */
-static void time_init(wmWindowManager *wm, ScrArea *sa)
+static void time_init(wmWindowManager *UNUSED(wm), ScrArea *sa)
{
SpaceTime *stime= (SpaceTime *)sa->spacedata.first;
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c
index fb80d54d5e6..edb3da5a06e 100644
--- a/source/blender/editors/space_time/time_ops.c
+++ b/source/blender/editors/space_time/time_ops.c
@@ -46,7 +46,7 @@
/* ****************** Start/End Frame Operators *******************************/
-static int time_set_sfra_exec (bContext *C, wmOperator *op)
+static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
int frame= CFRA;
@@ -86,7 +86,7 @@ void TIME_OT_start_frame_set (wmOperatorType *ot)
}
-static int time_set_efra_exec (bContext *C, wmOperator *op)
+static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
int frame= CFRA;
@@ -127,7 +127,7 @@ void TIME_OT_end_frame_set (wmOperatorType *ot)
/* ************************ View All Operator *******************************/
-static int time_view_all_exec (bContext *C, wmOperator *op)
+static int time_view_all_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C);
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index 8eea83a1083..a59c03ad17d 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -47,7 +47,7 @@
/* ******************** default callbacks for userpref space ***************** */
-static SpaceLink *userpref_new(const bContext *C)
+static SpaceLink *userpref_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceUserPref *spref;
@@ -72,7 +72,7 @@ static SpaceLink *userpref_new(const bContext *C)
}
/* not spacelink itself */
-static void userpref_free(SpaceLink *sl)
+static void userpref_free(SpaceLink *UNUSED(sl))
{
// SpaceUserPref *spref= (SpaceUserPref*) sl;
@@ -80,7 +80,7 @@ static void userpref_free(SpaceLink *sl)
/* spacetype; init callback */
-static void userpref_init(struct wmWindowManager *wm, ScrArea *sa)
+static void userpref_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -111,13 +111,13 @@ void userpref_operatortypes(void)
{
}
-void userpref_keymap(struct wmKeyConfig *keyconf)
+void userpref_keymap(struct wmKeyConfig *UNUSED(keyconf))
{
}
/* add handlers, stuff you only do once or on area/region changes */
-static void userpref_header_area_init(wmWindowManager *wm, ARegion *ar)
+static void userpref_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
{
ED_region_header_init(ar);
}
@@ -127,19 +127,20 @@ static void userpref_header_area_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
-static void userpref_main_area_listener(ARegion *ar, wmNotifier *wmn)
+static void userpref_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
{
/* context changes */
}
-static void userpref_header_listener(ARegion *ar, wmNotifier *wmn)
+static void userpref_header_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
{
/* context changes */
+#if 0
switch(wmn->category) {
default:
break;
}
-
+#endif
}
/* only called once, from space/spacetypes.c */
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index fb271556a9c..4cce166b36b 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -64,7 +64,7 @@
// - include support for editing the path verts
/* Set up drawing environment for drawing motion paths */
-void draw_motion_paths_init(Scene *scene, View3D *v3d, ARegion *ar)
+void draw_motion_paths_init(View3D *v3d, ARegion *ar)
{
RegionView3D *rv3d= ar->regiondata;
@@ -79,7 +79,7 @@ void draw_motion_paths_init(Scene *scene, View3D *v3d, ARegion *ar)
* i.e. draw_motion_paths_init() has been called
*/
// FIXME: the text is still drawn in the wrong space - it includes the current transforms of the object still...
-void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar,
+void draw_motion_path_instance(Scene *scene,
Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath)
{
//RegionView3D *rv3d= ar->regiondata;
@@ -283,7 +283,7 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar,
}
/* Clean up drawing environment after drawing motion paths */
-void draw_motion_paths_cleanup(Scene *scene, View3D *v3d, ARegion *ar)
+void draw_motion_paths_cleanup(View3D *v3d)
{
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
glPopMatrix();
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index c6aa4656191..6cbfc2cffe4 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -140,7 +140,7 @@ static void cp_shade_color3ub (char cp[], int offset)
}
/* This function sets the gl-color for coloring a certain bone (based on bcolor) */
-static short set_pchan_glColor (short colCode, int armflag, int boneflag, int constflag)
+static short set_pchan_glColor (short colCode, int boneflag, int constflag)
{
switch (colCode) {
case PCHAN_COLOR_NORMAL:
@@ -551,7 +551,7 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id)
}
else {
if (armflag & ARM_POSEMODE)
- set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, 0);
+ set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0);
else
UI_ThemeColor(TH_BONE_SOLID);
}
@@ -574,7 +574,7 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id)
}
else {
if (armflag & ARM_POSEMODE)
- set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, 0);
+ set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0);
else
UI_ThemeColor(TH_BONE_SOLID);
}
@@ -616,7 +616,7 @@ static float co[16] ={
/* smat, imat = mat & imat to draw screenaligned */
-static void draw_sphere_bone_dist(float smat[][4], float imat[][4], int boneflag, bPoseChannel *pchan, EditBone *ebone)
+static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel *pchan, EditBone *ebone)
{
float head, tail, length, dist;
float *headvec, *tailvec, dirvec[3];
@@ -782,7 +782,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag,
else UI_ThemeColor(TH_VERTEX);
}
else if (armflag & ARM_POSEMODE)
- set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
/* Draw root point if we are not connected */
if ((boneflag & BONE_CONNECTED)==0) {
@@ -903,7 +903,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u
else UI_ThemeColorShade(TH_BONE_SOLID, -30);
}
else if (armflag & ARM_POSEMODE)
- set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, boneflag, constflag);
else if (dt==OB_SOLID)
UI_ThemeColorShade(TH_BONE_SOLID, -30);
@@ -933,7 +933,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u
else UI_ThemeColor(TH_BONE_SOLID);
}
else if (armflag & ARM_POSEMODE)
- set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_BASE, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_BASE, boneflag, constflag);
else if (dt == OB_SOLID)
UI_ThemeColor(TH_BONE_SOLID);
@@ -1003,7 +1003,7 @@ static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned in
if (armflag & (ARM_EDITMODE|ARM_POSEMODE)) {
glLineWidth(4.0f);
if (armflag & ARM_POSEMODE)
- set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
else if (armflag & ARM_EDITMODE) {
UI_ThemeColor(TH_WIRE);
}
@@ -1048,7 +1048,7 @@ static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned in
glLoadName(id & 0xFFFF); /* object tag, for bordersel optim */
if (armflag & ARM_POSEMODE)
- set_pchan_glColor(PCHAN_COLOR_LINEBONE, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_LINEBONE, boneflag, constflag);
}
glLineWidth(2.0);
@@ -1147,9 +1147,9 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign
/* colors for modes */
if (armflag & ARM_POSEMODE) {
if (dt <= OB_WIRE)
- set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
else
- set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag);
}
else if (armflag & ARM_EDITMODE) {
if (dt==OB_WIRE) {
@@ -1171,7 +1171,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign
glEnable(GL_LIGHTING);
if (armflag & ARM_POSEMODE)
- set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag);
else
UI_ThemeColor(TH_BONE_SOLID);
@@ -1186,7 +1186,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign
if (armflag & ARM_POSEMODE) {
if (constflag) {
/* set constraint colors */
- if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) {
+ if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) {
glEnable(GL_BLEND);
draw_b_bone_boxes(OB_SOLID, pchan, xwidth, length, zwidth);
@@ -1195,7 +1195,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign
}
/* restore colors */
- set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
}
}
@@ -1221,9 +1221,9 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned
/* colors for posemode */
if (armflag & ARM_POSEMODE) {
if (dt <= OB_WIRE)
- set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
else
- set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag);
}
@@ -1245,7 +1245,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned
else if (armflag & ARM_POSEMODE) {
if (constflag) {
/* draw constraint colors */
- if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) {
+ if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) {
glEnable(GL_BLEND);
draw_bone_solid_octahedral();
@@ -1254,7 +1254,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned
}
/* restore colors */
- set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
}
}
draw_bone_octahedral();
@@ -1262,7 +1262,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned
else {
/* solid */
if (armflag & ARM_POSEMODE)
- set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag);
+ set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag);
else
UI_ThemeColor(TH_BONE_SOLID);
draw_bone_solid_octahedral();
@@ -1283,7 +1283,7 @@ static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obje
/* colors for posemode */
if (armflag & ARM_POSEMODE) {
- set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, 0);
+ set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, 0);
}
if (id != -1) {
@@ -1565,7 +1565,7 @@ static void bone_matrix_translate_y(float mat[][4], float y)
}
/* assumes object is Armature with pose */
-static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt)
+static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, short ghost)
{
RegionView3D *rv3d= ar->regiondata;
Object *ob= base->object;
@@ -1602,7 +1602,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (bone && !(bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))) {
if (bone->flag & (BONE_SELECTED)) {
if (bone->layer & arm->layer)
- draw_sphere_bone_dist(smat, imat, bone->flag, pchan, NULL);
+ draw_sphere_bone_dist(smat, imat, pchan, NULL);
}
}
}
@@ -1706,9 +1706,11 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
/* prepare colors */
- if (arm->flag & ARM_POSEMODE)
+ if(ghost) {
+ /* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */
+ }
+ else if (arm->flag & ARM_POSEMODE)
set_pchan_colorset(ob, pchan);
-#if 0 // XXX - 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith)
else {
if ((scene->basact)==base) {
if (base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_ACTIVE);
@@ -1719,7 +1721,6 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
else UI_ThemeColor(TH_WIRE);
}
}
-#endif
/* catch exception for bone with hidden parent */
flag= bone->flag;
@@ -1901,7 +1902,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
bone_matrix_translate_y(bmat, pchan->bone->length);
glMultMatrixf(bmat);
- drawaxes(pchan->bone->length*0.25f, 0, OB_ARROWS);
+ drawaxes(pchan->bone->length*0.25f, OB_ARROWS);
glPopMatrix();
}
@@ -1957,7 +1958,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
if (eBone->layer & arm->layer) {
if ((eBone->flag & (BONE_HIDDEN_A|BONE_NO_DEFORM))==0) {
if (eBone->flag & (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL))
- draw_sphere_bone_dist(smat, imat, eBone->flag, NULL, eBone);
+ draw_sphere_bone_dist(smat, imat, NULL, eBone);
}
}
}
@@ -2094,7 +2095,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
bone_matrix_translate_y(bmat, eBone->length);
glMultMatrixf(bmat);
- drawaxes(eBone->length*0.25f, 0, OB_ARROWS);
+ drawaxes(eBone->length*0.25f, OB_ARROWS);
glPopMatrix();
}
@@ -2122,16 +2123,16 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, ARegion *ar, Object *ob)
bPoseChannel *pchan;
/* setup drawing environment for paths */
- draw_motion_paths_init(scene, v3d, ar);
+ draw_motion_paths_init(v3d, ar);
/* draw paths where they exist and they releated bone is visible */
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if ((pchan->bone->layer & arm->layer) && (pchan->mpath))
- draw_motion_path_instance(scene, v3d, ar, ob, pchan, avs, pchan->mpath);
+ draw_motion_path_instance(scene, ob, pchan, avs, pchan->mpath);
}
/* cleanup after drawing */
- draw_motion_paths_cleanup(scene, v3d, ar);
+ draw_motion_paths_cleanup(v3d);
}
@@ -2211,7 +2212,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
where_is_pose(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2290,7 +2291,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
where_is_pose(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2360,7 +2361,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
where_is_pose(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
}
}
@@ -2375,7 +2376,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
where_is_pose(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
}
}
}
@@ -2409,7 +2410,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
/* we use color for solid lighting */
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glEnable(GL_COLOR_MATERIAL);
- glColor3ub(0,0,0); // clear spec
+ glColor3ub(255,0,255); // clear spec
glDisable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
@@ -2458,7 +2459,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
}
}
}
- draw_pose_bones(scene, v3d, ar, base, dt);
+ draw_pose_bones(scene, v3d, ar, base, dt, FALSE);
arm->flag &= ~ARM_POSEMODE;
if(ob->mode & OB_MODE_POSE)
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 2da2b39ff19..6b166b470be 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -192,7 +192,7 @@ static int draw_tfaces3D__drawFaceOpts(void *userData, int index)
return 0;
}
-static void draw_tfaces3D(RegionView3D *rv3d, Object *ob, Mesh *me, DerivedMesh *dm)
+static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
{
struct { Mesh *me; EdgeHash *eh; } data;
@@ -523,7 +523,7 @@ static int draw_em_tf_mapped__set_draw(void *userData, int index)
MCol *mcol;
int matnr;
- if (efa==NULL || efa->h)
+ if (efa->h)
return 0;
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -536,12 +536,13 @@ static int draw_em_tf_mapped__set_draw(void *userData, int index)
static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
{
Mesh *me = (Mesh*)userData;
- MTFace *tface = (me->mtface)? &me->mtface[index]: NULL;
- MFace *mface = (me->mface)? &me->mface[index]: NULL;
-
- if ((mface->flag&ME_HIDE) || (tface && (tface->mode&TF_INVISIBLE)))
- return 0;
-
+
+ if ( (me->mface && me->mface[index].flag & ME_HIDE) ||
+ (me->mtface && (me->mtface[index].mode & TF_INVISIBLE))
+ ) {
+ return 0;
+ }
+
*drawSmooth_r = 1;
return 1;
}
@@ -647,7 +648,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh);
} else if(faceselect) {
if(ob->mode & OB_MODE_WEIGHT_PAINT)
- dm->drawMappedFaces(dm, NULL, wpaint__setSolidDrawOptions, me, DM_DRAW_VERTEX_COLORS);
+ dm->drawMappedFaces(dm, NULL, wpaint__setSolidDrawOptions, me, GPU_enable_material, DM_DRAW_VERTEX_COLORS);
else
dm->drawMappedFacesTex(dm, draw_tface_mapped__set_draw, me);
}
@@ -670,7 +671,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
/* draw edges and selected faces over textured mesh */
if(!(ob == scene->obedit) && faceselect)
- draw_tfaces3D(rv3d, ob, me, dm);
+ draw_tfaces3D(rv3d, me, dm);
/* reset from negative scale correction */
glFrontFace(GL_CCW);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 615f5969a52..5ac76719517 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -398,8 +398,7 @@ static void draw_xyz_wire(float *c, float size, int axis)
}
-/* flag is same as for draw_object */
-void drawaxes(float size, int flag, char drawtype)
+void drawaxes(float size, char drawtype)
{
int axis;
float v1[3]= {0.0, 0.0, 0.0};
@@ -917,6 +916,9 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
copy_m4_m4(imat, rv3d->viewinv);
normalize_v3(imat[0]);
normalize_v3(imat[1]);
+
+ /* lamp center */
+ copy_v3_v3(vec, ob->obmat[3]);
/* for AA effects */
glGetFloatv(GL_CURRENT_COLOR, curcol);
@@ -931,7 +933,6 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
/* Inner Circle */
- copy_v3_v3(vec, ob->obmat[3]);
glEnable(GL_BLEND);
drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
glDisable(GL_BLEND);
@@ -1210,7 +1211,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
/* a standing up pyramid with (0,0,0) as top */
Camera *cam;
World *wrld;
- float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy;
+ float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy, shx, shy;
int i;
cam= ob->data;
@@ -1232,6 +1233,8 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
if(rv3d->persp>=2 && cam->type==CAM_ORTHO && ob==v3d->camera) {
facx= 0.5*cam->ortho_scale*caspx;
facy= 0.5*cam->ortho_scale*caspy;
+ shx= cam->shiftx * cam->ortho_scale;
+ shy= cam->shifty * cam->ortho_scale;
depth= -cam->clipsta-0.1;
}
else {
@@ -1241,13 +1244,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
depth= - fac*cam->lens/16.0;
facx= fac*caspx;
facy= fac*caspy;
+ shx= cam->shiftx*fac*2;
+ shy= cam->shifty*fac*2;
}
vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.001; /* GLBUG: for picking at iris Entry (well thats old!) */
- vec[1][0]= facx; vec[1][1]= facy; vec[1][2]= depth;
- vec[2][0]= facx; vec[2][1]= -facy; vec[2][2]= depth;
- vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth;
- vec[4][0]= -facx; vec[4][1]= facy; vec[4][2]= depth;
+ vec[1][0]= shx + facx; vec[1][1]= shy + facy; vec[1][2]= depth;
+ vec[2][0]= shx + facx; vec[2][1]= shy - facy; vec[2][2]= depth;
+ vec[3][0]= shx - facx; vec[3][1]= shy - facy; vec[3][2]= depth;
+ vec[4][0]= shx - facx; vec[4][1]= shy + facy; vec[4][2]= depth;
glBegin(GL_LINE_LOOP);
glVertex3fv(vec[1]);
@@ -1280,16 +1285,16 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
if (i==0) glBegin(GL_LINE_LOOP);
else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES);
else break;
-
- vec[0][0]= -0.7 * cam->drawsize;
- vec[0][1]= cam->drawsize * (caspy + 0.1);
+
+ vec[0][0]= shx + (-0.7 * cam->drawsize);
+ vec[0][1]= shy + (cam->drawsize * (caspy + 0.1));
glVertex3fv(vec[0]); /* left */
- vec[0][0] *= -1.0;
+ vec[0][0]= shx + (0.7 * cam->drawsize);
glVertex3fv(vec[0]); /* right */
- vec[0][0]= 0.0;
- vec[0][1]= 1.1 * cam->drawsize * (caspy + 0.7);
+ vec[0][0]= shx;
+ vec[0][1]= shy + (1.1 * cam->drawsize * (caspy + 0.7));
glVertex3fv(vec[0]); /* top */
glEnd();
@@ -1461,7 +1466,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
* if not, ED_view3d_init_mats_rv3d() can be used for selection tools
* but would not give correct results with dupli's for eg. which dont
* use the object matrix in the useual way */
-static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
+static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; } *data = userData;
EditVert *eve = EM_get_vert_for_index(index);
@@ -1545,7 +1550,7 @@ void mesh_foreachScreenEdge(ViewContext *vc, void (*func)(void *userData, EditEd
dm->release(dm);
}
-static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *no)
+static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *UNUSED(no))
{
struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; ViewContext vc; } *data = userData;
EditFace *efa = EM_get_face_for_index(index);
@@ -1656,7 +1661,7 @@ static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm)
glEnd();
}
-static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *no)
+static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *UNUSED(no))
{
EditFace *efa = EM_get_face_for_index(index);
int sel = *((int*) userData);
@@ -1700,7 +1705,7 @@ static void draw_dm_vert_normals(Scene *scene, DerivedMesh *dm)
}
/* Draw verts with color set based on selection */
-static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
+static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
struct { int sel; EditVert *eve_act; } * data = userData;
EditVert *eve = EM_get_vert_for_index(index);
@@ -1777,7 +1782,7 @@ static void draw_dm_edges_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned
}
/* Draw edges */
-static int draw_dm_edges__setDrawOptions(void *userData, int index)
+static int draw_dm_edges__setDrawOptions(void *UNUSED(userData), int index)
{
return EM_get_edge_for_index(index)->h==0;
}
@@ -1787,7 +1792,7 @@ static void draw_dm_edges(DerivedMesh *dm)
}
/* Draw edges with color interpolated based on selection */
-static int draw_dm_edges_sel_interp__setDrawOptions(void *userData, int index)
+static int draw_dm_edges_sel_interp__setDrawOptions(void *UNUSED(userData), int index)
{
return EM_get_edge_for_index(index)->h==0;
}
@@ -1812,7 +1817,7 @@ static void draw_dm_edges_sel_interp(DerivedMesh *dm, unsigned char *baseCol, un
}
/* Draw only seam edges */
-static int draw_dm_edges_seams__setDrawOptions(void *userData, int index)
+static int draw_dm_edges_seams__setDrawOptions(void *UNUSED(userData), int index)
{
EditEdge *eed = EM_get_edge_for_index(index);
@@ -1824,7 +1829,7 @@ static void draw_dm_edges_seams(DerivedMesh *dm)
}
/* Draw only sharp edges */
-static int draw_dm_edges_sharp__setDrawOptions(void *userData, int index)
+static int draw_dm_edges_sharp__setDrawOptions(void *UNUSED(userData), int index)
{
EditEdge *eed = EM_get_edge_for_index(index);
@@ -1838,7 +1843,7 @@ static void draw_dm_edges_sharp(DerivedMesh *dm)
/* Draw faces with color set based on selection
* return 2 for the active face so it renders with stipple enabled */
-static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *drawSmooth_r)
+static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r))
{
struct { unsigned char *cols[3]; EditFace *efa_act; } * data = userData;
EditFace *efa = EM_get_face_for_index(index);
@@ -1867,10 +1872,10 @@ static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned
data.cols[2] = actCol;
data.efa_act = efa_act;
- dm->drawMappedFaces(dm, NULL, draw_dm_faces_sel__setDrawOptions, &data, 0);
+ dm->drawMappedFaces(dm, NULL, draw_dm_faces_sel__setDrawOptions, &data, GPU_enable_material, 0);
}
-static int draw_dm_creases__setDrawOptions(void *userData, int index)
+static int draw_dm_creases__setDrawOptions(void *UNUSED(userData), int index)
{
EditEdge *eed = EM_get_edge_for_index(index);
@@ -1888,7 +1893,7 @@ static void draw_dm_creases(DerivedMesh *dm)
glLineWidth(1.0);
}
-static int draw_dm_bweights__setDrawOptions(void *userData, int index)
+static int draw_dm_bweights__setDrawOptions(void *UNUSED(userData), int index)
{
EditEdge *eed = EM_get_edge_for_index(index);
@@ -1899,7 +1904,7 @@ static int draw_dm_bweights__setDrawOptions(void *userData, int index)
return 0;
}
}
-static void draw_dm_bweights__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
+static void draw_dm_bweights__mapFunc(void *UNUSED(userData), int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
EditVert *eve = EM_get_vert_for_index(index);
@@ -1934,7 +1939,7 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm)
/* EditMesh drawing routines*/
-static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act)
+static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, DerivedMesh *cageDM, EditVert *eve_act)
{
ToolSettings *ts= scene->toolsettings;
int sel;
@@ -2225,7 +2230,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
}
}
-static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth_r)
+static int draw_em_fancy__setFaceOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r))
{
EditFace *efa = EM_get_face_for_index(index);
@@ -2237,7 +2242,7 @@ static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth
return 0;
}
-static int draw_em_fancy__setGLSLFaceOpts(void *userData, int index)
+static int draw_em_fancy__setGLSLFaceOpts(void *UNUSED(userData), int index)
{
EditFace *efa = EM_get_face_for_index(index);
@@ -2287,7 +2292,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
glEnable(GL_LIGHTING);
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
- finalDM->drawMappedFaces(finalDM, NULL, draw_em_fancy__setFaceOpts, NULL, 0);
+ finalDM->drawMappedFaces(finalDM, NULL, draw_em_fancy__setFaceOpts, NULL, GPU_enable_material, 0);
glFrontFace(GL_CCW);
glDisable(GL_LIGHTING);
@@ -2383,7 +2388,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
if(em) {
// XXX retopo_matrix_update(v3d);
- draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act);
+ draw_em_fancy_verts(scene, v3d, ob, cageDM, eve_act);
if(me->drawflag & ME_DRAWNORMALS) {
UI_ThemeColor(TH_NORMAL);
@@ -2433,7 +2438,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
}
}
-static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
+static int wpaint__setSolidDrawOptions(void *UNUSED(userData), int UNUSED(index), int *drawSmooth_r)
{
*drawSmooth_r = 1;
return 1;
@@ -2538,25 +2543,29 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* weight paint in solid mode, special case. focus on making the weights clear
* rather then the shading, this is also forced in wire view */
GPU_enable_material(0, NULL);
- dm->drawMappedFaces(dm, NULL, wpaint__setSolidDrawOptions, me->mface, DM_DRAW_VERTEX_COLORS);
+
+ dm->drawMappedFaces(dm, NULL, wpaint__setSolidDrawOptions,
+ me->mface, GPU_enable_material,
+ DM_DRAW_VERTEX_COLORS);
bglPolygonOffset(rv3d->dist, 1.0);
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
glEnable(GL_BLEND);
- glColor4ub(196, 196, 196, 196);
+ glColor4ub(255, 255, 255, 96);
glEnable(GL_LINE_STIPPLE);
- glLineStipple(1, 0x8888);
+ glLineStipple(1, 0xAAAA);
- dm->drawEdges(dm, 1, 0);
+ dm->drawEdges(dm, 1, 1);
bglPolygonOffset(rv3d->dist, 0.0);
glDepthMask(1);
glDisable(GL_LINE_STIPPLE);
GPU_disable_material();
-
-
+
+ /* since we already draw wire as wp guide, dont draw over the top */
+ draw_wire= 0;
}
else {
if((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire && !ob->paint)
@@ -2602,7 +2611,9 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
- dm->drawMappedFaces(dm, NULL, wpaint__setSolidDrawOptions, me->mface, DM_DRAW_VERTEX_COLORS);
+ dm->drawMappedFaces(dm, NULL, wpaint__setSolidDrawOptions,
+ me->mface, GPU_enable_material,
+ DM_DRAW_VERTEX_COLORS);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
@@ -2622,12 +2633,14 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
dm->drawMappedFaces(dm, paint_redraw_planes,
wpaint__setSolidDrawOptions, NULL,
+ GPU_enable_material,
dm_flags);
glDisable(GL_LIGHTING);
}
else {
glColor3f(1.0f, 1.0f, 1.0f);
- dm->drawMappedFaces(dm, NULL, wpaint__setSolidDrawOptions, NULL, 0);
+
+ dm->drawMappedFaces(dm, NULL, wpaint__setSolidDrawOptions, NULL, GPU_enable_material, 0);
}
}
else do_draw= 1;
@@ -4044,7 +4057,7 @@ static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit
psys_cache_edit_paths(scene, ob, edit, CFRA);
}
-static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, PTCacheEdit *edit, int dt)
+static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
{
ParticleCacheKey **cache, *path, *pkey;
PTCacheEditPoint *point;
@@ -4838,9 +4851,9 @@ static void draw_empty_cone (float size)
}
/* draw points on curve speed handles */
+#if 0 // XXX old animation system stuff
static void curve_draw_speed(Scene *scene, Object *ob)
{
-#if 0 // XXX old animation system stuff
Curve *cu= ob->data;
IpoCurve *icu;
BezTriple *bezt;
@@ -4866,8 +4879,8 @@ static void curve_draw_speed(Scene *scene, Object *ob)
glPointSize(1.0);
bglEnd();
-#endif // XXX old animation system stuff
}
+#endif // XXX old animation system stuff
static void draw_textcurs(float textcurs[][2])
@@ -5663,13 +5676,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
bAnimVizSettings *avs= &ob->avs;
/* setup drawing environment for paths */
- draw_motion_paths_init(scene, v3d, ar);
+ draw_motion_paths_init(v3d, ar);
/* draw motion path for object */
- draw_motion_path_instance(scene, v3d, ar, ob, NULL, avs, ob->mpath);
+ draw_motion_path_instance(scene, ob, NULL, avs, ob->mpath);
/* cleanup after drawing */
- draw_motion_paths_cleanup(scene, v3d, ar);
+ draw_motion_paths_cleanup(v3d);
}
/* multiply view with object matrix.
@@ -5893,9 +5906,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
-
- if(cu->path)
- curve_draw_speed(scene, ob);
+
+//XXX old animsys if(cu->path)
+// curve_draw_speed(scene, ob);
}
break;
case OB_MBALL:
@@ -5914,7 +5927,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
case OB_EMPTY:
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
- drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype);
+ drawaxes(ob->empty_drawsize, ob->empty_drawtype);
break;
case OB_LAMP:
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
@@ -5940,7 +5953,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
break;
default:
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
- drawaxes(1.0, flag, OB_ARROWS);
+ drawaxes(1.0, OB_ARROWS);
}
}
@@ -6012,7 +6025,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
PTCacheEdit *edit = PE_create_current(scene, ob);
if(edit) {
glLoadMatrixf(rv3d->viewmat);
- draw_ptcache_edit(scene, v3d, rv3d, ob, edit, dt);
+ draw_ptcache_edit(scene, v3d, edit);
glMultMatrixf(ob->obmat);
}
}
@@ -6066,7 +6079,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
// #if 0
smd->domain->tex = NULL;
GPU_create_smoke(smd, 0);
- draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res, smd->domain->dx, smd->domain->tex_shadow);
+ draw_volume(ar, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res, smd->domain->dx, smd->domain->tex_shadow);
GPU_free_smoke(smd);
// #endif
#if 0
@@ -6117,7 +6130,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
{
smd->domain->tex = NULL;
GPU_create_smoke(smd, 1);
- draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res_wt, smd->domain->dx_wt, smd->domain->tex_shadow);
+ draw_volume(ar, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res_wt, smd->domain->dx_wt, smd->domain->tex_shadow);
GPU_free_smoke(smd);
}
}
@@ -6140,7 +6153,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if(dtx && (G.f & G_RENDER_OGL)==0) {
if(dtx & OB_AXIS) {
- drawaxes(1.0f, flag, OB_ARROWS);
+ drawaxes(1.0f, OB_ARROWS);
}
if(dtx & OB_BOUNDBOX) {
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
@@ -6280,7 +6293,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
/* ***************** BACKBUF SEL (BBS) ********* */
-static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
+static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
int offset = (intptr_t) userData;
EditVert *eve = EM_get_vert_for_index(index);
@@ -6316,7 +6329,7 @@ static void bbs_mesh_wire(DerivedMesh *dm, int offset)
dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(intptr_t) offset);
}
-static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
+static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r))
{
if (EM_get_face_for_index(index)->h==0) {
if (userData) {
@@ -6328,7 +6341,7 @@ static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *d
}
}
-static void bbs_mesh_solid__drawCenter(void *userData, int index, float *cent, float *no)
+static void bbs_mesh_solid__drawCenter(void *UNUSED(userData), int index, float *cent, float *UNUSED(no))
{
EditFace *efa = EM_get_face_for_index(index);
@@ -6345,7 +6358,7 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh
cpack(0);
if (facecol) {
- dm->drawMappedFaces(dm, NULL, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0);
+ dm->drawMappedFaces(dm, NULL, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, GPU_enable_material, 0);
if(check_ob_drawface_dot(scene, v3d, ob->dt)) {
glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
@@ -6356,17 +6369,17 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh
}
} else {
- dm->drawMappedFaces(dm, NULL, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0);
+ dm->drawMappedFaces(dm, NULL, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, GPU_enable_material, 0);
}
}
-static int bbs_mesh_solid__setDrawOpts(void *userData, int index, int *drawSmooth_r)
+static int bbs_mesh_solid__setDrawOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r))
{
WM_set_framebuffer_index_color(index+1);
return 1;
}
-static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *drawSmooth_r)
+static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *UNUSED(drawSmooth_r))
{
Mesh *me = userData;
@@ -6387,9 +6400,13 @@ static void bbs_mesh_solid(Scene *scene, View3D *v3d, Object *ob)
glColor3ub(0, 0, 0);
if(face_sel_mode)
- dm->drawMappedFaces(dm, NULL, bbs_mesh_solid_hide__setDrawOpts, me, DM_DRAW_BACKBUF_SELECTION);
+ dm->drawMappedFaces(dm, NULL, bbs_mesh_solid_hide__setDrawOpts,
+ me, GPU_enable_material,
+ DM_DRAW_BACKBUF_SELECTION);
else
- dm->drawMappedFaces(dm, NULL, bbs_mesh_solid__setDrawOpts, me, DM_DRAW_BACKBUF_SELECTION);
+ dm->drawMappedFaces(dm, NULL, bbs_mesh_solid__setDrawOpts,
+ me, GPU_enable_material,
+ DM_DRAW_BACKBUF_SELECTION);
dm->release(dm);
}
@@ -6496,7 +6513,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
GPU_end_object_materials();
}
else if(edm)
- edm->drawMappedFaces(edm, NULL, NULL, NULL, 0);
+ edm->drawMappedFaces(edm, NULL, NULL, NULL, GPU_enable_material, 0);
glDisable(GL_LIGHTING);
}
@@ -6515,7 +6532,7 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline);
break;
case OB_EMPTY:
- drawaxes(ob->empty_drawsize, 0, ob->empty_drawtype);
+ drawaxes(ob->empty_drawsize, ob->empty_drawtype);
break;
}
}
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 678920f8173..611cf68d81c 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -175,7 +175,7 @@ static int larger_pow2(int n)
return n*2;
}
-void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow)
+void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow)
{
RegionView3D *rv3d= ar->regiondata;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 8a215834c38..6261ca52564 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -274,7 +274,7 @@ static void view3d_free(SpaceLink *sl)
/* spacetype; init callback */
-static void view3d_init(struct wmWindowManager *wm, ScrArea *sa)
+static void view3d_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
}
@@ -387,7 +387,7 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
}
-static int view3d_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if(drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
@@ -397,7 +397,7 @@ static int view3d_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
return 0;
}
-static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if(drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
@@ -407,7 +407,7 @@ static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
return 0;
}
-static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if(drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
@@ -548,22 +548,36 @@ static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene
base= base->next;
}
- sa= win->screen->areabase.first;
- while(sa) {
- if(sa->spacetype == SPACE_VIEW3D)
- if(BLI_findindex(&sa->regionbase, ar) >= 0) {
+ for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+ if(sa->spacetype == SPACE_VIEW3D) {
+ if(BLI_findindex(&sa->regionbase, ar) != -1) {
View3D *v3d= sa->spacedata.first;
v3d->lay_used= lay_used;
break;
}
+ }
+ }
+}
- sa= sa->next;
+static View3D *view3d_from_wmn(ARegion *ar, wmNotifier *wmn)
+{
+ wmWindow *win= wmn->wm->winactive;
+ ScrArea *sa;
+
+ for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+ if(sa->spacetype == SPACE_VIEW3D)
+ if(BLI_findindex(&sa->regionbase, ar) != -1) {
+ return (View3D *)sa->spacedata.first;
+ }
}
+
+ return NULL;
}
static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
bScreen *sc;
+ View3D *v3d;
/* context changes */
switch(wmn->category) {
@@ -600,6 +614,11 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_MODE:
ED_region_tag_redraw(ar);
break;
+ case ND_WORLD:
+ v3d= view3d_from_wmn(ar, wmn);
+ if(v3d->flag2 & V3D_RENDER_OVERRIDE)
+ ED_region_tag_redraw(ar);
+ break;
}
if (wmn->action == NA_EDITED)
ED_region_tag_redraw(ar);
@@ -650,7 +669,9 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case NC_WORLD:
switch(wmn->data) {
case ND_WORLD_DRAW:
- ED_region_tag_redraw(ar);
+ v3d= view3d_from_wmn(ar, wmn);
+ if(v3d->flag2 & V3D_RENDER_OVERRIDE)
+ ED_region_tag_redraw(ar);
break;
}
break;
@@ -705,7 +726,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
/* concept is to retrieve cursor type context-less */
-static void view3d_main_area_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
+static void view3d_main_area_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar))
{
Scene *scene= win->screen->scene;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index a0167c87d87..450b3725bdb 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -128,7 +128,7 @@ typedef struct {
/* is used for both read and write... */
-static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d, Object *ob, float lim)
+static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
{
uiBlock *block= (layout)? uiLayoutAbsoluteBlock(layout): NULL;
MDeformVert *dvert=NULL;
@@ -643,7 +643,7 @@ static void vgroup_normalize_active(Object *ob)
}
-static void do_view3d_vgroup_buttons(bContext *C, void *arg, int event)
+static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
{
Scene *scene= CTX_data_scene(C);
Object *ob= OBACT;
@@ -670,7 +670,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *arg, int event)
WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
}
-int view3d_panel_vgroup_poll(const bContext *C, PanelType *pt)
+int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
{
Scene *scene= CTX_data_scene(C);
Object *ob= OBACT;
@@ -794,7 +794,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
}
}
-static void v3d_posearmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
+static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
{
// uiBlock *block= uiLayoutGetBlock(layout);
// bArmature *arm;
@@ -896,7 +896,7 @@ void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev)
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, CTX_data_edit_object(C)); // XXX fix
}
-static void v3d_editarmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
+static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
{
// uiBlock *block= uiLayoutGetBlock(layout);
bArmature *arm= ob->data;
@@ -930,7 +930,7 @@ static void v3d_editarmature_buts(uiLayout *layout, View3D *v3d, Object *ob, flo
uiItemR(col, &eboneptr, "roll", 0, "Roll", 0);
}
-static void v3d_editmetaball_buts(uiLayout *layout, Object *ob, float lim)
+static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
{
PointerRNA mbptr, ptr;
MetaBall *mball= ob->data;
@@ -989,7 +989,7 @@ static int test_parent_loop(Object *par, Object *ob)
return test_parent_loop(par->parent, ob);
}
-static void do_view3d_region_buttons(bContext *C, void *arg, int event)
+static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -1012,7 +1012,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
case B_OBJECTPANELMEDIAN:
if(ob) {
- v3d_editvertex_buts(C, NULL, v3d, ob, 1.0);
+ v3d_editvertex_buts(NULL, v3d, ob, 1.0);
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
}
break;
@@ -1152,12 +1152,12 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, ob);
}
-void removeTransformOrientation_func(bContext *C, void *target, void *unused)
+void removeTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg))
{
BIF_removeTransformOrientation(C, (TransformOrientation *) target);
}
-void selectTransformOrientation_func(bContext *C, void *target, void *unused)
+void selectTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg))
{
BIF_selectTransformOrientation(C, (TransformOrientation *) target);
}
@@ -1203,12 +1203,12 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
RNA_id_pointer_create(&ob->id, &obptr);
if(ob==obedit) {
- if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, v3d, ob, lim);
- if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob, lim);
- else v3d_editvertex_buts(C, col, v3d, ob, lim);
+ if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, ob);
+ if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob);
+ else v3d_editvertex_buts(col, v3d, ob, lim);
}
else if(ob->mode & OB_MODE_POSE) {
- v3d_posearmature_buts(col, v3d, ob, lim);
+ v3d_posearmature_buts(col, ob);
}
else {
@@ -1421,7 +1421,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
}
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
- uiDefAutoButsRNA(C, pa->layout, &ptr, 2);
+ uiDefAutoButsRNA(pa->layout, &ptr, 2);
}
#endif // XXX not used
@@ -1451,7 +1451,7 @@ void view3d_buttons_register(ARegionType *art)
// XXX view3d_panel_preview(C, ar, 0);
}
-static int view3d_properties(bContext *C, wmOperator *op)
+static int view3d_properties(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= view3d_has_buttons_region(sa);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index c643b47f5d2..ef3894a02e0 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1141,7 +1141,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
if(ymax >= vc->ar->winy) ymaxc= vc->ar->winy-1; else ymaxc= ymax;
if(yminc > ymaxc) return NULL;
- ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect,0);
+ ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect);
view3d_validate_backbuf(vc);
@@ -1161,7 +1161,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
if(xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax)
return ibuf;
- ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect,0);
+ ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect);
rd= ibuf->rect;
dr= ibuf1->rect;
@@ -1590,7 +1590,7 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas
}
-void view3d_update_depths(ARegion *ar, View3D *v3d)
+void view3d_update_depths(ARegion *ar)
{
RegionView3D *rv3d= ar->regiondata;
@@ -2093,7 +2093,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
}
/* read in pixels & stamp */
- ibuf= IMB_allocImBuf(sizex, sizey, 32, flag, 0);
+ ibuf= IMB_allocImBuf(sizex, sizey, 32, flag);
if(ibuf->rect_float)
glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, ibuf->rect_float);
@@ -2386,7 +2386,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
// retopo= retopo_mesh_check() || retopo_curve_check();
sculptparticle= (obact && obact->mode & (OB_MODE_PARTICLE_EDIT)) && !scene->obedit;
if(retopo)
- view3d_update_depths(ar, v3d);
+ view3d_update_depths(ar);
/* draw selected and editmode */
for(base= scene->base.first; base; base= base->next) {
@@ -2397,7 +2397,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
}
if(!retopo && sculptparticle && !(obact && (obact->dtx & OB_DRAWXRAY))) {
- view3d_update_depths(ar, v3d);
+ view3d_update_depths(ar);
}
// REEB_draw();
@@ -2410,7 +2410,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
if(!retopo && sculptparticle && (obact && (OBACT->dtx & OB_DRAWXRAY))) {
- view3d_update_depths(ar, v3d);
+ view3d_update_depths(ar);
}
if(rv3d->rflag & RV3D_CLIPPING)
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 06d93f01e02..dc75efcc5ca 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1274,7 +1274,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot)
RNA_def_int(ot->srna, "my", 0, 0, INT_MAX, "Zoom Position Y", "", 0, INT_MAX);
}
-static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */
+static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */
{
ARegion *ar= CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -1289,12 +1289,11 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.
int ok= 1, onedone=0;
if(center) {
- min[0]= min[1]= min[2]= 0.0f;
- max[0]= max[1]= max[2]= 0.0f;
-
/* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */
curs= give_cursor(scene, v3d);
- curs[0]= curs[1]= curs[2]= 0.0;
+ zero_v3(min);
+ zero_v3(max);
+ zero_v3(curs);
}
else {
INIT_MINMAX(min, max);
@@ -1318,9 +1317,7 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.
return OPERATOR_FINISHED;
}
- afm[0]= (max[0]-min[0]);
- afm[1]= (max[1]-min[1]);
- afm[2]= (max[2]-min[2]);
+ sub_v3_v3v3(afm, max, min);
size= 0.7f*MAX3(afm[0], afm[1], afm[2]);
if(size==0.0) ok= 0;
@@ -1342,7 +1339,7 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.
if (rv3d->persp==RV3D_CAMOB) {
rv3d->persp= RV3D_PERSP;
- smooth_view(C, NULL, v3d->camera, new_ofs, NULL, &new_dist, NULL);
+ smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
}
else {
smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
@@ -1358,17 +1355,6 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.
return OPERATOR_FINISHED;
}
-static int viewhome_poll(bContext *C)
-{
- if(ED_operator_view3d_active(C)) {
- RegionView3D *rv3d= CTX_wm_region_view3d(C); //XXX, when accessed from a header menu this doesnt work!
- if(rv3d && rv3d->persp!=RV3D_CAMOB) {
- return 1;
- }
- }
-
- return 0;
-}
void VIEW3D_OT_view_all(wmOperatorType *ot)
{
@@ -1378,8 +1364,8 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
ot->idname= "VIEW3D_OT_view_all";
/* api callbacks */
- ot->exec= viewhome_exec;
- ot->poll= viewhome_poll;
+ ot->exec= view3d_all_exec;
+ ot->poll= ED_operator_view3d_active;
/* flags */
ot->flag= 0;
@@ -1388,7 +1374,7 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
}
-static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview without local!, was centerview() in 2.4x */
+static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a localview without local!, was centerview() in 2.4x */
{
ARegion *ar= CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -1528,7 +1514,7 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot)
ot->flag= 0;
}
-static int viewcenter_cursor_exec(bContext *C, wmOperator *op)
+static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
@@ -1562,7 +1548,7 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot)
ot->flag= 0;
}
-static int view3d_center_camera_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */
+static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
{
RegionView3D *rv3d= CTX_wm_region_view3d(C);
@@ -1705,7 +1691,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
rv3d->depths->damaged = 1;
}
- view3d_update_depths(ar, v3d);
+ view3d_update_depths(ar);
/* Constrain rect to depth bounds */
if (rect.xmin < 0) rect.xmin = 0;
@@ -2135,14 +2121,11 @@ static int viewpan_exec(bContext *C, wmOperator *op)
pandir = RNA_enum_get(op->ptr, "type");
initgrabz(rv3d, 0.0, 0.0, 0.0);
-
if(pandir == V3D_VIEW_PANRIGHT) window_to_3d_delta(ar, vec, -32, 0);
else if(pandir == V3D_VIEW_PANLEFT) window_to_3d_delta(ar, vec, 32, 0);
else if(pandir == V3D_VIEW_PANUP) window_to_3d_delta(ar, vec, 0, -25);
else if(pandir == V3D_VIEW_PANDOWN) window_to_3d_delta(ar, vec, 0, 25);
- rv3d->ofs[0]+= vec[0];
- rv3d->ofs[1]+= vec[1];
- rv3d->ofs[2]+= vec[2];
+ add_v3_v3(rv3d->ofs, vec);
if(rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(CTX_wm_area(C), ar);
@@ -2168,7 +2151,7 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", prop_view_pan_items, 0, "Pan", "Direction of View Pan");
}
-static int viewpersportho_exec(bContext *C, wmOperator *op)
+static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
{
ARegion *ar= CTX_wm_region(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
@@ -2217,16 +2200,15 @@ static BGpic *add_background_image(bContext *C)
return bgpic;
}
-static int add_background_image_exec(bContext *C, wmOperator *op)
+static int add_background_image_exec(bContext *C, wmOperator *UNUSED(op))
{
add_background_image(C);
return OPERATOR_FINISHED;
}
-static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- Scene *scene= CTX_data_scene(C);
View3D *v3d= CTX_wm_view3d(C);
Image *ima= NULL;
BGpic *bgpic;
@@ -2237,7 +2219,7 @@ static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *eve
char path[FILE_MAX];
RNA_string_get(op->ptr, "filepath", path);
- ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1);
+ ima= BKE_add_image_file(path);
}
else if(RNA_property_is_set(op->ptr, "name")) {
RNA_string_get(op->ptr, "name", name);
@@ -2427,7 +2409,7 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
/* ***************** 3d cursor cursor op ******************* */
/* mx my in region coords */
-static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C);
@@ -2552,7 +2534,7 @@ void VIEW3D_OT_manipulator(wmOperatorType *ot)
Transform_Properties(ot, P_CONSTRAINT);
}
-static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
View3D *v3d = CTX_wm_view3d(C);
@@ -2661,7 +2643,7 @@ int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, short *mval, float mou
rv3d->depths->damaged = 1;
}
- view3d_update_depths(ar, v3d);
+ view3d_update_depths(ar);
depth_close= view_autodist_depth_margin(ar, mval, 4);
@@ -2705,7 +2687,7 @@ int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, flo
rv3d->depths->damaged = 1;
}
- view3d_update_depths(ar, v3d);
+ view3d_update_depths(ar);
return 1;
}
@@ -2802,7 +2784,7 @@ void filterNDOFvalues(float *sbval)
int dz_flag = 0;
float m_dist;
-void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode)
+void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int UNUSED(mode))
{
RegionView3D *rv3d= ar->regiondata;
int i;
@@ -2931,7 +2913,7 @@ void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode)
// XXX BIF_view3d_previewrender_signal(ar, PR_DBASE|PR_DISPRECT);
}
-void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode)
+void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int UNUSED(mode))
{
RegionView3D *rv3d= ar->regiondata;
float fval[7];
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index f9b8c6a5d62..c8a24acd582 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -304,7 +304,7 @@ static char *view3d_modeselect_pup(Scene *scene)
}
-static void do_view3d_header_buttons(bContext *C, void *arg, int event)
+static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
{
wmWindow *win= CTX_wm_window(C);
ToolSettings *ts= CTX_data_tool_settings(C);
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 4065b159ccf..9d1f5a77a3f 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -93,11 +93,11 @@ void VIEW3D_OT_drawtype(struct wmOperatorType *ot);
void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
/* drawanim.c */
-void draw_motion_paths_init(Scene *scene, View3D *v3d, struct ARegion *ar);
-void draw_motion_path_instance(Scene *scene, View3D *v3d, struct ARegion *ar,
+void draw_motion_paths_init(View3D *v3d, struct ARegion *ar);
+void draw_motion_path_instance(Scene *scene,
struct Object *ob, struct bPoseChannel *pchan,
struct bAnimVizSettings *avs, struct bMotionPath *mpath);
-void draw_motion_paths_cleanup(Scene *scene, View3D *v3d, struct ARegion *ar);
+void draw_motion_paths_cleanup(View3D *v3d);
@@ -106,7 +106,7 @@ void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int
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 drawaxes(float size, char drawtype);
void view3d_cached_text_draw_begin(void);
void view3d_cached_text_draw_add(float x, float y, float z, char *str, short xoffs, short flag);
@@ -130,7 +130,7 @@ void add_view3d_after(ListBase *lb, Base *base, int flag);
void circf(float x, float y, float rad);
void circ(float x, float y, float rad);
-void view3d_update_depths(struct ARegion *ar, View3D *v3d);
+void view3d_update_depths(struct ARegion *ar);
/* view3d_select.c */
void VIEW3D_OT_select(struct wmOperatorType *ot);
@@ -189,7 +189,7 @@ ARegion *view3d_has_buttons_region(ScrArea *sa);
ARegion *view3d_has_tools_region(ScrArea *sa);
/* draw_volume.c */
-void draw_volume(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct Base *base, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow);
+void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow);
#endif /* ED_VIEW3D_INTERN_H */
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 7e6e8e0e6af..e3212e8a3d1 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -189,9 +189,9 @@ void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select)
}
}
+#if 0
void arrows_move_cursor(unsigned short event)
{
-#if 0
short mval[2];
getmouseco_sc(mval);
@@ -205,8 +205,8 @@ void arrows_move_cursor(unsigned short event)
} else if(event==RIGHTARROWKEY) {
warp_pointer(mval[0]+1, mval[1]);
}
-#endif
}
+#endif
/* *********************** GESTURE AND LASSO ******************* */
@@ -404,7 +404,7 @@ void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves)
}
}
-static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int index)
+static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index))
{
struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData;
@@ -431,7 +431,7 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, EditEdge *eed, in
}
}
}
-static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int index)
+static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
{
struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData;
@@ -560,7 +560,7 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select
}
#endif
-static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
+static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
{
struct { ViewContext *vc; short (*mcords)[2]; short moves; short select; } *data = userData;
Object *obedit= data->vc->obedit;
@@ -1291,7 +1291,7 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1,
return 0;
}
-static void do_nurbs_box_select__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
+static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
{
struct { ViewContext *vc; rcti *rect; int select; } *data = userData;
Object *obedit= data->vc->obedit;
@@ -1359,7 +1359,7 @@ static void do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int e
lattice_foreachScreenVert(vc, do_lattice_box_select__doSelect, &data);
}
-static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int index)
+static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index))
{
struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData;
@@ -1384,7 +1384,7 @@ static void do_mesh_box_select__doSelectEdge(void *userData, EditEdge *eed, int
}
}
}
-static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int index)
+static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
{
struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData;
@@ -1800,7 +1800,7 @@ void VIEW3D_OT_select(wmOperatorType *ot)
/* -------------------- circle select --------------------------------------------- */
-static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int index)
+static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index))
{
struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData;
int mx = x - data->mval[0], my = y - data->mval[1];
@@ -1810,7 +1810,7 @@ static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y
eve->f = data->select?(eve->f|1):(eve->f&~1);
}
}
-static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
+static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index))
{
struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData;
@@ -1818,7 +1818,7 @@ static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int
EM_select_edge(eed, data->select);
}
}
-static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int index)
+static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
{
struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData;
int mx = x - data->mval[0], my = y - data->mval[1];
@@ -1892,7 +1892,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int selecting, short *m
}
-static void nurbscurve_circle_doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
+static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
{
struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData;
int mx = x - data->mval[0], my = y - data->mval[1];
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 7f5f7665028..d6778070931 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -82,7 +82,7 @@ static TransVert *transvmain=NULL;
static int tottrans= 0;
/* copied from editobject.c, now uses (almost) proper depgraph */
-static void special_transvert_update(Scene *scene, Object *obedit)
+static void special_transvert_update(Object *obedit)
{
if(obedit) {
@@ -443,7 +443,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
/* *********************** operators ******************** */
-static int snap_sel_to_grid(bContext *C, wmOperator *op)
+static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
{
extern float originmat[3][3]; /* XXX object.c */
Main *bmain= CTX_data_main(C);
@@ -481,7 +481,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op)
VECCOPY(tv->loc, vec);
}
- special_transvert_update(scene, obedit);
+ special_transvert_update(obedit);
MEM_freeN(transvmain);
transvmain= NULL;
@@ -577,7 +577,7 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot)
/* *************************************************** */
-static int snap_sel_to_curs(bContext *C, wmOperator *op)
+static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
{
extern float originmat[3][3]; /* XXX object.c */
Main *bmain= CTX_data_main(C);
@@ -602,15 +602,12 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op)
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
- vec[0]= curs[0]-obedit->obmat[3][0];
- vec[1]= curs[1]-obedit->obmat[3][1];
- vec[2]= curs[2]-obedit->obmat[3][2];
-
+ sub_v3_v3v3(vec, curs, obedit->obmat[3]);
mul_m3_v3(imat, vec);
- VECCOPY(tv->loc, vec);
+ copy_v3_v3(tv->loc, vec);
}
- special_transvert_update(scene, obedit);
+ special_transvert_update(obedit);
MEM_freeN(transvmain);
transvmain= NULL;
@@ -703,7 +700,7 @@ void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot)
/* *************************************************** */
-static int snap_curs_to_grid(bContext *C, wmOperator *op)
+static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
RegionView3D *rv3d= CTX_wm_region_data(C);
@@ -740,7 +737,7 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot)
/* **************************************************** */
-static int snap_curs_to_sel(bContext *C, wmOperator *op)
+static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Scene *scene= CTX_data_scene(C);
@@ -847,7 +844,7 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot)
/* ********************************************** */
-static int snap_curs_to_active(bContext *C, wmOperator *op)
+static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
Object *obact= CTX_data_active_object(C);
@@ -898,7 +895,7 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot)
/* **************************************************** */
/*New Code - Snap Cursor to Center -*/
-static int snap_curs_to_center(bContext *C, wmOperator *op)
+static int snap_curs_to_center(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
View3D *v3d= CTX_wm_view3d(C);
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 6e2624cb60b..16896f75915 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -65,7 +65,7 @@
/* op->invoke */
-static void redo_cb(bContext *C, void *arg_op, void *arg2)
+static void redo_cb(bContext *C, void *arg_op, void *UNUSED(arg2))
{
wmOperator *lastop= arg_op;
@@ -114,7 +114,7 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper
op->layout= NULL;
}
else
- uiDefAutoButsRNA(C, pa->layout, &ptr, 1);
+ uiDefAutoButsRNA(pa->layout, &ptr, 1);
}
static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa)
@@ -177,7 +177,7 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2)
}
-static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items)
+static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items)
{
wmOperatorType *ot = WM_operatortype_first();
@@ -280,7 +280,7 @@ void view3d_tool_props_register(ARegionType *art)
/* ********** operator to open/close toolshelf region */
-static int view3d_toolshelf(bContext *C, wmOperator *op)
+static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= view3d_has_tools_region(sa);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index d66144b2c30..8b3d99e355d 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -205,7 +205,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
if(quat) copy_qt_qt(sms.new_quat, quat);
if(dist) sms.new_dist= *dist;
if(lens) sms.new_lens= *lens;
-
+
if (camera) {
view3d_settings_from_ob(camera, sms.new_ofs, sms.new_quat, &sms.new_dist, &sms.new_lens);
sms.to_camera= 1; /* restore view3d values in end */
@@ -214,15 +214,15 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
if (C && U.smooth_viewtx) {
int changed = 0; /* zero means no difference */
- if (sms.new_dist != rv3d->dist)
+ if (oldcamera != camera)
changed = 1;
- if (sms.new_lens != v3d->lens)
+ else if (sms.new_dist != rv3d->dist)
changed = 1;
-
- if (!equals_v3v3(sms.new_ofs, rv3d->ofs))
+ else if (sms.new_lens != v3d->lens)
changed = 1;
-
- if (!equals_v4v4(sms.new_quat, rv3d->viewquat))
+ else if (!equals_v3v3(sms.new_ofs, rv3d->ofs))
+ changed = 1;
+ else if (!equals_v4v4(sms.new_quat, rv3d->viewquat))
changed = 1;
/* The new view is different from the old one
@@ -296,7 +296,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
}
/* only meant for timer usage */
-static int view3d_smoothview_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
@@ -380,7 +380,7 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot)
/* ****************** change view operators ****************** */
-static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob)
+static void setcameratoview3d(RegionView3D *rv3d, Object *ob)
{
float dvec[3];
float mat3[3][3];
@@ -399,7 +399,7 @@ static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob)
}
-static int view3d_setcameratoview_exec(bContext *C, wmOperator *op)
+static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
@@ -408,7 +408,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *op)
rv3d->lview= rv3d->view;
rv3d->lpersp= rv3d->persp;
- setcameratoview3d(v3d, rv3d, v3d->camera);
+ setcameratoview3d(rv3d, v3d->camera);
rv3d->persp = RV3D_CAMOB;
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, v3d->camera);
@@ -444,22 +444,26 @@ void VIEW3D_OT_setcameratoview(wmOperatorType *ot)
}
-static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
+static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
Scene *scene= CTX_data_scene(C);
-
- if(BASACT) {
+ Object *ob = CTX_data_active_object(C);
+
+ if(ob) {
+ Object *camera_old= (rv3d->persp == RV3D_CAMOB && scene->camera) ? scene->camera : NULL;
rv3d->persp= RV3D_CAMOB;
- v3d->camera= OBACT;
+ v3d->camera= ob;
if(v3d->scenelock)
- scene->camera= OBACT;
- smooth_view(C, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
+ scene->camera= ob;
+
+ if(camera_old != ob) /* unlikely but looks like a glitch when set to the same */
+ smooth_view(C, camera_old, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, CTX_data_scene(C));
}
- WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, CTX_data_scene(C));
-
return OPERATOR_FINISHED;
}
@@ -1596,7 +1600,7 @@ static void endlocalview(Scene *scene, ScrArea *sa)
}
}
-static int localview_exec(bContext *C, wmOperator *unused)
+static int localview_exec(bContext *C, wmOperator *UNUSED(unused))
{
View3D *v3d= CTX_wm_view3d(C);
@@ -1663,6 +1667,7 @@ static void RestoreState(bContext *C)
win->queue= queue_back;
GPU_state_init();
+ GPU_set_tpage(NULL, 0);
glPopAttrib();
}
@@ -1775,6 +1780,8 @@ static int game_engine_exec(bContext *C, wmOperator *op)
RegionView3D *rv3d;
rcti cam_frame;
+ (void)op; /* unused */
+
// bad context switch ..
if(!ED_view3d_context_activate(C))
return OPERATOR_CANCELLED;
@@ -1823,6 +1830,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
#else
+ (void)C; /* unused */
BKE_report(op->reports, RPT_ERROR, "Game engine is disabled in this build.");
return OPERATOR_CANCELLED;
#endif
@@ -1981,7 +1989,7 @@ typedef struct FlyInfo {
} FlyInfo;
-static void drawFlyPixel(const struct bContext *C, struct ARegion *ar, void *arg)
+static void drawFlyPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *arg)
{
FlyInfo *fly = arg;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index a6fcfb04982..ae0bce176c1 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -384,7 +384,7 @@ void BIF_selectOrientation() {
#endif
}
-static void view_editmove(unsigned short event)
+static void view_editmove(unsigned short UNUSED(event))
{
#if 0 // TRANSFORM_FIX_ME
int refresh = 0;
@@ -481,6 +481,8 @@ static void view_editmove(unsigned short event)
* */
#define TFM_MODAL_PROPSIZE_UP 20
#define TFM_MODAL_PROPSIZE_DOWN 21
+#define TFM_MODAL_AUTOIK_LEN_INC 22
+#define TFM_MODAL_AUTOIK_LEN_DEC 23
/* called in transform_ops.c, on each regeneration of keymaps */
wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
@@ -507,6 +509,8 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
{NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""},
{TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""},
{TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Poportional Influence", ""},
+ {TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""},
+ {TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
@@ -541,7 +545,12 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP);
WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
-
+
+ WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC);
+ WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC);
+ WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC);
+ WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC);
+
return keymap;
}
@@ -735,6 +744,16 @@ int transformEvent(TransInfo *t, wmEvent *event)
}
t->redraw |= TREDRAW_HARD;
break;
+ case TFM_MODAL_AUTOIK_LEN_INC:
+ if (t->flag & T_AUTOIK)
+ transform_autoik_update(t, 1);
+ t->redraw |= TREDRAW_HARD;
+ break;
+ case TFM_MODAL_AUTOIK_LEN_DEC:
+ if (t->flag & T_AUTOIK)
+ transform_autoik_update(t, -1);
+ t->redraw |= TREDRAW_HARD;
+ break;
default:
handled = 0;
break;
@@ -1201,7 +1220,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments
glEnd();
}
-static void drawHelpline(bContext *C, int x, int y, void *customdata)
+static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
{
TransInfo *t = (TransInfo*)customdata;
@@ -1333,16 +1352,16 @@ static void drawHelpline(bContext *C, int x, int y, void *customdata)
}
}
-void drawTransformView(const struct bContext *C, struct ARegion *ar, void *arg)
+void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg)
{
TransInfo *t = arg;
- drawConstraint(C, t);
+ drawConstraint(t);
drawPropCircle(C, t);
drawSnapping(C, t);
}
-void drawTransformPixel(const struct bContext *C, struct ARegion *ar, void *arg)
+void drawTransformPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *UNUSED(arg))
{
// TransInfo *t = arg;
//
@@ -1534,7 +1553,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) ||
(ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) ||
(ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) ||
- (kmi->type == COMMANDKEY && event->oskey)) {
+ (kmi->type == OSKEY && event->oskey)) {
t->modifiers |= MOD_SNAP_INVERT;
}
break;
@@ -1723,7 +1742,7 @@ void transformApply(const bContext *C, TransInfo *t)
}
}
-void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg)
+void drawTransformApply(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg)
{
TransInfo *t = arg;
@@ -1896,7 +1915,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu
/* ******************* TRANSFORM LIMITS ********************** */
-static void constraintTransLim(TransInfo *t, TransData *td)
+static void constraintTransLim(TransInfo *UNUSED(t), TransData *td)
{
if (td->con) {
bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT);
@@ -1991,7 +2010,7 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
}
}
-static void constraintRotLim(TransInfo *t, TransData *td)
+static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
{
if (td->con) {
bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT);
@@ -2211,7 +2230,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event)
return status;
}
-int Warp(TransInfo *t, short mval[2])
+int Warp(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td = t->data;
float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3];
@@ -2309,7 +2328,7 @@ int Warp(TransInfo *t, short mval[2])
/* ************************** SHEAR *************************** */
-void postInputShear(TransInfo *t, float values[3])
+void postInputShear(TransInfo *UNUSED(t), float values[3])
{
mul_v3_fl(values, 0.05f);
}
@@ -2359,7 +2378,7 @@ int handleEventShear(TransInfo *t, wmEvent *event)
}
-int Shear(TransInfo *t, short mval[2])
+int Shear(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td = t->data;
float vec[3];
@@ -2723,7 +2742,7 @@ void initToSphere(TransInfo *t)
t->val /= (float)t->total;
}
-int ToSphere(TransInfo *t, short mval[2])
+int ToSphere(TransInfo *t, short UNUSED(mval[2]))
{
float vec[3];
float ratio, radius;
@@ -3058,7 +3077,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
}
}
-int Rotation(TransInfo *t, short mval[2])
+int Rotation(TransInfo *t, short UNUSED(mval[2]))
{
char str[64];
@@ -3172,7 +3191,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
}
}
-int Trackball(TransInfo *t, short mval[2])
+int Trackball(TransInfo *t, short UNUSED(mval[2]))
{
char str[128];
float axis1[3], axis2[3];
@@ -3391,7 +3410,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) {
}
/* uses t->vec to store actual translation in */
-int Translation(TransInfo *t, short mval[2])
+int Translation(TransInfo *t, short UNUSED(mval[2]))
{
char str[250];
@@ -3457,7 +3476,7 @@ void initShrinkFatten(TransInfo *t)
-int ShrinkFatten(TransInfo *t, short mval[2])
+int ShrinkFatten(TransInfo *t, short UNUSED(mval[2]))
{
float vec[3];
float distance;
@@ -3532,7 +3551,7 @@ void initTilt(TransInfo *t)
-int Tilt(TransInfo *t, short mval[2])
+int Tilt(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td = t->data;
int i;
@@ -3604,7 +3623,7 @@ void initCurveShrinkFatten(TransInfo *t)
t->flag |= T_NO_CONSTRAINT;
}
-int CurveShrinkFatten(TransInfo *t, short mval[2])
+int CurveShrinkFatten(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td = t->data;
float ratio;
@@ -3672,7 +3691,7 @@ void initPushPull(TransInfo *t)
}
-int PushPull(TransInfo *t, short mval[2])
+int PushPull(TransInfo *t, short UNUSED(mval[2]))
{
float vec[3], axis[3];
float distance;
@@ -3805,7 +3824,7 @@ int handleEventBevel(TransInfo *t, wmEvent *event)
return 0;
}
-int Bevel(TransInfo *t, short mval[2])
+int Bevel(TransInfo *t, short UNUSED(mval[2]))
{
float distance,d;
int i;
@@ -3873,7 +3892,7 @@ void initBevelWeight(TransInfo *t)
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
-int BevelWeight(TransInfo *t, short mval[2])
+int BevelWeight(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td = t->data;
float weight;
@@ -3946,7 +3965,7 @@ void initCrease(TransInfo *t)
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
-int Crease(TransInfo *t, short mval[2])
+int Crease(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td = t->data;
float crease;
@@ -4140,7 +4159,7 @@ void initBoneEnvelope(TransInfo *t)
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
-int BoneEnvelope(TransInfo *t, short mval[2])
+int BoneEnvelope(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td = t->data;
float ratio;
@@ -4846,7 +4865,7 @@ int doEdgeSlide(TransInfo *t, float perc)
return 1;
}
-int EdgeSlide(TransInfo *t, short mval[2])
+int EdgeSlide(TransInfo *t, short UNUSED(mval[2]))
{
char str[50];
float final;
@@ -4905,7 +4924,7 @@ void initBoneRoll(TransInfo *t)
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
-int BoneRoll(TransInfo *t, short mval[2])
+int BoneRoll(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td = t->data;
int i;
@@ -5041,7 +5060,7 @@ void initMirror(TransInfo *t)
}
}
-int Mirror(TransInfo *t, short mval[2])
+int Mirror(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td;
float size[3], mat[3][3];
@@ -5118,7 +5137,7 @@ void initAlign(TransInfo *t)
initMouseInputMode(t, &t->mouse, INPUT_NONE);
}
-int Align(TransInfo *t, short mval[2])
+int Align(TransInfo *t, short UNUSED(mval[2]))
{
TransData *td = t->data;
float center[3];
@@ -5221,7 +5240,7 @@ static void applySeqSlide(TransInfo *t, float val[2]) {
}
}
-int SeqSlide(TransInfo *t, short mval[2])
+int SeqSlide(TransInfo *t, short UNUSED(mval[2]))
{
char str[200];
@@ -5449,7 +5468,7 @@ static void headerTimeTranslate(TransInfo *t, char *str)
sprintf(str, "DeltaX: %s", &tvec[0]);
}
-static void applyTimeTranslate(TransInfo *t, float sval)
+static void applyTimeTranslate(TransInfo *t, float UNUSED(sval))
{
TransData *td = t->data;
TransData2D *td2d = t->data2d;
@@ -5751,7 +5770,7 @@ static void applyTimeScale(TransInfo *t) {
}
}
-int TimeScale(TransInfo *t, short mval[2])
+int TimeScale(TransInfo *t, short UNUSED(mval[2]))
{
char str[200];
@@ -5772,7 +5791,7 @@ int TimeScale(TransInfo *t, short mval[2])
/* ************************************ */
-void BIF_TransformSetUndo(char *str)
+void BIF_TransformSetUndo(char *UNUSED(str))
{
// TRANSFORM_FIX_ME
//Trans.undostr= str;
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 6cfe78a979d..bb6ffe9155f 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -571,7 +571,7 @@ void autokeyframe_pose_cb_func(struct bContext *C, struct Scene *scene, struct V
/*********************** Constraints *****************************/
-void drawConstraint(const struct bContext *C, TransInfo *t);
+void drawConstraint(TransInfo *t);
void getConstraintMatrix(TransInfo *t);
void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]);
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 1e6916f0a86..b15c5b07758 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -593,7 +593,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
/*----------------- DRAWING CONSTRAINTS -------------------*/
-void drawConstraint(const struct bContext *C, TransInfo *t)
+void drawConstraint(TransInfo *t)
{
TransCon *tc = &(t->con);
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 01404603b86..d723f77f537 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -232,7 +232,7 @@ static void set_prop_dist(TransInfo *t, short with_dist)
/* ********************* texture space ********* */
-static void createTransTexspace(bContext *C, TransInfo *t)
+static void createTransTexspace(TransInfo *t)
{
Scene *scene = t->scene;
TransData *td;
@@ -277,7 +277,7 @@ static void createTransTexspace(bContext *C, TransInfo *t)
/* ********************* edge (for crease) ***** */
-static void createTransEdge(bContext *C, TransInfo *t) {
+static void createTransEdge(TransInfo *t) {
EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
TransData *td = NULL;
EditEdge *eed;
@@ -446,16 +446,21 @@ static short apply_targetless_ik(Object *ob)
/* apply and decompose, doesn't work for constraints or non-uniform scale well */
{
float rmat3[3][3], qrmat[3][3], imat[3][3], smat[3][3];
-
+
copy_m3_m4(rmat3, rmat);
/* rotation */
- if (parchan->rotmode > 0)
- mat3_to_eulO( parchan->eul, parchan->rotmode,rmat3);
+ /* [#22409] is partially caused by this, as slight numeric error introduced during
+ * the solving process leads to locked-axis values changing. However, we cannot modify
+ * the values here, or else there are huge discreptancies between IK-solver (interactive)
+ * and applied poses.
+ */
+ if (parchan->rotmode > 0)
+ mat3_to_eulO(parchan->eul, parchan->rotmode,rmat3);
else if (parchan->rotmode == ROT_MODE_AXISANGLE)
- mat3_to_axis_angle( parchan->rotAxis, &pchan->rotAngle,rmat3);
+ mat3_to_axis_angle(parchan->rotAxis, &parchan->rotAngle,rmat3);
else
- mat3_to_quat( parchan->quat,rmat3);
+ mat3_to_quat(parchan->quat,rmat3);
/* for size, remove rotation */
/* causes problems with some constraints (so apply only if needed) */
@@ -840,9 +845,9 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
data->flag |= CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO;
VECCOPY(data->grabtarget, pchan->pose_tail);
data->rootbone= 1;
-
- /* we include only a connected chain */
- while ((pchan) && (pchan->bone->flag & BONE_CONNECTED)) {
+
+ /* we only include bones that are part of a continual connected chain */
+ while (pchan) {
/* here, we set ik-settings for bone from pchan->protectflag */
if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
if (pchan->protectflag & OB_LOCK_ROTY) pchan->ikflag |= BONE_IK_NO_YDOF_TEMP;
@@ -850,7 +855,12 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
/* now we count this pchan as being included */
data->rootbone++;
- pchan= pchan->parent;
+
+ /* continue to parent, but only if we're connected to it */
+ if (pchan->bone->flag & BONE_CONNECTED)
+ pchan = pchan->parent;
+ else
+ pchan = NULL;
}
/* make a copy of maximum chain-length */
@@ -930,7 +940,7 @@ static short pose_grab_with_ik(Object *ob)
/* only called with pose mode active object now */
-static void createTransPose(bContext *C, TransInfo *t, Object *ob)
+static void createTransPose(TransInfo *t, Object *ob)
{
bArmature *arm;
bPoseChannel *pchan;
@@ -995,7 +1005,7 @@ static void createTransPose(bContext *C, TransInfo *t, Object *ob)
/* ********************* armature ************** */
-static void createTransArmatureVerts(bContext *C, TransInfo *t)
+static void createTransArmatureVerts(TransInfo *t)
{
EditBone *ebo;
bArmature *arm= t->obedit->data;
@@ -1195,7 +1205,7 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
/* ********************* meta elements ********* */
-static void createTransMBallVerts(bContext *C, TransInfo *t)
+static void createTransMBallVerts(TransInfo *t)
{
MetaBall *mb = (MetaBall*)t->obedit->data;
MetaElem *ml;
@@ -1530,7 +1540,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
/* ********************* lattice *************** */
-static void createTransLatticeVerts(bContext *C, TransInfo *t)
+static void createTransLatticeVerts(TransInfo *t)
{
Lattice *latt = ((Lattice*)t->obedit->data)->editlatt->latt;
TransData *td = NULL;
@@ -1896,7 +1906,7 @@ static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert
/* *********************** CrazySpace correction. Now without doing subsurf optimal ****************** */
-static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
+static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
float *vec = userData;
@@ -2145,7 +2155,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
/* detect CrazySpace [tm] */
if(propmode==0) {
if(modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) {
- if(modifiers_isCorrectableDeformed(t->scene, t->obedit)) {
+ if(modifiers_isCorrectableDeformed(t->obedit)) {
/* check if we can use deform matrices for modifier from the
start up to stack, they are more accurate than quats */
totleft= editmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos);
@@ -2274,11 +2284,10 @@ void flushTransNodes(TransInfo *t)
}
/* *** SEQUENCE EDITOR *** */
-#define XXX_DURIAN_ANIM_TX_HACK
void flushTransSeq(TransInfo *t)
{
ListBase *seqbasep= seq_give_editing(t->scene, FALSE)->seqbasep; /* Editing null check already done */
- int a, new_frame;
+ int a, new_frame, old_start;
TransData *td= NULL;
TransData2D *td2d= NULL;
TransDataSeq *tdsq= NULL;
@@ -2295,16 +2304,11 @@ void flushTransSeq(TransInfo *t)
for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
tdsq= (TransDataSeq *)td->extra;
seq= tdsq->seq;
+ old_start = seq->start;
new_frame= (int)floor(td2d->loc[0] + 0.5f);
switch (tdsq->sel_flag) {
case SELECT:
-#ifdef XXX_DURIAN_ANIM_TX_HACK
- if (seq != seq_prev) {
- int ofs = (new_frame - tdsq->start_offset) - seq->start; // breaks for single strips - color/image
- seq_offset_animdata(t->scene, seq, ofs);
- }
-#endif
if (seq->type != SEQ_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */
seq->start= new_frame - tdsq->start_offset;
@@ -2335,6 +2339,9 @@ void flushTransSeq(TransInfo *t)
else {
calc_sequence_disp(t->scene, seq);
}
+
+ if(tdsq->sel_flag == SELECT)
+ seq_offset_animdata(t->scene, seq, seq->start - old_start);
}
seq_prev= seq;
}
@@ -3841,6 +3848,7 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list)
* seq->depth must be set before running this function so we know if the strips
* are root level or not
*/
+#define XXX_DURIAN_ANIM_TX_HACK
static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count, int *flag)
{
@@ -3978,7 +3986,7 @@ static int SeqTransCount(TransInfo *t, ListBase *seqbase, int depth)
}
-static TransData *SeqToTransData(TransInfo *t, TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag)
+static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag)
{
int start_left;
@@ -4063,16 +4071,16 @@ static int SeqToTransData_Recursive(TransInfo *t, ListBase *seqbase, TransData *
if (flag & SELECT) {
if (flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) {
if (flag & SEQ_LEFTSEL) {
- SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL);
+ SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL);
tot++;
}
if (flag & SEQ_RIGHTSEL) {
- SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL);
+ SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL);
tot++;
}
}
else {
- SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SELECT);
+ SeqToTransData(td++, td2d++, tdsq++, seq, flag, SELECT);
tot++;
}
}
@@ -4232,7 +4240,7 @@ static void createTransSeqData(bContext *C, TransInfo *t)
/* transcribe given object into TransData for Transforming */
-static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *ob)
+static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
{
Scene *scene = t->scene;
float obmtx[3][3];
@@ -4342,7 +4350,7 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *
/* sets flags in Bases to define whether they take part in transform */
/* it deselects Bases, so we have to call the clear function always after */
-static void set_trans_object_base_flags(bContext *C, TransInfo *t)
+static void set_trans_object_base_flags(TransInfo *t)
{
Scene *scene = t->scene;
View3D *v3d = t->view;
@@ -4720,7 +4728,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
*/
if (C && (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) {
//ED_pose_clear_paths(C, ob); // XXX for now, don't need to clear
- ED_pose_recalculate_paths(C, scene, ob);
+ ED_pose_recalculate_paths(scene, ob);
}
}
else {
@@ -5091,7 +5099,7 @@ static void createTransObject(bContext *C, TransInfo *t)
TransDataExtension *tx;
int propmode = t->flag & T_PROP_EDIT;
- set_trans_object_base_flags(C, t);
+ set_trans_object_base_flags(t);
/* count */
t->total= CTX_DATA_COUNT(C, selected_objects);
@@ -5130,7 +5138,7 @@ static void createTransObject(bContext *C, TransInfo *t)
td->flag |= TD_SKIP;
}
- ObjectToTransData(C, t, td, ob);
+ ObjectToTransData(t, td, ob);
td->val = NULL;
td++;
tx++;
@@ -5153,7 +5161,7 @@ static void createTransObject(bContext *C, TransInfo *t)
td->ext = tx;
td->rotOrder= ob->rotmode;
- ObjectToTransData(C, t, td, ob);
+ ObjectToTransData(t, td, ob);
td->val = NULL;
td++;
tx++;
@@ -5210,12 +5218,12 @@ void createTransData(bContext *C, TransInfo *t)
if (t->options & CTX_TEXTURE) {
t->flag |= T_TEXTURE;
- createTransTexspace(C, t);
+ createTransTexspace(t);
}
else if (t->options & CTX_EDGE) {
t->ext = NULL;
t->flag |= T_EDIT;
- createTransEdge(C, t);
+ createTransEdge(t);
if(t->data && t->flag & T_PROP_EDIT) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 1);
@@ -5277,14 +5285,14 @@ void createTransData(bContext *C, TransInfo *t)
createTransCurveVerts(C, t);
}
else if (t->obedit->type==OB_LATTICE) {
- createTransLatticeVerts(C, t);
+ createTransLatticeVerts(t);
}
else if (t->obedit->type==OB_MBALL) {
- createTransMBallVerts(C, t);
+ createTransMBallVerts(t);
}
else if (t->obedit->type==OB_ARMATURE) {
t->flag &= ~T_PROP_EDIT;
- createTransArmatureVerts(C, t);
+ createTransArmatureVerts(t);
}
else {
printf("edit type not implemented!\n");
@@ -5315,22 +5323,22 @@ void createTransData(bContext *C, TransInfo *t)
else if (ob && (ob->mode & OB_MODE_POSE)) {
// XXX this is currently limited to active armature only...
// XXX active-layer checking isn't done as that should probably be checked through context instead
- createTransPose(C, t, ob);
+ createTransPose(t, ob);
}
else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
- /* exception, we look for the one selected armature */
- CTX_DATA_BEGIN(C, Object*, ob_armature, selected_objects)
- {
- if(ob_armature->type==OB_ARMATURE)
- {
- if((ob_armature->mode & OB_MODE_POSE) && ob_armature == modifiers_isDeformedByArmature(ob))
- {
- createTransPose(C, t, ob_armature);
- break;
+ /* important that ob_armature can be set even when its not selected [#23412]
+ * lines below just check is also visible */
+ Object *ob_armature= modifiers_isDeformedByArmature(ob);
+ if(ob_armature && ob_armature->mode & OB_MODE_POSE) {
+ Base *base_arm= object_in_scene(ob_armature, t->scene);
+ if(base_arm) {
+ View3D *v3d = t->view;
+ if(BASE_VISIBLE(v3d, base_arm)) {
+ createTransPose(t, ob_armature);
}
}
+
}
- CTX_DATA_END;
}
else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)
&& PE_start_edit(PE_get_current(scene, ob))) {
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 54a86b3dca1..ce0888b6a30 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -55,7 +55,7 @@ void InputVector(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
}
-void InputSpring(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
+void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3])
{
float ratio, precise_ratio, dx, dy;
if(mi->precision)
@@ -93,7 +93,7 @@ void InputSpringFlip(TransInfo *t, MouseInput *mi, short mval[2], float output[3
}
}
-void InputTrackBall(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
+void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3])
{
if(mi->precision)
@@ -162,7 +162,7 @@ void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, short mval[2], float ou
output[0] = dot_v3v3(t->viewinv[1], vec) * 2.0f;
}
-void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2])
+void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, short start[2], short end[2])
{
short *data;
@@ -178,7 +178,7 @@ void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2])
data[3] = end[1];
}
-void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
+void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3])
{
float length;
float distance;
@@ -211,7 +211,7 @@ void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[
}
}
-void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
+void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3])
{
double dx2 = mval[0] - mi->center[0];
double dy2 = mval[1] - mi->center[1];
@@ -272,7 +272,7 @@ void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
output[0] = *angle;
}
-void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], short mval[2])
+void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], short mval[2])
{
mi->factor = 0;
mi->precision = 0;
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 51698c27b37..030ad190dc3 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -101,16 +101,6 @@
#define MAN_GHOST 1
#define MAN_MOVECOL 2
-
-static int is_mat4_flipped(float mat[][4])
-{
- float vec[3];
-
- cross_v3_v3v3(vec, mat[0], mat[1]);
- if( dot_v3v3(vec, mat[2]) < 0.0 ) return 1;
- return 0;
-}
-
/* transform widget center calc helper for below */
static void calc_tw_center(Scene *scene, float *co)
{
@@ -753,7 +743,7 @@ static void preOrthoFront(int ortho, float twmat[][4], int axis)
orthogonalize_m4(omat, axis);
glPushMatrix();
glMultMatrixf(omat);
- glFrontFace( is_mat4_flipped(omat)?GL_CW:GL_CCW);
+ glFrontFace(is_negative_m4(omat) ? GL_CW:GL_CCW);
}
}
@@ -850,12 +840,12 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
// XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
if (ortho) {
glMultMatrixf(matt);
- glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW);
+ glFrontFace(is_negative_m4(matt) ? GL_CW:GL_CCW);
}
}
else {
if (ortho) {
- glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW);
+ glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW);
glMultMatrixf(rv3d->twmat);
}
}
@@ -1116,11 +1106,11 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
// XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
glMultMatrixf(matt);
- glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW);
+ glFrontFace(is_negative_m4(matt) ? GL_CW:GL_CCW);
}
else {
glMultMatrixf(rv3d->twmat);
- glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW);
+ glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW);
}
/* axis */
@@ -1197,7 +1187,7 @@ static void draw_cylinder(GLUquadricObj *qobj, float len, float width)
}
-static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int moving, int drawflags, int combo, int colcode)
+static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUSED(moving), int drawflags, int combo, int colcode)
{
GLUquadricObj *qobj;
float cylen= 0.01f*(float)U.tw_handlesize;
@@ -1327,7 +1317,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
glMultMatrixf(rv3d->twmat);
}
- glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW);
+ glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW);
/* axis */
if( (G.f & G_PICKSEL)==0 ) {
diff --git a/source/blender/editors/transform/transform_ndofinput.c b/source/blender/editors/transform/transform_ndofinput.c
index 3e47484c54c..1ff16dd5f5f 100644
--- a/source/blender/editors/transform/transform_ndofinput.c
+++ b/source/blender/editors/transform/transform_ndofinput.c
@@ -65,7 +65,7 @@ static void resetNDofInput(NDofInput *n)
}
-int handleNDofInput(NDofInput *n, wmEvent *event)
+int handleNDofInput(NDofInput *UNUSED(n), wmEvent *UNUSED(event))
{
int retval = 0;
// TRANSFORM_FIX_ME
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 0187a3b3567..381612bf1ef 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -145,7 +145,7 @@ static int select_orientation_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int select_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
uiPopupMenu *pup;
uiLayout *layout;
@@ -179,7 +179,7 @@ void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot)
}
-static int delete_orientation_exec(bContext *C, wmOperator *op)
+static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d = CTX_wm_view3d(C);
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
@@ -192,7 +192,7 @@ static int delete_orientation_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
return delete_orientation_exec(C, op);
}
@@ -243,7 +243,7 @@ static int create_orientation_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
return create_orientation_exec(C, op);
}
@@ -445,9 +445,9 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
}
- // Add confirm method all the time. At the end because it's not really that important and should be hidden
+ // Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ //RNA_def_property_flag(prop, PROP_HIDDEN);
}
void TRANSFORM_OT_translate(struct wmOperatorType *ot)
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 210ab0d45a8..a01a3b17cd2 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -141,7 +141,7 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name
}
}
-TransformOrientation *createObjectSpace(bContext *C, ReportList *reports, char *name, int overwrite) {
+TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) {
Base *base = CTX_data_active_base(C);
Object *ob;
float mat[3][3];
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 93331dd0ee3..adaaf7c9de6 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -210,7 +210,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
}
}
-int handleSnapping(TransInfo *t, wmEvent *event)
+int handleSnapping(TransInfo *UNUSED(t), wmEvent *UNUSED(event))
{
int status = 0;
@@ -596,7 +596,7 @@ void ApplySnapResize(TransInfo *t, float vec[3])
/********************** DISTANCE **************************/
-float TranslationBetween(TransInfo *t, float p1[3], float p2[3])
+float TranslationBetween(TransInfo *UNUSED(t), float p1[3], float p2[3])
{
return len_v3v3(p1, p2);
}
@@ -680,12 +680,12 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
/********************** CALC **************************/
-void CalcSnapGrid(TransInfo *t, float *vec)
+void CalcSnapGrid(TransInfo *t, float *UNUSED(vec))
{
snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS);
}
-void CalcSnapGeometry(TransInfo *t, float *vec)
+void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
{
if (t->spacetype == SPACE_VIEW3D)
{
@@ -784,6 +784,10 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
if (dist != FLT_MAX)
{
VECCOPY(loc, p);
+ /* XXX, is there a correct normal in this case ???, for now just z up */
+ no[0]= 0.0;
+ no[1]= 0.0;
+ no[2]= 1.0;
found = 1;
}
@@ -1190,7 +1194,7 @@ int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray
return retval;
}
-int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *no, int *dist, float *depth)
+int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *UNUSED(no), int *dist, float *depth)
{
float imat[4][4];
float ray_start_local[3], ray_normal_local[3];
@@ -1297,15 +1301,18 @@ int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, E
BVHTreeRayHit hit;
BVHTreeFromMesh treeData;
+ /* local scale in normal direction */
+ float local_scale = len_v3(ray_normal_local);
+
bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6);
hit.index = -1;
- hit.dist = *depth;
+ hit.dist = *depth * (*depth == FLT_MAX ? 1.0f : local_scale);
if(treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
{
- if(hit.dist<=*depth) {
- *depth= hit.dist;
+ if(hit.dist/local_scale <= *depth) {
+ *depth= hit.dist/local_scale;
copy_v3_v3(loc, hit.co);
copy_v3_v3(no, hit.no);
@@ -1580,7 +1587,7 @@ int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mv
base= FIRSTBASE;
for ( base = FIRSTBASE; base != NULL; base = base->next ) {
- if ( BASE_SELECTABLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) {
+ if ( BASE_VISIBLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) {
Object *ob = base->object;
if (ob->transflag & OB_DUPLI)
@@ -1675,7 +1682,7 @@ void addDepthPeel(ListBase *depth_peels, float depth, float p[3], float no[3], O
peel->flag = 0;
}
-int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], ListBase *depth_peels)
+int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float UNUSED(mval[2]), ListBase *depth_peels)
{
int retval = 0;
int totvert = dm->getNumVerts(dm);
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 290c8a64881..debb8cedd07 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -37,6 +37,7 @@
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
@@ -74,7 +75,7 @@ void undo_editmode_menu(void) // history menu
/* ********************************************************************* */
/* ****** XXX ***** */
-void error(const char *dummy) {}
+void error(const char *UNUSED(arg)) {}
/* ****** XXX ***** */
@@ -341,7 +342,7 @@ void undo_editmode_menu(bContext *C)
if(event>0) undo_number(C, event);
}
-static void do_editmode_undohistorymenu(bContext *C, void *arg, int event)
+static void do_editmode_undohistorymenu(bContext *C, void *UNUSED(arg), int event)
{
Object *obedit= CTX_data_edit_object(C);
@@ -351,7 +352,7 @@ static void do_editmode_undohistorymenu(bContext *C, void *arg, int event)
}
-uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *arg_unused)
+uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *UNUSED(arg))
{
uiBlock *block;
UndoElem *uel;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 1d81db70811..40bd5792e4f 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -196,14 +196,14 @@ void ED_undo_pop_op(bContext *C, wmOperator *op)
ed_undo_step(C, 0, op->type->name);
}
-static int ed_undo_exec(bContext *C, wmOperator *op)
+static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op))
{
/* "last operator" should disappear, later we can tie ths with undo stack nicer */
WM_operator_stack_clear(C);
return ed_undo_step(C, 1, NULL);
}
-static int ed_redo_exec(bContext *C, wmOperator *op)
+static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op))
{
return ed_undo_step(C, -1, NULL);
}
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index f1f2dd8548a..5169b096d09 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -113,7 +113,7 @@ static int draw_uvs_face_check(Scene *scene)
return (ts->uv_selectmode == UV_SELECT_FACE);
}
-static void draw_uvs_shadow(SpaceImage *sima, Object *obedit)
+static void draw_uvs_shadow(Object *obedit)
{
EditMesh *em;
EditFace *efa;
@@ -374,7 +374,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac
}
}
-static void draw_uvs_other(SpaceImage *sima, Scene *scene, Object *obedit, MTFace *activetf)
+static void draw_uvs_other(Scene *scene, Object *obedit, MTFace *activetf)
{
Base *base;
Image *curimage;
@@ -440,7 +440,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
/* draw other uvs */
if(sima->flag & SI_DRAW_OTHER)
- draw_uvs_other(sima, scene, obedit, activetf);
+ draw_uvs_other(scene, obedit, activetf);
/* 1. draw shadow mesh */
@@ -838,7 +838,7 @@ void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedi
if(show_uvedit || show_uvshadow) {
if(show_uvshadow)
- draw_uvs_shadow(sima, obedit);
+ draw_uvs_shadow(obedit);
else
draw_uvs(sima, scene, obedit);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 565bad987e3..d311733e945 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -141,7 +141,7 @@ void ED_uvedit_assign_image(Scene *scene, Object *obedit, Image *ima, Image *pre
/* dotile - 1, set the tile flag (from the space image)
* 2, set the tile index for the faces. */
-void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, int curtile)
+static int uvedit_set_tile(Object *obedit, Image *ima, int curtile)
{
EditMesh *em;
EditFace *efa;
@@ -149,11 +149,14 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i
/* verify if we have something to do */
if(!ima || !ED_uvedit_test(obedit))
- return;
-
+ return 0;
+
+ if((ima->tpageflag & IMA_TILES) == 0)
+ return 0;
+
/* skip assigning these procedural images... */
if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
- return;
+ return 0;
em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
@@ -165,8 +168,9 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i
}
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
+
+ return 1;
}
/*********************** space conversion *********************/
@@ -845,7 +849,8 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2]
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(uvedit_face_visible(scene, ima, efa, tf)) {
- if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) {
+ const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
+ if(tf->flag & select_flag) {
stack[stacksize]= a;
stacksize++;
flag[a]= 1;
@@ -909,12 +914,9 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2]
else {
for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
if(flag[a]) {
+ const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if(efa->v4) {
- if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)))
- break;
- }
- else if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
+ if((tf->flag & select_flag))
break;
}
}
@@ -1052,7 +1054,7 @@ void UV_OT_align(wmOperatorType *ot)
/* ******************** weld operator **************** */
-static int weld_exec(bContext *C, wmOperator *op)
+static int weld_exec(bContext *C, wmOperator *UNUSED(op))
{
weld_align_uv(C, 'w');
@@ -1264,7 +1266,7 @@ void UV_OT_stitch(wmOperatorType *ot)
/* ******************** (de)select all operator **************** */
-static int select_inverse_exec(bContext *C, wmOperator *op)
+static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene;
ToolSettings *ts;
@@ -1355,10 +1357,11 @@ static int select_all_exec(bContext *C, wmOperator *op)
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
for(efa= em->faces.first; efa; efa= efa->next) {
+ const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(uvedit_face_visible(scene, ima, efa, tf)) {
- if(tf->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) {
+ if(tf->flag & select_flag) {
action = SEL_DESELECT;
break;
}
@@ -1370,12 +1373,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(uvedit_face_visible(scene, ima, efa, tf)) {
- char select_flag;
-
- if(efa->v4)
- select_flag = (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
- else
- select_flag = (TF_SEL1+TF_SEL2+TF_SEL3);
+ const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
switch (action) {
case SEL_SELECT:
@@ -1937,14 +1935,10 @@ static int unlink_selection_exec(bContext *C, wmOperator *op)
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(uvedit_face_visible(scene, ima, efa, tf)) {
- if(efa->v4) {
- if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4))
- tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
- }
- else {
- if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
- tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3);
- }
+ const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
+ if(~tf->flag & select_flag)
+ tf->flag &= ~select_flag;
+
}
}
@@ -2260,7 +2254,7 @@ void UV_OT_select_border(wmOperatorType *ot)
/* ******************** circle select operator **************** */
-static void select_uv_inside_ellipse(SpaceImage *sima, Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index)
+static void select_uv_inside_ellipse(Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index)
{
/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
float x, y, r2, *uv;
@@ -2309,11 +2303,11 @@ int circle_select_exec(bContext *C, wmOperator *op)
/* do selection */
for(efa= em->faces.first; efa; efa= efa->next) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- select_uv_inside_ellipse(sima, scene, select, efa, tface, 0, offset, ellipse, 0);
- select_uv_inside_ellipse(sima, scene, select, efa, tface, 1, offset, ellipse, 1);
- select_uv_inside_ellipse(sima, scene, select, efa, tface, 2, offset, ellipse, 2);
+ select_uv_inside_ellipse(scene, select, efa, tface, 0, offset, ellipse, 0);
+ select_uv_inside_ellipse(scene, select, efa, tface, 1, offset, ellipse, 1);
+ select_uv_inside_ellipse(scene, select, efa, tface, 2, offset, ellipse, 2);
if(efa->v4)
- select_uv_inside_ellipse(sima, scene, select, efa, tface, 3, offset, ellipse, 3);
+ select_uv_inside_ellipse(scene, select, efa, tface, 3, offset, ellipse, 3);
}
if(select) EM_select_flush(em);
@@ -2714,7 +2708,7 @@ void UV_OT_pin(wmOperatorType *ot)
/******************* select pinned operator ***************/
-static int select_pinned_exec(bContext *C, wmOperator *op)
+static int select_pinned_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
@@ -2800,11 +2794,9 @@ static int hide_exec(bContext *C, wmOperator *op)
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
}
else if(em->selectmode == SCE_SELECT_FACE) {
- if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))==0) {
- if(!efa->v4)
- EM_select_face(efa, 0);
- else if(!(tf->flag & TF_SEL4))
- EM_select_face(efa, 0);
+ const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
+ if((tf->flag & select_flag)==0) {
+ EM_select_face(efa, 0);
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
}
}
@@ -2845,9 +2837,8 @@ static int hide_exec(bContext *C, wmOperator *op)
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
}
else if(em->selectmode == SCE_SELECT_FACE) {
- if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))
- EM_select_face(efa, 0);
- else if(efa->v4 && tf->flag & TF_SEL4)
+ const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
+ if(tf->flag & select_flag)
EM_select_face(efa, 0);
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
@@ -2902,7 +2893,7 @@ void UV_OT_hide(wmOperatorType *ot)
/****************** reveal operator ******************/
-static int reveal_exec(bContext *C, wmOperator *op)
+static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima= CTX_wm_space_image(C);
ToolSettings *ts= CTX_data_tool_settings(C);
@@ -3086,16 +3077,18 @@ static int set_tile_exec(bContext *C, wmOperator *op)
{
Image *ima= CTX_data_edit_image(C);
int tile[2];
-
- if(!ima || !(ima->tpageflag & IMA_TILES))
- return OPERATOR_CANCELLED;
+ Object *obedit= CTX_data_edit_object(C);
RNA_int_get_array(op->ptr, "tile", tile);
- ED_uvedit_set_tile(C, CTX_data_scene(C), CTX_data_edit_object(C), ima, tile[0] + ima->xrep*tile[1]);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL);
+ if(uvedit_set_tile(obedit, ima, tile[0] + ima->xrep*tile[1])) {
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL);
- return OPERATOR_FINISHED;
+ return OPERATOR_FINISHED;
+ }
+
+ return OPERATOR_CANCELLED;
}
static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -3239,6 +3232,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
/* menus */
WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
ED_object_generic_keymap(keyconf, keymap, 2);
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 20c9fa5877b..e5e46d407c9 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -330,7 +330,7 @@ static int minimize_stretch_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
MinStretch *ms;
@@ -425,7 +425,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot)
/* ******************** Pack Islands operator **************** */
-static int pack_islands_exec(bContext *C, wmOperator *op)
+static int pack_islands_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
@@ -458,7 +458,7 @@ void UV_OT_pack_islands(wmOperatorType *ot)
/* ******************** Average Islands Scale operator **************** */
-static int average_islands_scale_exec(bContext *C, wmOperator *op)
+static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
@@ -975,7 +975,7 @@ void UV_OT_from_view(wmOperatorType *ot)
/********************** Reset operator ********************/
-static int reset_exec(bContext *C, wmOperator *op)
+static int reset_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 92bf43e9a5a..1f1bbab9abf 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -114,7 +114,7 @@ void GPU_paint_set_mipmap(int mipmap);
void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h, int mipmap);
void GPU_update_images_framechange(void);
int GPU_update_image_time(struct Image *ima, double time);
-int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap);
+int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap);
void GPU_free_image(struct Image *ima);
void GPU_free_images(void);
void GPU_free_images_anim(void);
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index f2be686d2d4..3c9648c33a5 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1535,7 +1535,7 @@ GPUBuffer *GPU_buffer_setup( DerivedMesh *dm, GPUDrawObject *object, int size, G
return buffer;
}
-void GPU_buffer_copy_vertex( DerivedMesh *dm, float *varray, int *index, int *redir, void *user )
+void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user))
{
int start;
int i, j, numfaces;
@@ -1584,7 +1584,7 @@ GPUBuffer *GPU_buffer_vertex( DerivedMesh *dm )
return GPU_buffer_setup( dm, dm->drawObject, sizeof(float)*3*(dm->drawObject->nelements+dm->drawObject->nlooseverts), GL_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_vertex);
}
-void GPU_buffer_copy_normal( DerivedMesh *dm, float *varray, int *index, int *redir, void *user )
+void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user))
{
int i, numfaces;
int start;
@@ -1648,7 +1648,7 @@ GPUBuffer *GPU_buffer_normal( DerivedMesh *dm )
return GPU_buffer_setup( dm, dm->drawObject, sizeof(float)*3*dm->drawObject->nelements, GL_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_normal);
}
-void GPU_buffer_copy_uv( DerivedMesh *dm, float *varray, int *index, int *redir, void *user )
+void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user))
{
int start;
int i, numfaces;
@@ -1790,7 +1790,7 @@ GPUBuffer *GPU_buffer_color( DerivedMesh *dm )
return result;
}
-void GPU_buffer_copy_edge( DerivedMesh *dm, float *varray, int *index, int *redir, void *user )
+void GPU_buffer_copy_edge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(redir), void *UNUSED(user))
{
int i;
@@ -1818,7 +1818,7 @@ GPUBuffer *GPU_buffer_edge( DerivedMesh *dm )
return GPU_buffer_setup( dm, dm->drawObject, sizeof(int)*2*dm->drawObject->nedges, GL_ELEMENT_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_edge);
}
-void GPU_buffer_copy_uvedge( DerivedMesh *dm, float *varray, int *index, int *redir, void *user )
+void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(redir), void *UNUSED(user))
{
MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE);
int i, j=0;
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index d596f573682..34cf62462a7 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -686,7 +686,7 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
BLI_dynstr_append(ds, ";\n");
}
-static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const char *name)
+static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const char *UNUSED(name))
{
DynStr *ds = BLI_dynstr_new();
char *code;
@@ -916,7 +916,7 @@ GPUNode *GPU_node_begin(char *name)
return node;
}
-void GPU_node_end(GPUNode *node)
+void GPU_node_end(GPUNode *UNUSED(node))
{
/* empty */
}
@@ -1036,7 +1036,7 @@ static void gpu_node_input_socket(GPUNode *node, GPUNodeStack *sock)
}
}
-void GPU_node_output(GPUNode *node, int type, char *name, GPUNodeLink **link)
+void GPU_node_output(GPUNode *node, int type, char *UNUSED(name), GPUNodeLink **link)
{
GPUOutput *output = MEM_callocN(sizeof(GPUOutput), "GPUOutput");
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index e8701793e5d..a93d8cbbb8e 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -394,7 +394,7 @@ static void gpu_verify_reflection(Image *ima)
}
}
-int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap)
+int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap)
{
ImBuf *ibuf = NULL;
unsigned int *bind = NULL;
@@ -593,7 +593,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap)
gpu_verify_alpha_mode(tface);
gpu_verify_reflection(ima);
- if(GPU_verify_image(ima, NULL, tface->tile, tface->mode, 1, mipmap)) {
+ if(GPU_verify_image(ima, NULL, tface->tile, 1, mipmap)) {
GTS.curtile= GTS.tile;
GTS.curima= GTS.ima;
GTS.curtilemode= GTS.tilemode;
@@ -911,10 +911,10 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat,
}
}
else {
- madd_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit);
+ mul_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit);
smat->diff[3]= 1.0; /* caller may set this to bmat->alpha */
- madd_v3_v3fl(smat->spec, &bmat->specr, bmat->spec);
+ mul_v3_v3fl(smat->spec, &bmat->specr, bmat->spec);
smat->spec[3]= 1.0; /* always 1 */
smat->hard= CLAMPIS(bmat->har, 0, 128);
@@ -1043,10 +1043,10 @@ int GPU_enable_material(int nr, void *attribs)
memset(&GMS, 0, sizeof(GMS));
- madd_v3_v3fl(diff, &defmaterial.r, defmaterial.ref + defmaterial.emit);
+ mul_v3_v3fl(diff, &defmaterial.r, defmaterial.ref + defmaterial.emit);
diff[3]= 1.0;
- madd_v3_v3fl(spec, &defmaterial.specr, defmaterial.spec);
+ mul_v3_v3fl(spec, &defmaterial.specr, defmaterial.spec);
spec[3]= 1.0;
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff);
@@ -1286,7 +1286,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
}
/* setup energy */
- madd_v3_v3fl(energy, &la->r, la->energy);
+ mul_v3_v3fl(energy, &la->r, la->energy);
energy[3]= 1.0;
glLightfv(GL_LIGHT0+count, GL_DIFFUSE, energy);
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index fa8ff7a6354..c6b8a43918c 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -484,7 +484,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time,
glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
GPU_update_image_time(ima, time);
- bindcode = GPU_verify_image(ima, iuser, 0, 0, 0, mipmap);
+ bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap);
if(ima->gputexture) {
ima->gputexture->bindcode = bindcode;
@@ -744,7 +744,7 @@ void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex)
tex->fb = NULL;
}
-void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex)
+void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex)
{
/* push attributes */
glPushAttrib(GL_ENABLE_BIT);
@@ -766,7 +766,7 @@ void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex)
glLoadIdentity();
}
-void GPU_framebuffer_texture_unbind(GPUFrameBuffer *fb, GPUTexture *tex)
+void GPU_framebuffer_texture_unbind(GPUFrameBuffer *UNUSED(fb), GPUTexture *UNUSED(tex))
{
/* restore matrix */
glMatrixMode(GL_PROJECTION);
@@ -1063,7 +1063,7 @@ int GPU_shader_get_uniform(GPUShader *shader, char *name)
return glGetUniformLocationARB(shader->object, name);
}
-void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int arraysize, float *value)
+void GPU_shader_uniform_vector(GPUShader *UNUSED(shader), int location, int length, int arraysize, float *value)
{
if(location == -1)
return;
@@ -1080,7 +1080,7 @@ void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int
GPU_print_error("Post Uniform Vector");
}
-void GPU_shader_uniform_texture(GPUShader *shader, int location, GPUTexture *tex)
+void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUTexture *tex)
{
GLenum arbnumber;
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 5f8015be52f..a31ec950711 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -605,7 +605,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
Material *ma= shi->mat;
GPUMaterial *mat= shi->gpumat;
GPUNodeLink *lv, *dist, *visifac, *is, *inp, *i, *vn, *view;
- GPUNodeLink *outcol, *specfac, *t, *shadfac;
+ GPUNodeLink *outcol, *specfac, *t, *shadfac= NULL;
float one = 1.0f;
if((lamp->mode & LA_ONLYSHADOW) && !(ma->mode & MA_SHADOW))
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index 9c0f151aa8b..c0c4cd9bc6c 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -50,7 +50,7 @@
/* allocates PoseTree, and links that to root bone/channel */
/* Note: detecting the IK chain is duplicate code... in drawarmature.c and in transform_conversions.c */
-static void initialize_posetree(struct Object *ob, bPoseChannel *pchan_tip)
+static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_tip)
{
bPoseChannel *curchan, *pchan_root=NULL, *chanlist[256], **oldchan;
PoseTree *tree;
@@ -488,7 +488,7 @@ static void free_posetree(PoseTree *tree)
///----------------------------------------
/// Plugin API for legacy iksolver
-void iksolver_initialize_tree(struct Scene *scene, struct Object *ob, float ctime)
+void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, float UNUSED(ctime))
{
bPoseChannel *pchan;
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index d8c7be06aa1..4a9adaf59fd 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -118,8 +118,7 @@ void IMB_freeImBuf(struct ImBuf *ibuf);
* @attention Defined in allocimbuf.c
*/
struct ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y,
- unsigned char d, unsigned int flags,
- unsigned char bitmap);
+ unsigned char d, unsigned int flags);
/**
*
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index e67c319e61a..53828ed8ea8 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -324,7 +324,7 @@ short imb_addtilesImBuf(ImBuf *ibuf)
return (ibuf->tiles != NULL);
}
-ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flags, uchar bitmap) /* XXX bitmap argument is deprecated */
+ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flags)
{
ImBuf *ibuf;
@@ -384,7 +384,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1)
y = ibuf1->y;
if(ibuf1->flags & IB_fields) y *= 2;
- ibuf2 = IMB_allocImBuf(x, y, ibuf1->depth, flags, 0);
+ ibuf2 = IMB_allocImBuf(x, y, ibuf1->depth, flags);
if(ibuf2 == NULL) return NULL;
if(flags & IB_rect)
diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim.c
index 096ed499f85..8df0d69bcfa 100644
--- a/source/blender/imbuf/intern/anim.c
+++ b/source/blender/imbuf/intern/anim.c
@@ -63,6 +63,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h"
+#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_depsgraph.h"
@@ -163,7 +164,7 @@ static ImBuf * movie_fetchibuf(struct anim * anim, int position) {
if (anim == 0) return (0);
- ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect, 0);
+ ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect);
if ( mvReadFrames(anim->track, position, 1, ibuf->x * ibuf->y *
sizeof(int), ibuf->rect ) != DM_SUCCESS ) {
@@ -214,14 +215,14 @@ int ismovie(char *name) {
#else
-int ismovie(char *name) {
+int ismovie(char *UNUSED(name)) {
return 0;
}
/* never called, just keep the linker happy */
-static int startmovie(struct anim * anim) { return 1; }
-static ImBuf * movie_fetchibuf(struct anim * anim, int position) { return NULL; }
-static void free_anim_movie(struct anim * anim) { ; }
+static int startmovie(struct anim *UNUSED(anim)) { return 1; }
+static ImBuf * movie_fetchibuf(struct anim *UNUSED(anim), int UNUSED(position)) { return NULL; }
+static void free_anim_movie(struct anim *UNUSED(anim)) { ; }
#endif
@@ -483,7 +484,7 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) {
#else
if (1) {
#endif
- ibuf = IMB_allocImBuf (anim->x, anim->y, 24, IB_rect, 0);
+ ibuf = IMB_allocImBuf (anim->x, anim->y, 24, IB_rect);
tmp = AVI_read_frame (anim->avi, AVI_FORMAT_RGB32, position,
AVI_get_stream(anim->avi, AVIST_VIDEO, 0));
@@ -809,7 +810,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
if (anim == 0) return (0);
- ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect, 0);
+ ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect);
avpicture_fill((AVPicture*) anim->pFrameRGB,
(unsigned char*) ibuf->rect,
@@ -998,7 +999,7 @@ static ImBuf * redcode_fetchibuf(struct anim * anim, int position) {
}
ibuf = IMB_allocImBuf(raw_frame->width * 2,
- raw_frame->height * 2, 32, IB_rectfloat, 0);
+ raw_frame->height * 2, 32, IB_rectfloat);
redcode_decode_video_float(raw_frame, ibuf->rect_float, 1);
@@ -1050,31 +1051,31 @@ static struct ImBuf * anim_getnew(struct anim * anim) {
break;
case ANIM_MOVIE:
if (startmovie(anim)) return (0);
- ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); /* fake */
+ ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); /* fake */
break;
case ANIM_AVI:
if (startavi(anim)) {
printf("couldnt start avi\n");
return (0);
}
- ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0);
+ ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0);
break;
#ifdef WITH_QUICKTIME
case ANIM_QTIME:
if (startquicktime(anim)) return (0);
- ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0);
+ ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0);
break;
#endif
#ifdef WITH_FFMPEG
case ANIM_FFMPEG:
if (startffmpeg(anim)) return (0);
- ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0);
+ ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0);
break;
#endif
#ifdef WITH_REDCODE
case ANIM_REDCODE:
if (startredcode(anim)) return (0);
- ibuf = IMB_allocImBuf (8, 8, 32, 0, 0);
+ ibuf = IMB_allocImBuf (8, 8, 32, 0);
break;
#endif
}
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index 450b09c923b..10dc23b1ad2 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -108,6 +108,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
int x, y, depth, skip, i;
unsigned char *bmp, *rect;
unsigned short col;
+
+ (void)size; /* unused */
if (checkbmp(mem) == 0) return(0);
@@ -129,9 +131,9 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
/* printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y,
depth, bmi.biBitCount); */
if (flags & IB_test) {
- ibuf = IMB_allocImBuf(x, y, depth, 0, 0);
+ ibuf = IMB_allocImBuf(x, y, depth, 0);
} else {
- ibuf = IMB_allocImBuf(x, y, depth, IB_rect, 0);
+ ibuf = IMB_allocImBuf(x, y, depth, IB_rect);
bmp = mem + skip;
rect = (unsigned char *) ibuf->rect;
@@ -199,6 +201,8 @@ int imb_savebmp(struct ImBuf *ibuf, char *name, int flags) {
int bytesize, extrabytes, x, y, t, ptr;
uchar *data;
FILE *ofile;
+
+ (void)flags; /* unused */
extrabytes = (4 - ibuf->x*3 % 4) % 4;
bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y;
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index a9b229536cb..7a5a3fb011b 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -88,7 +88,7 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int
return NULL;
}
- ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags, 0);
+ ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags);
row = MEM_mallocN(sizeof(unsigned short)*width*depth, "row in cineon_dpx.c");
frow = ibuf->rect_float+width*height*4;
@@ -125,6 +125,8 @@ static int imb_save_dpx_cineon(ImBuf *buf, char *filename, int use_cineon, int f
int i, j;
int index;
float *fline;
+
+ (void)flags; /* unused */
cineon_conversion_parameters(&conversion);
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index 9c9156a4dd9..a2a0fae526d 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -185,6 +185,8 @@ dumpCineonImageInfo(CineonImageInformation* imageInfo) {
static void
fillCineonFormatInfo(CineonFile* cineon, CineonFormatInformation* formatInfo) {
+ (void)cineon; /* unused */
+
formatInfo->interleave = 0;
formatInfo->packing = 5;
formatInfo->signage = 0;
@@ -238,6 +240,8 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) {
static void
fillCineonOriginationInfo(CineonFile* cineon,
CineonOriginationInformation* originInfo, CineonFileInformation* fileInfo) {
+
+ (void)cineon; /* unused */
originInfo->x_offset = htonl(0);
originInfo->y_offset = htonl(0);
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index 365d56939ed..ade69b4d7c0 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -39,6 +39,8 @@
static void
fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) {
+ (void)dpx; /* unused */
+
chan->signage = 0;
chan->ref_low_data = htonl(0);
chan->ref_low_quantity = htonf(0.0);
@@ -160,7 +162,12 @@ dumpDpxImageInfo(DpxImageInformation* imageInfo) {
static void
fillDpxOriginationInfo(
- DpxFile* dpx, DpxOriginationInformation* originInfo, DpxFileInformation* fileInfo) {
+ DpxFile* dpx, DpxOriginationInformation* originInfo, DpxFileInformation* fileInfo)
+{
+ /* unused */
+ (void)dpx;
+ (void)originInfo;
+ (void)fileInfo;
}
static void
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index 2e224893271..08f60589977 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -104,7 +104,7 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags)
// TODO use the image RGB or RGBA tag to determine the bits per pixel
if (dds.hasAlpha()) bits_per_pixel = 32;
else bits_per_pixel = 24;
- ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0, 0);
+ ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0);
if (ibuf == 0) return(0); /* memory allocation failed */
ibuf->ftype = DDS;
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index 7b3a07f10ad..dfe316628f6 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -50,8 +50,8 @@ void IMB_de_interlace(struct ImBuf *ibuf)
if (ibuf->rect) {
/* make copies */
- tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
- tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
+ tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect);
+ tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect);
ibuf->x *= 2;
IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
@@ -78,8 +78,8 @@ void IMB_interlace(struct ImBuf *ibuf)
if (ibuf->rect) {
/* make copies */
- tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
- tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
+ tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect);
+ tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect);
IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
IMB_rectcpy(tbuf2, ibuf, 0, 0, 0, tbuf2->y, ibuf->x, ibuf->y);
diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c
index fb5d2f2e4d7..0702fbe3907 100644
--- a/source/blender/imbuf/intern/filetype.c
+++ b/source/blender/imbuf/intern/filetype.c
@@ -45,7 +45,7 @@ static int imb_ftype_default(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftyp
#if defined(__APPLE__) && defined(IMBUF_COCOA)
static int imb_ftype_cocoa(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype & TIF); }
#endif
-static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype == IMAGIC); }
+static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf) { (void)type; return (ibuf->ftype == IMAGIC); }
#ifdef WITH_QUICKTIME
static int imb_ftype_quicktime(ImFileType *type, ImBuf *ibuf) { return 0; } // XXX
#endif
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 3cc266e460e..3c2c276b6e4 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -380,7 +380,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
while(curmap < IB_MIPMAP_LEVELS) {
if(use_filter) {
- ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect, 0);
+ ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect);
IMB_filterN(nbuf, hbuf);
ibuf->mipmap[curmap] = IMB_onehalf(nbuf);
IMB_freeImBuf(nbuf);
diff --git a/source/blender/imbuf/intern/imbuf_cocoa.m b/source/blender/imbuf/intern/imbuf_cocoa.m
index 02c90c5bd09..9b627612d2a 100644
--- a/source/blender/imbuf/intern/imbuf_cocoa.m
+++ b/source/blender/imbuf/intern/imbuf_cocoa.m
@@ -93,7 +93,7 @@ struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, int size, int flags)
[bitmapImage setSize:bitmapSize];
/* allocate the image buffer */
- ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0, 0);
+ ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0);
if (!ibuf) {
fprintf(stderr,
"imb_cocoaLoadImage: could not allocate memory for the " \
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index 883de823745..71ba9b06cad 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -123,7 +123,8 @@ static int file_offset;
static unsigned short getshort(FILE *inf)
{
unsigned char * buf;
-
+ (void)inf; /* unused */
+
buf = file_data + file_offset;
file_offset += 2;
@@ -133,6 +134,7 @@ static unsigned short getshort(FILE *inf)
static unsigned int getlong(FILE *inf)
{
unsigned char * buf;
+ (void)inf; /* unused */
buf = file_data + file_offset;
file_offset += 4;
@@ -258,6 +260,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
int bpp, rle, cur, badorder;
ImBuf * ibuf;
+ (void)size; /* unused */
+
if(!imb_is_a_iris(mem)) return NULL;
/*printf("new iris\n");*/
@@ -283,7 +287,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
zsize = image.zsize;
if (flags & IB_test) {
- ibuf = IMB_allocImBuf(image.xsize, image.ysize, 8 * image.zsize, 0, 0);
+ ibuf = IMB_allocImBuf(image.xsize, image.ysize, 8 * image.zsize, 0);
if (ibuf) ibuf->ftype = IMAGIC;
return(ibuf);
}
@@ -315,7 +319,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
if (bpp == 1) {
- ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
+ ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect);
if (ibuf->depth > 32) ibuf->depth = 32;
base = ibuf->rect;
zbase = (unsigned int *)ibuf->zbuf;
@@ -356,7 +360,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
} else { /* bpp == 2 */
- ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0);
+ ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat);
fbase = ibuf->rect_float;
@@ -399,7 +403,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
} else {
if (bpp == 1) {
- ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0);
+ ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect);
if (ibuf->depth > 32) ibuf->depth = 32;
base = ibuf->rect;
@@ -424,7 +428,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
} else { /* bpp == 2 */
- ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0);
+ ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat);
fbase = ibuf->rect_float;
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index a70c154014a..0403d0044f5 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -189,7 +189,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
float_divs[i]= (1<<image->comps[i].prec)-1;
}
- ibuf= IMB_allocImBuf(w, h, depth, use_float ? IB_rectfloat : IB_rect, 0);
+ ibuf= IMB_allocImBuf(w, h, depth, use_float ? IB_rectfloat : IB_rect);
if (ibuf==NULL) {
if(dinfo)
@@ -670,6 +670,8 @@ int imb_savejp2(struct ImBuf *ibuf, char *name, int flags) {
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *image = NULL;
+ (void)flags; /* unused */
+
/*
configure the event callbacks (not required)
setting of each callback is optionnal
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 0a070646fd5..e7737e68fce 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -132,6 +132,7 @@ typedef my_source_mgr * my_src_ptr;
static void init_source(j_decompress_ptr cinfo)
{
+ (void)cinfo; /* unused */
}
@@ -165,6 +166,7 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes)
static void term_source(j_decompress_ptr cinfo)
{
+ (void)cinfo; /* unused */
}
static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t size)
@@ -297,9 +299,9 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
if (flags & IB_test) {
jpeg_abort_decompress(cinfo);
- ibuf = IMB_allocImBuf(x, y, 8 * depth, 0, 0);
+ ibuf = IMB_allocImBuf(x, y, 8 * depth, 0);
}
- else if ((ibuf = IMB_allocImBuf(x, y, 8 * depth, IB_rect, 0)) == NULL) {
+ else if ((ibuf = IMB_allocImBuf(x, y, 8 * depth, IB_rect)) == NULL) {
jpeg_abort_decompress(cinfo);
}
else {
@@ -699,7 +701,7 @@ static int save_jstjpeg(char * name, struct ImBuf * ibuf)
struct ImBuf * tbuf;
int oldy, returnval;
- tbuf = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 24, IB_rect, 0);
+ tbuf = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 24, IB_rect);
tbuf->ftype = ibuf->ftype;
tbuf->flags = ibuf->flags;
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 4107f051d73..5b8c5c72802 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -975,7 +975,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
}
else {
- ibuf = IMB_allocImBuf(width, height, 32, 0, 0);
+ ibuf = IMB_allocImBuf(width, height, 32, 0);
ibuf->ftype = OPENEXR;
/* openEXR is linear as per EXR spec */
diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h
index c66abe76289..e96b52e121d 100644
--- a/source/blender/imbuf/intern/openexr/openexr_multi.h
+++ b/source/blender/imbuf/intern/openexr/openexr_multi.h
@@ -67,24 +67,27 @@ void IMB_exr_close (void *handle);
/* ugly... but we only use it on pipeline.c, render module, now */
void * IMB_exr_get_handle (void) {return NULL;}
-void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) {}
+void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
-int IMB_exr_begin_read (void *handle, char *filename, int *width, int *height) {return 0;}
-void IMB_exr_begin_write (void *handle, char *filename, int width, int height, int compress) {}
-void IMB_exrtile_begin_write (void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley) {}
+int IMB_exr_begin_read (void *handle, char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;}
+void IMB_exr_begin_write (void *handle, char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; }
+void IMB_exrtile_begin_write (void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; }
-void IMB_exr_set_channel (void *handle, char *layname, char *channame, int xstride, int ystride, float *rect) {}
+void IMB_exr_set_channel (void *handle, char *layname, char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
-void IMB_exr_read_channels (void *handle) {}
-void IMB_exr_write_channels (void *handle) {}
-void IMB_exrtile_write_channels (void *handle, int partx, int party, int level) {}
-void IMB_exrtile_clear_channels (void *handle) {}
+void IMB_exr_read_channels (void *handle) { (void)handle; }
+void IMB_exr_write_channels (void *handle) { (void)handle; }
+void IMB_exrtile_write_channels (void *handle, int partx, int party, int level) { (void)handle; (void)partx; (void)party; (void)level; }
+void IMB_exrtile_clear_channels (void *handle) { (void)handle; }
void IMB_exr_multilayer_convert (void *handle, void *base,
void * (*addlayer)(void *base, char *str),
- void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id)) {}
+ void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id))
+ {
+ (void)handle; (void)base; (void)addlayer; (void)addpass;
+ }
-void IMB_exr_close (void *handle) {}
+void IMB_exr_close (void *handle) { (void)handle; }
#endif
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 6b21f20b3fb..b29a4ae0627 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -61,7 +61,8 @@ int imb_is_a_png(unsigned char *mem)
}
static void Flush(png_structp png_ptr)
-{
+{
+ (void)png_ptr;
}
static void WriteData( png_structp png_ptr, png_bytep data, png_size_t length)
@@ -368,7 +369,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags)
longjmp(png_jmpbuf(png_ptr), 1);
}
- ibuf = IMB_allocImBuf(width, height, 8 * bytesperpixel, 0, 0);
+ ibuf = IMB_allocImBuf(width, height, 8 * bytesperpixel, 0);
if (ibuf) {
ibuf->ftype = PNG;
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c
index 4064246c866..b356f56ab74 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -202,8 +202,8 @@ struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags)
ptr = (unsigned char *)strchr((char*)&mem[x+1], '\n');
ptr++;
- if (flags & IB_test) ibuf = IMB_allocImBuf(width, height, 32, 0, 0);
- else ibuf = IMB_allocImBuf(width, height, 32, (flags & IB_rect)|IB_rectfloat, 0);
+ if (flags & IB_test) ibuf = IMB_allocImBuf(width, height, 32, 0);
+ else ibuf = IMB_allocImBuf(width, height, 32, (flags & IB_rect)|IB_rectfloat);
if (ibuf==NULL) return NULL;
ibuf->ftype = RADHDR;
@@ -340,6 +340,8 @@ int imb_savehdr(struct ImBuf *ibuf, char *name, int flags)
int y, width=ibuf->x, height=ibuf->y;
unsigned char *cp= NULL;
+ (void)flags; /* unused */
+
if (file==NULL) return 0;
writeHeader(file, width, height);
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 4fccf5dae41..73dcc0c8ea9 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -62,7 +62,7 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1)
if (ibuf1->x <= 1) return(IMB_dupImBuf(ibuf1));
- ibuf2 = IMB_allocImBuf((ibuf1->x)/2, ibuf1->y, ibuf1->depth, ibuf1->flags, 0);
+ ibuf2 = IMB_allocImBuf((ibuf1->x)/2, ibuf1->y, ibuf1->depth, ibuf1->flags);
if (ibuf2==NULL) return (0);
_p1 = (uchar *) ibuf1->rect;
@@ -123,7 +123,7 @@ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1)
do_rect= (ibuf1->rect != NULL);
do_float= (ibuf1->rect_float != NULL);
- ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->depth, ibuf1->flags, 0);
+ ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->depth, ibuf1->flags);
if (ibuf2==NULL) return (0);
p1 = (int *) ibuf1->rect;
@@ -181,7 +181,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
do_rect= (ibuf1->rect != NULL);
do_float= (ibuf1->rect_float != NULL);
- ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->depth, ibuf1->flags, 0);
+ ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->depth, ibuf1->flags);
if (ibuf2==NULL) return (0);
_p1 = (uchar *) ibuf1->rect;
@@ -249,7 +249,7 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1)
do_rect= (ibuf1->rect != NULL);
do_float= (ibuf1->rect_float != NULL);
- ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->depth, ibuf1->flags, 0);
+ ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->depth, ibuf1->flags);
if (ibuf2==NULL) return (0);
p1 = (int *) ibuf1->rect;
@@ -303,7 +303,7 @@ struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1)
if (ibuf1->x <= 1) return(IMB_half_y(ibuf1));
if (ibuf1->y <= 1) return(IMB_half_x(ibuf1));
- ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags, 0);
+ ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags);
if (ibuf2==NULL) return (0);
p1f = ibuf1->rect_float;
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index ada1f448bfc..89a69242a46 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -238,6 +238,8 @@ int imb_savetarga(struct ImBuf * ibuf, char *name, int flags)
char buf[20];
FILE *fildes;
short ok = 0;
+
+ (void)flags; /* unused */
if (ibuf == 0) return (0);
if (ibuf->rect == 0) return (0);
@@ -537,8 +539,8 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
if (checktarga(&tga,mem) == 0) return(0);
- if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,tga.pixsize, 0, 0);
- else ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,(tga.pixsize + 0x7) & ~0x7, IB_rect, 0);
+ if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,tga.pixsize, 0);
+ else ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,(tga.pixsize + 0x7) & ~0x7, IB_rect);
if (ibuf == 0) return(0);
ibuf->ftype = TGA;
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index f3415d44ecb..8abc2e89952 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -280,7 +280,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
return NULL;
}
if (size == THB_FAIL) {
- img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata, 0);
+ img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata);
if (!img) return 0;
} else {
if (THB_SOURCE_IMAGE == source || THB_SOURCE_BLEND == source) {
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index 2fef230f1c2..cd9bf9c7a3a 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -102,7 +102,7 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
return NULL;
/* finally malloc and read the data */
- img= IMB_allocImBuf(size[0], size[1], 32, IB_rect | IB_metadata, 0);
+ img= IMB_allocImBuf(size[0], size[1], 32, IB_rect | IB_metadata);
if(gzread(gzfile, img->rect, bhead[1]) != bhead[1]) {
IMB_freeImBuf(img);
@@ -161,11 +161,11 @@ void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float as
{
int x, y;
- int hline, vline;
int stride_x= (margin_r - margin_l) - 2;
for(y=0; y < height; y++) {
for(x=0; x < width; x++, px+=4) {
+ int hline= 0, vline= 0;
if((x > margin_l && x < margin_r) && (y > margin_b && y < margin_t)) {
/* interior. skip */
x += stride_x;
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 5b77c6c7c36..eb5d1f2c039 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -93,11 +93,18 @@ typedef struct ImbTIFFMemFile {
static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)
{
+ (void)fd;
+ (void)base;
+ (void)size;
}
static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
{
- return (0);
+ (void)fd;
+ (void)pbase;
+ (void)psize;
+
+ return (0);
}
/**
@@ -154,6 +161,10 @@ static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n)
*/
static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n)
{
+ (void)handle;
+ (void)data;
+ (void)n;
+
printf("imb_tiff_WriteProc: this function should not be called.\n");
return (-1);
}
@@ -368,7 +379,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
ib_flag = IB_rect;
}
- tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag, 0);
+ tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag);
/* simple RGBA image */
if (!(bitspersample == 32 || bitspersample == 16)) {
@@ -497,7 +508,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
ib_depth = (spp==3)?24:32;
- ibuf = IMB_allocImBuf(width, height, ib_depth, 0, 0);
+ ibuf = IMB_allocImBuf(width, height, ib_depth, 0);
if(ibuf) {
ibuf->ftype = TIF;
}
@@ -533,7 +544,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
width= (width > 1)? width/2: 1;
height= (height > 1)? height/2: 1;
- hbuf= IMB_allocImBuf(width, height, 32, 0, 0);
+ hbuf= IMB_allocImBuf(width, height, 32, 0);
hbuf->miplevel= level;
hbuf->ftype= ibuf->ftype;
ibuf->mipmap[level-1] = hbuf;
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index 407efc53cdc..a0b1e30c7f8 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -30,6 +30,10 @@
#ifndef DNA_CUSTOMDATA_TYPES_H
#define DNA_CUSTOMDATA_TYPES_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* descriptor and storage for a custom data layer */
typedef struct CustomDataLayer {
int type; /* type of data in layer */
@@ -155,4 +159,8 @@ typedef struct CustomDataMultires {
#define MAX_MTFACE 8
#define MAX_MCOL 8
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 3d23ed15b85..4bfa617b306 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1039,6 +1039,7 @@ typedef struct Scene {
#define TESTBASELIB_BGMODE(v3d, scene, base) ( ((base)->flag & SELECT) && ((base)->lay & (v3d ? v3d->lay : scene->lay)) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
#define BASE_EDITABLE_BGMODE(v3d, scene, base) (((base)->lay & (v3d ? v3d->lay : scene->lay)) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
#define BASE_SELECTABLE(v3d, base) ((base->lay & v3d->lay) && (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0)
+#define BASE_VISIBLE(v3d, base) ((base->lay & v3d->lay) && (base->object->restrictflag & OB_RESTRICT_VIEW)==0)
#define FIRSTBASE scene->base.first
#define LASTBASE scene->base.last
#define BASACT (scene->basact)
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index ce038ee4a95..0e2eea0b942 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -318,6 +318,8 @@ typedef struct SpaceText {
char findstr[256]; /* ST_MAX_FIND_STR */
char replacestr[256]; /* ST_MAX_FIND_STR */
+
+ void *drawcache; /* cache for faster drawing */
} SpaceText;
typedef struct Script {
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index e9e058cbbd6..19aacaa8108 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -34,6 +34,10 @@
#include "DNA_ID.h"
#include "DNA_image_types.h" /* ImageUser */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct AnimData;
struct Ipo;
struct PluginTex;
@@ -554,5 +558,9 @@ typedef struct TexMapping {
#define TEX_VD_SMOKEHEAT 1
#define TEX_VD_SMOKEVEL 2
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 52e82eb743d..4e3a957d775 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -35,6 +35,10 @@
#include "DNA_listBase.h"
#include "DNA_texture_types.h" /* ColorBand */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* themes; defines in BIF_resource.h */
struct ColorBand;
@@ -558,4 +562,8 @@ extern UserDef U; /* from blenkernel blender.c */
#define TH_OLDSKOOL 3
#define TH_SHADED 4
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index ecad022fb8f..f8f12506539 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -836,7 +836,11 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in
int RNA_string_length(PointerRNA *ptr, const char *name);
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value);
+/**
+ * Retrieve the named property from PointerRNA.
+ */
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name);
+/* Set the property name of PointerRNA ptr to ptr_value */
void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value);
void RNA_pointer_add(PointerRNA *ptr, const char *name);
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 4f9032ffc95..a48603e623c 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -24,6 +24,9 @@
#
# ***** END GPL LICENSE BLOCK *****
+# this warning on generated files gets annoying
+STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+
FILE(GLOB DEFSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
FILE(GLOB APISRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_api.c")
LIST(REMOVE_ITEM DEFSRC rna_access.c rna_define.c makesrna.c)
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index cee6b7f854a..9f5308cce33 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -206,7 +206,7 @@ static StructRNA *rna_KeyingSetInfo_register(const bContext *C, ReportList *repo
ksi->generate= (have_function[2])? RKS_GEN_rna_internal: NULL;
/* add and register with other info as needed */
- ANIM_keyingset_info_register(C, ksi);
+ ANIM_keyingset_info_register(ksi);
/* return the struct-rna added */
return ksi->ext.srna;
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 509fecb0122..cd588b598bd 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -253,7 +253,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *scene, PointerRNA *ptr)
for(node=ntree->nodes.first; node; node=node->next) {
if (ELEM3(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
- ED_node_generic_update(bmain, scene, ntree, node);
+ ED_node_generic_update(bmain, ntree, node);
}
}
}
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index e4726f5e92c..dee12d43144 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1242,10 +1242,16 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- /* XXX not sure how to wrap the two 6 element arrays for the generic joint */
- //float minLimit[6];
- //float maxLimit[6];
-
+ prop= RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "minLimit");
+ RNA_def_property_array(prop, 6);
+ RNA_def_property_ui_text(prop, "Minimum Limit", "");
+
+ prop= RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "maxLimit");
+ RNA_def_property_array(prop, 6);
+ RNA_def_property_ui_text(prop, "Maximum Limit", "");
+
prop= RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE_LINKED_COLLISION);
RNA_def_property_ui_text(prop, "Disable Linked Collision", "Disable collision between linked bodies");
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 50c21640554..7983b8f8a7f 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -1373,7 +1373,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC);
RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_u");
+ RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v");
/* Note, endpoint and bezier flags should never be on at the same time! */
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 1fed1663952..0a8e0bad7f0 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -474,11 +474,12 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
PropertyRNA *prop, *nextprop;
PropertyRNA *parm, *nextparm;
+ /*
if(srna->flag & STRUCT_RUNTIME) {
if(RNA_struct_py_type_get(srna)) {
fprintf(stderr, "RNA_struct_free '%s' freed while holding a python reference\n", srna->identifier);
}
- }
+ } */
for(prop=srna->cont.properties.first; prop; prop=nextprop) {
nextprop= prop->next;
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 63405e08f69..23f37f8db8e 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -53,7 +53,7 @@ EnumPropertyItem fmodifier_type_items[] = {
{FMODIFIER_TYPE_CYCLES, "CYCLES", 0, "Cycles", ""},
{FMODIFIER_TYPE_NOISE, "NOISE", 0, "Noise", ""},
{FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""},
- {FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""},
+ //{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""}, // FIXME: not implemented yet!
{FMODIFIER_TYPE_LIMITS, "LIMITS", 0, "Limits", ""},
{FMODIFIER_TYPE_STEPPED, "STEPPED", 0, "Stepped Interpolation", ""},
{0, NULL, 0, NULL, NULL}};
@@ -542,14 +542,14 @@ static BezTriple *rna_FKeyframe_points_add(FCurve *fcu, float frame, float value
index= insert_vert_fcurve(fcu, frame, value, flag);
- return index >= 0 ? fcu->bezt + index : NULL;
+ return ((fcu->bezt) && (index >= 0))? (fcu->bezt + index) : NULL;
}
static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTriple *bezt, int do_fast)
{
int index= (int)(bezt - fcu->bezt);
if (index < 0 || index >= fcu->totvert) {
- BKE_report(reports, RPT_ERROR, "bezier not in fcurve.");
+ BKE_report(reports, RPT_ERROR, "Keyframe not in F-Curve.");
return;
}
@@ -1320,7 +1320,7 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "", "Y Value of this keyframe point", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(parm, PROP_REQUIRED);
/* optional */
- parm= RNA_def_boolean(func, "replace", 0, "Replace", "Replace existing keyframes");
+ parm= RNA_def_boolean(func, "replace", 0, "Replace", "Don't add any new keyframes, but just replace existing ones");
parm= RNA_def_boolean(func, "needed", 0, "Needed", "Only adds keyframes that are needed");
parm= RNA_def_boolean(func, "fast", 0, "Fast", "Fast keyframe insertion to avoid recalculating the curve each time");
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 70438ae3d8c..74d61101273 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -41,7 +41,7 @@
#include "BKE_packedFile.h"
#include "BKE_main.h"
#include "BKE_utildefines.h"
-#include "BKE_global.h" /* grr: G.sce */
+#include "BKE_global.h" /* grr: G.main->name */
#include "IMB_imbuf.h"
@@ -90,7 +90,7 @@ static void rna_Image_save(Image *image, ReportList *reports)
if(ibuf) {
char filename[FILE_MAXDIR + FILE_MAXFILE];
BLI_strncpy(filename, image->name, sizeof(filename));
- BLI_path_abs(filename, G.sce);
+ BLI_path_abs(filename, G.main->name);
if(image->packedfile) {
if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) {
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 99758b8f0fe..e626abd85c7 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -36,19 +36,6 @@
#include "BKE_global.h"
/* all the list begin functions are added manually here, Main is not in SDNA */
-static int rna_Main_debug_get(PointerRNA *ptr)
-{
- return G.f & G_DEBUG;
-}
-
-
-static void rna_Main_debug_set(PointerRNA *ptr, const int value)
-{
- if (value)
- G.f |= G_DEBUG;
- else
- G.f &= ~G_DEBUG;
-}
static int rna_Main_is_dirty_get(PointerRNA *ptr)
{
@@ -317,11 +304,6 @@ void RNA_def_main(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL);
RNA_def_property_ui_text(prop, "File is Saved", "Has the current session been saved to disk as a .blend file");
- prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Main_debug_get", "rna_Main_debug_set");
- RNA_def_property_ui_text(prop, "Debug", "Print debugging information in console");
-
-
for(i=0; lists[i].name; i++)
{
prop= RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index b244d8ee5d3..76930e3cc52 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -176,7 +176,7 @@ Object *rna_Main_objects_new(Main *bmain, ReportList *reports, char* name, ID *d
void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object)
{
if(ID_REAL_USERS(object) <= 0) {
- unlink_object(NULL, object); /* needed or ID pointers to this are not cleared */
+ unlink_object(object); /* needed or ID pointers to this are not cleared */
free_libblock(&bmain->object, object);
}
else {
@@ -261,7 +261,7 @@ Image *rna_Main_images_load(Main *bmain, ReportList *reports, char *filepath)
Image *ima;
errno= 0;
- ima= BKE_add_image_file(filepath, 0);
+ ima= BKE_add_image_file(filepath);
if(!ima)
BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported image format");
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index d13e4a7d3a4..87936594bf9 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1143,7 +1143,7 @@ static char *rna_VertexGroupElement_path(PointerRNA *ptr)
for(a=0, dvert=me->dvert; a<me->totvert; a++, dvert++)
for(b=0; b<dvert->totweight; b++)
if(dw == &dvert->dw[b])
- return BLI_sprintfN("verts[%d].groups[%d]", a, b);
+ return BLI_sprintfN("vertices[%d].groups[%d]", a, b);
return NULL;
}
@@ -1160,7 +1160,7 @@ static char *rna_MeshEdge_path(PointerRNA *ptr)
static char *rna_MeshVertex_path(PointerRNA *ptr)
{
- return BLI_sprintfN("verts[%d]", (MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert);
+ return BLI_sprintfN("vertices[%d]", (MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert);
}
static char *rna_MeshTextureFaceLayer_path(PointerRNA *ptr)
@@ -1277,7 +1277,7 @@ static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext
CustomDataLayer *cdl= NULL;
int index;
- if(ED_mesh_uv_texture_add(C, NULL, NULL, me, name, FALSE)) {
+ if(ED_mesh_uv_texture_add(C, me, name, FALSE)) {
fdata= rna_mesh_fdata(me);
index= CustomData_get_named_layer_index(fdata, CD_MTFACE, name);
cdl= (index == -1)? NULL: &fdata->layers[index];
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index a97033200de..52a19c6376f 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -159,7 +159,7 @@ static void rna_Image_end_frame_set(PointerRNA *ptr, int value)
static void node_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node)
{
- ED_node_generic_update(bmain, scene, ntree, node);
+ ED_node_generic_update(bmain, ntree, node);
}
static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -180,7 +180,7 @@ static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr)
node_update(bmain, scene, ntree, node);
}
-static void rna_Node_update_name(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Node_name_set(PointerRNA *ptr, const char *value)
{
bNodeTree *ntree= (bNodeTree*)ptr->id.data;
bNode *node= (bNode*)ptr->data;
@@ -188,14 +188,14 @@ static void rna_Node_update_name(Main *bmain, Scene *scene, PointerRNA *ptr)
/* make a copy of the old name first */
BLI_strncpy(oldname, node->name, sizeof(node->name));
+ /* set new name */
+ BLI_strncpy(node->name, value, sizeof(node->name));
nodeUniqueName(ntree, node);
node->flag |= NODE_CUSTOM_NAME;
/* fix all the animation data which may link to this */
BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name);
-
- node_update(bmain, scene, ntree, node);
}
/* this should be done at display time! if no custom names are set */
@@ -2263,7 +2263,8 @@ static void rna_def_node(BlenderRNA *brna)
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "Node name");
RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update_name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 3f07d953e0b..c29ad0d9adf 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -769,6 +769,12 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
strcpy(str, "");
}
+static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ rna_Object_internal_update(bmain, scene, ptr);
+ WM_main_add_notifier(NC_OBJECT|ND_OB_SHADING, ptr->id.data);
+}
+
/* why does this have to be so complicated?, can't all this crap be
* moved to in BGE conversion function? - Campbell *
*
@@ -1143,13 +1149,13 @@ static void rna_def_material_slot(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, link_items);
RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
@@ -1739,14 +1745,14 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", "rna_Object_active_material_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "actcol");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", "rna_Object_active_material_index_range");
RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
/* transform */
prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
@@ -2146,7 +2152,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
/* shape keys */
- prop= RNA_def_property(srna, "show_shape_key", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object");
RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 1151215f5f7..7a8165e9aa5 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -325,15 +325,21 @@ static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
{
ParticleSystem *psys= (ParticleSystem*)ptr->data;
+ int old_type = 0;
- if(psys->part)
+
+ if(psys->part) {
+ old_type = psys->part->type;
psys->part->id.us--;
+ }
psys->part = (ParticleSettings *)value.data;
if(psys->part) {
psys->part->id.us++;
psys_check_boid_data(psys);
+ if(old_type != psys->part->type)
+ psys->recalc |= PSYS_RECALC_TYPE;
}
}
static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index b21653d95b1..4ee82903cea 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2886,6 +2886,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER);
RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer");
+ RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
/* engine */
@@ -3142,7 +3143,7 @@ void RNA_def_scene(BlenderRNA *brna)
prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "World", "World used for rendering the scene");
- RNA_def_property_update(prop, NC_SCENE|NC_WORLD, NULL);
+ RNA_def_property_update(prop, NC_SCENE|ND_WORLD, NULL);
prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "cursor");
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 93b38499673..d6964f5d569 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -44,10 +44,10 @@ EnumPropertyItem region_type_items[] = {
{RGN_TYPE_PREVIEW, "PREVIEW", 0, "Preview", ""},
{0, NULL, 0, NULL, NULL}};
-#ifdef RNA_RUNTIME
-
#include "ED_screen.h"
+#ifdef RNA_RUNTIME
+
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index b6a09b9c217..923f4560532 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -150,7 +150,7 @@ static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value)
seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs);
- reload_sequence_new_file(G.main, scene, seq, FALSE);
+ reload_sequence_new_file(scene, seq, FALSE);
rna_Sequence_frame_change_update(scene, seq);
}
@@ -161,7 +161,7 @@ static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value)
seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs);
- reload_sequence_new_file(G.main, scene, seq, FALSE);
+ reload_sequence_new_file(scene, seq, FALSE);
rna_Sequence_frame_change_update(scene, seq);
}
@@ -552,7 +552,7 @@ static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Sequence *seq= (Sequence*)(ptr->data);
- reload_sequence_new_file(G.main, scene, seq, TRUE);
+ reload_sequence_new_file(scene, seq, TRUE);
calc_sequence(scene, seq);
rna_Sequence_update(bmain, scene, ptr);
}
@@ -677,13 +677,13 @@ static void rna_def_strip_crop(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
- prop= RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED);
+ prop= RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "bottom");
RNA_def_property_ui_text(prop, "Bottom", "");
RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
- prop= RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED);
+ prop= RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "left");
RNA_def_property_ui_text(prop, "Left", "");
RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 1d86faa5e53..a230a51e792 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -287,7 +287,6 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
func= RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property.");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data.");
@@ -297,7 +296,6 @@ void RNA_api_ui_layout(StructRNA *srna)
parm= RNA_def_string(func, "text", "", 0, "", "Custom label to display in UI.");
func= RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property.");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data.");
@@ -343,17 +341,14 @@ void RNA_api_ui_layout(StructRNA *srna)
func= RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data.");
api_ui_item_rna_common(func);
- RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail.");
func= RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data.");
api_ui_item_rna_common(func);
- RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail.");
func= RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data.");
api_ui_item_rna_common(func);
- RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail.");
func= RNA_def_function(srna, "template_layers", "uiTemplateLayers");
api_ui_item_rna_common(func);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 18620617c87..4196b3585b3 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -221,8 +221,7 @@ static void rna_userdef_addon_remove(bAddon *bext)
static void rna_userdef_temp_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
extern char btempdir[];
- UserDef *userdef = (UserDef*)ptr->data;
- strncpy(btempdir, userdef->tempdir, FILE_MAXDIR+FILE_MAXFILE);
+ BLI_where_is_temp(btempdir, 1);
}
#else
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 62d0c99f6c5..7e54a3b14fa 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -175,7 +175,7 @@ EnumPropertyItem event_type_items[] = {
{RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", ""},
{RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", ""},
{0, "", 0, NULL, NULL},
- {COMMANDKEY, "COMMAND", 0, "Command", ""},
+ {OSKEY, "OSKEY", 0, "OS Key", ""},
{0, "", 0, NULL, NULL},
{ESCKEY, "ESC", 0, "Esc", ""},
{TABKEY, "TAB", 0, "Tab", ""},
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index ecf253acbce..726d64f26f4 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -478,9 +478,8 @@ void RNA_def_world(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon");
/* RNA_def_property_update(prop, 0, "rna_World_update"); */
- /* render-only uses this, the notifier could be made to be more spesific */
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_World_update");
-
+ /* render-only uses this */
+ RNA_def_property_update(prop, NC_WORLD|ND_WORLD_DRAW, "rna_World_update");
prop= RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR);
diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h
index a792b163eea..6063acf47f4 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -69,6 +69,6 @@ extern ModifierTypeInfo modifierType_Solidify;
extern ModifierTypeInfo modifierType_Screw;
/* MOD_util.c */
-void modifier_type_init(ModifierTypeInfo *types[], ModifierType type);
+void modifier_type_init(ModifierTypeInfo *types[]);
#endif //MOD_MODIFIERTYPES_H
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index 6d2a3e7098f..2f802ee67c8 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -35,6 +35,7 @@
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_lattice.h"
#include "BKE_modifier.h"
@@ -63,7 +64,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strncpy(tamd->defgrp_name, amd->defgrp_name, 32);
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
{
CustomDataMask dataMask = 0;
@@ -73,7 +74,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
return dataMask;
}
-static int isDisabled(ModifierData *md, int useRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
ArmatureModifierData *amd = (ArmatureModifierData*) md;
@@ -90,9 +91,10 @@ static void foreachObjectLink(
walk(userData, ob, &amd->object);
}
-static void updateDepgraph(
- ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob,
- DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
ArmatureModifierData *amd = (ArmatureModifierData*) md;
@@ -104,9 +106,12 @@ static void updateDepgraph(
}
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
ArmatureModifierData *amd = (ArmatureModifierData*) md;
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 8331c3474b2..839bfef6226 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -101,8 +101,8 @@ static void foreachObjectLink(
walk(userData, ob, &amd->offset_ob);
}
-static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene,
- Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode)
{
ArrayModifierData *amd = (ArrayModifierData*) md;
@@ -731,7 +731,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
static DerivedMesh *applyModifier(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+ int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
{
DerivedMesh *result;
ArrayModifierData *amd = (ArrayModifierData*) md;
@@ -745,7 +745,7 @@ static DerivedMesh *applyModifier(
}
static DerivedMesh *applyModifierEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
+ ModifierData *md, Object *ob, struct EditMesh *UNUSED(editData),
DerivedMesh *derivedData)
{
return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 68274fbfd78..937c8cd7eac 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -66,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32);
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
BevelModifierData *bmd = (BevelModifierData *)md;
CustomDataMask dataMask = 0;
@@ -77,9 +77,10 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
return dataMask;
}
-static DerivedMesh *applyModifier(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *result;
BME_Mesh *bm;
@@ -107,9 +108,9 @@ static DerivedMesh *applyModifier(
return result;
}
-static DerivedMesh *applyModifierEM(
- ModifierData *md, Object *ob, EditMesh *editData,
- DerivedMesh *derivedData)
+static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
+ EditMesh *UNUSED(editData),
+ DerivedMesh *derivedData)
{
return applyModifier(md, ob, derivedData, 0, 1);
}
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 496523a310b..dfcfd55f3d9 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -32,6 +32,7 @@
#include "DNA_object_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
@@ -49,7 +50,7 @@ static void copyData(ModifierData *md, ModifierData *target)
tbmd->operation = bmd->operation;
}
-static int isDisabled(ModifierData *md, int useRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
BooleanModifierData *bmd = (BooleanModifierData*) md;
@@ -66,9 +67,10 @@ static void foreachObjectLink(
walk(userData, ob, &bmd->object);
}
-static void updateDepgraph(
- ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob,
- DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
BooleanModifierData *bmd = (BooleanModifierData*) md;
@@ -81,9 +83,10 @@ static void updateDepgraph(
}
-static DerivedMesh *applyModifier(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
BooleanModifierData *bmd = (BooleanModifierData*) md;
DerivedMesh *dm = bmd->object->derivedFinal;
@@ -105,7 +108,7 @@ static DerivedMesh *applyModifier(
return derivedData;
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
{
CustomDataMask dataMask = (1 << CD_MTFACE) + (1 << CD_MEDGE);
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index de913d79f01..960db7fa925 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -65,14 +65,15 @@ static void copyData(ModifierData *md, ModifierData *target)
tbmd->seed = bmd->seed;
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 1;
}
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
- DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *dm = derivedData;
DerivedMesh *result;
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 1872263848b..c39aa288b18 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -35,6 +35,7 @@
#include "BLI_math.h"
+#include "BKE_utildefines.h"
#include "BKE_deform.h"
#include "BKE_DerivedMesh.h"
#include "BKE_modifier.h"
@@ -73,7 +74,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32);
}
-static int isDisabled(ModifierData *md, int useRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
CastModifierData *cmd = (CastModifierData*) md;
short flag;
@@ -85,7 +86,7 @@ static int isDisabled(ModifierData *md, int useRenderParams)
return 0;
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
CastModifierData *cmd = (CastModifierData *)md;
CustomDataMask dataMask = 0;
@@ -106,9 +107,10 @@ static void foreachObjectLink(
walk (userData, ob, &cmd->object);
}
-static void updateDepgraph(
- ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob,
- DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
CastModifierData *cmd = (CastModifierData*) md;
@@ -566,14 +568,17 @@ static void cuboid_do(
}
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *dm = NULL;
CastModifierData *cmd = (CastModifierData *)md;
- dm = get_dm(md->scene, ob, NULL, derivedData, NULL, 0);
+ dm = get_dm(ob, NULL, derivedData, NULL, 0);
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
cuboid_do(cmd, ob, dm, vertexCos, numVerts);
@@ -589,7 +594,7 @@ static void deformVertsEM(
ModifierData *md, Object *ob, struct EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
- DerivedMesh *dm = get_dm(md->scene, ob, editData, derivedData, NULL, 0);
+ DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
CastModifierData *cmd = (CastModifierData *)md;
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 1c0ab34f15c..0c6c1e87a72 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -36,6 +36,7 @@
#include "MEM_guardedalloc.h"
+#include "BKE_utildefines.h"
#include "BKE_cloth.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
@@ -111,7 +112,7 @@ static void updateDepgraph(
}
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
CustomDataMask dataMask = 0;
ClothModifierData *clmd = (ClothModifierData*)md;
@@ -150,7 +151,7 @@ static void copyData(ModifierData *md, ModifierData *target)
tclmd->clothObject = NULL;
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 1;
}
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index 2651122231c..20319b8c65f 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -38,6 +38,7 @@
#include "BLI_math.h"
+#include "BKE_utildefines.h"
#include "BKE_collision.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
@@ -94,14 +95,17 @@ static void freeData(ModifierData *md)
}
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 1;
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int UNUSED(numVerts),
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
CollisionModifierData *collmd = (CollisionModifierData*) md;
DerivedMesh *dm = NULL;
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index 998bf375e79..8009ad0589c 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -35,6 +35,7 @@
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_lattice.h"
#include "BKE_modifier.h"
@@ -59,7 +60,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strncpy(tcmd->name, cmd->name, 32);
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
CurveModifierData *cmd = (CurveModifierData *)md;
CustomDataMask dataMask = 0;
@@ -70,7 +71,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
return dataMask;
}
-static int isDisabled(ModifierData *md, int userRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(userRenderParams))
{
CurveModifierData *cmd = (CurveModifierData*) md;
@@ -87,9 +88,10 @@ static void foreachObjectLink(
walk(userData, ob, &cmd->object);
}
-static void updateDepgraph(
- ModifierData *md, DagForest *forest, Scene *scene,
- Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
CurveModifierData *cmd = (CurveModifierData*) md;
@@ -101,9 +103,12 @@ static void updateDepgraph(
}
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
CurveModifierData *cmd = (CurveModifierData*) md;
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index 03307934e00..8df0c0be3eb 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -34,6 +34,7 @@
#include "BLI_math.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
@@ -59,9 +60,10 @@ static void copyData(ModifierData *md, ModifierData *target)
tdmd->percent = dmd->percent;
}
-static DerivedMesh *applyModifier(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DecimateModifierData *dmd = (DecimateModifierData*) md;
DerivedMesh *dm = derivedData, *result = NULL;
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 2e811eb742d..95e8a9ce4cc 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -35,6 +35,7 @@
#include "BLI_math.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
#include "BKE_texture.h"
@@ -75,7 +76,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32);
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
CustomDataMask dataMask = 0;
@@ -127,16 +128,17 @@ static void foreachIDLink(ModifierData *md, Object *ob,
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
}
-static int isDisabled(ModifierData *md, int useRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
return (!dmd->texture || dmd->strength == 0.0f);
}
-static void updateDepgraph(
- ModifierData *md, DagForest *forest, struct Scene *scene,
- Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
@@ -308,11 +310,14 @@ static void displaceModifier_do(
MEM_freeN(tex_co);
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
- DerivedMesh *dm= get_cddm(md->scene, ob, NULL, derivedData, vertexCos);
+ DerivedMesh *dm= get_cddm(ob, NULL, derivedData, vertexCos);
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
vertexCos, numVerts);
@@ -325,7 +330,7 @@ static void deformVertsEM(
ModifierData *md, Object *ob, struct EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
- DerivedMesh *dm= get_cddm(md->scene, ob, editData, derivedData, vertexCos);
+ DerivedMesh *dm= get_cddm(ob, editData, derivedData, vertexCos);
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index e80b80abdb5..daf9d76cf51 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -40,6 +40,7 @@
#include "BLI_edgehash.h"
#include "BLI_math.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
#include "BKE_particle.h"
@@ -730,8 +731,7 @@ static int edge_is_loose(SmoothEdge *edge)
return !(edge->faces && edge->faces->next);
}
-static int edge_is_sharp(SmoothEdge *edge, int flags,
- float threshold)
+static int edge_is_sharp(SmoothEdge *edge)
{
#ifdef EDGESPLIT_DEBUG_1
printf("edge %d: ", edge->newIndex);
@@ -761,8 +761,7 @@ static int edge_is_sharp(SmoothEdge *edge, int flags,
* - hits a sharp edge (the edge is returned)
* - returns to the start edge (NULL is returned)
*/
-static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge,
- LinkNode **visited_faces, float threshold, int flags)
+static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, LinkNode **visited_faces)
{
SmoothFace *face = NULL;
SmoothEdge *edge2 = NULL;
@@ -790,7 +789,7 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge,
/* search until we hit a loose edge or a sharp edge or an edge we've
* seen before
*/
- while(face && !edge_is_sharp(edge2, flags, threshold)
+ while(face && !edge_is_sharp(edge2)
&& !linklist_contains(visited_edges, edge2)) {
#ifdef EDGESPLIT_DEBUG_3
printf("current face %4d; current edge %4d\n", face->newIndex,
@@ -902,8 +901,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert,
edge->newIndex, vert->newIndex);
#endif
- edge2 = find_other_sharp_edge(vert, edge, &visited_faces,
- mesh->threshold, mesh->flags);
+ edge2 = find_other_sharp_edge(vert, edge, &visited_faces);
if(!edge2) {
/* didn't find a sharp or loose edge, so we've hit a dead end */
@@ -912,7 +910,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert,
if(edge_is_loose(edge)) {
/* edge is loose, so we can split edge2 at this vert */
split_edge(edge2, vert, mesh);
- } else if(edge_is_sharp(edge, mesh->flags, mesh->threshold)) {
+ } else if(edge_is_sharp(edge)) {
/* both edges are sharp, so we can split the pair at vert */
split_edge(edge, vert, mesh);
} else {
@@ -961,8 +959,7 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh)
edge->newIndex, vert->newIndex);
#endif
- edge2 = find_other_sharp_edge(vert, edge, &visited_faces,
- mesh->threshold, mesh->flags);
+ edge2 = find_other_sharp_edge(vert, edge, &visited_faces);
if(!edge2) {
/* didn't find a sharp or loose edge, so try the other vert */
@@ -1111,7 +1108,7 @@ static void split_sharp_edges(SmoothMesh *mesh, float split_angle, int flags)
for(i = 0; i < mesh->num_edges; i++) {
SmoothEdge *edge = &mesh->edges[i];
- if(edge_is_sharp(edge, flags, mesh->threshold)) {
+ if(edge_is_sharp(edge)) {
split_edge(edge, edge->verts[0], mesh);
do {
@@ -1190,8 +1187,7 @@ static void split_bridge_verts(SmoothMesh *mesh)
}
}
-static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd,
- Object *ob, DerivedMesh *dm)
+static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, DerivedMesh *dm)
{
SmoothMesh *mesh;
DerivedMesh *result;
@@ -1244,14 +1240,15 @@ static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd,
return result;
}
-static DerivedMesh *applyModifier(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *result;
EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
- result = edgesplitModifier_do(emd, ob, derivedData);
+ result = edgesplitModifier_do(emd, derivedData);
if(result != derivedData)
CDDM_calc_normals(result);
@@ -1259,9 +1256,9 @@ static DerivedMesh *applyModifier(
return result;
}
-static DerivedMesh *applyModifierEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
- DerivedMesh *derivedData)
+static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
+ struct EditMesh *UNUSED(editData),
+ DerivedMesh *derivedData)
{
return applyModifier(md, ob, derivedData, 0, 1);
}
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index cbf5f3c3b98..67f1f2a3e59 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -74,11 +74,11 @@ static void copyData(ModifierData *md, ModifierData *target)
temd->protect = emd->protect;
temd->vgroup = emd->vgroup;
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 1;
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
ExplodeModifierData *emd= (ExplodeModifierData*) md;
CustomDataMask dataMask = 0;
@@ -90,8 +90,8 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
}
static void createFacepa(ExplodeModifierData *emd,
- ParticleSystemModifierData *psmd,
- Object *ob, DerivedMesh *dm)
+ ParticleSystemModifierData *psmd,
+ DerivedMesh *dm)
{
ParticleSystem *psys=psmd->psys;
MFace *fa=0, *mface=0;
@@ -833,9 +833,10 @@ static ParticleSystemModifierData * findPrecedingParticlesystem(Object *ob, Modi
}
return psmd;
}
-static DerivedMesh * applyModifier(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *dm = derivedData;
ExplodeModifierData *emd= (ExplodeModifierData*) md;
@@ -852,16 +853,16 @@ static DerivedMesh * applyModifier(
if(emd->facepa==0
|| psmd->flag&eParticleSystemFlag_Pars
|| emd->flag&eExplodeFlag_CalcFaces
- || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumFaces(dm)){
+ || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumFaces(dm))
+ {
if(psmd->flag & eParticleSystemFlag_Pars)
psmd->flag &= ~eParticleSystemFlag_Pars;
if(emd->flag & eExplodeFlag_CalcFaces)
emd->flag &= ~eExplodeFlag_CalcFaces;
- createFacepa(emd,psmd,ob,derivedData);
- }
-
+ createFacepa(emd,psmd,derivedData);
+ }
/* 2. create new mesh */
if(emd->flag & eExplodeFlag_EdgeSplit){
int *facepa = emd->facepa;
diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c
index 619891e136f..14fb09f1c1f 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -34,6 +34,7 @@
#include "DNA_object_fluidsim.h"
#include "DNA_object_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
@@ -125,7 +126,7 @@ static void updateDepgraph(
}
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 1;
}
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 0c5428cc9d8..fb3eb74a919 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -43,10 +43,11 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BKE_main.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_utildefines.h"
-#include "BKE_global.h" /* G.sce only */
+#include "BKE_global.h" /* G.main->name only */
#include "MOD_modifiertypes.h"
@@ -138,6 +139,8 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
fss->flag |= OB_FLUIDSIM_ACTIVE;
}
+#else
+ (void)fluidmd; /* unused */
#endif
return;
}
@@ -154,7 +157,10 @@ void fluidsim_free(FluidsimModifierData *fluidmd)
}
MEM_freeN(fluidmd->fss);
}
+#else
+ (void)fluidmd; /* unused */
#endif
+
return;
}
@@ -443,7 +449,7 @@ void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, cha
gzclose(gzf);
}
-DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams)
+DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams)
{
int displaymode = 0;
int curFrame = framenr - 1 /*scene->r.sfra*/; /* start with 0 at start frame */
@@ -477,7 +483,7 @@ DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifie
strcat(targetDir,"fluidsurface_final_####");
}
- BLI_path_abs(targetDir, G.sce);
+ BLI_path_abs(targetDir, G.main->name);
BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no
strcpy(targetFile,targetDir);
@@ -537,7 +543,11 @@ DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifie
#endif // DISABLE_ELBEEM
-DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc)
+DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
+ Object *UNUSED(ob),
+ DerivedMesh *dm,
+ int useRenderParams,
+ int UNUSED(isFinalCalc))
{
#ifndef DISABLE_ELBEEM
DerivedMesh *result = NULL;
@@ -567,7 +577,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob
}
/* try to read from cache */
- if(((fss->lastgoodframe >= framenr) || (fss->lastgoodframe < 0)) && (result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
+ if(((fss->lastgoodframe >= framenr) || (fss->lastgoodframe < 0)) && (result = fluidsim_read_cache(dm, fluidmd, framenr, useRenderParams)))
{
// fss->lastgoodframe = framenr; // set also in src/fluidsim.c
return result;
@@ -577,7 +587,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob
// display last known good frame
if(fss->lastgoodframe >= 0)
{
- if((result = fluidsim_read_cache(ob, dm, fluidmd, fss->lastgoodframe, useRenderParams)))
+ if((result = fluidsim_read_cache(dm, fluidmd, fss->lastgoodframe, useRenderParams)))
{
return result;
}
@@ -587,7 +597,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob
// this could be likely the case when you load an old fluidsim
- if((result = fluidsim_read_cache(ob, dm, fluidmd, fss->lastgoodframe, useRenderParams)))
+ if((result = fluidsim_read_cache(dm, fluidmd, fss->lastgoodframe, useRenderParams)))
{
return result;
}
@@ -603,6 +613,11 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob
return dm;
#else
+ /* unused */
+ (void)fluidmd;
+ (void)scene;
+ (void)dm;
+ (void)useRenderParams;
return NULL;
#endif
}
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index f2ffd486aa5..c26d3ff0967 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -40,6 +40,7 @@
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
#include "BKE_deform.h"
+#include "BKE_utildefines.h"
#include "depsgraph_private.h"
#include "MEM_guardedalloc.h"
@@ -68,13 +69,14 @@ static void copyData(ModifierData *md, ModifierData *target)
strncpy(thmd->subtarget, hmd->subtarget, 32);
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
HookModifierData *hmd = (HookModifierData *)md;
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(!hmd->indexar && hmd->name[0]) dataMask |= (1 << CD_MDEFORMVERT);
+ if(hmd->name[0]) dataMask |= (1 << CD_MDEFORMVERT);
+ // if(hmd->indexar) dataMask |= CD_MASK_ORIGINDEX;
return dataMask;
}
@@ -86,7 +88,7 @@ static void freeData(ModifierData *md)
if (hmd->indexar) MEM_freeN(hmd->indexar);
}
-static int isDisabled(ModifierData *md, int useRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
HookModifierData *hmd = (HookModifierData*) md;
@@ -103,8 +105,10 @@ static void foreachObjectLink(
walk(userData, ob, &hmd->object);
}
-static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene,
- Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
HookModifierData *hmd = (HookModifierData*) md;
@@ -118,15 +122,38 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc
}
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, float fac)
+{
+ if(falloff_squared) {
+ float len_squared = len_squared_v3v3(co_1, co_2);
+ if(len_squared > falloff_squared) {
+ return 0.0f;
+ }
+ else if(len_squared > 0.0) {
+ return fac * (1.0 - (len_squared / falloff_squared));
+ }
+ }
+
+ return fac;
+}
+
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
HookModifierData *hmd = (HookModifierData*) md;
bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget);
float vec[3], mat[4][4], dmat[4][4];
- int i;
+ int i, *index_pt;
DerivedMesh *dm = derivedData;
+ const float falloff_squared= hmd->falloff * hmd->falloff; /* for faster comparisons */
+
+ int max_dvert= 0;
+ MDeformVert *dvert= NULL;
+ int defgrp_index = -1;
/* get world-space matrix of target, corrected for the space the verts are in */
if (hmd->subtarget[0] && pchan) {
@@ -141,98 +168,91 @@ static void deformVerts(
mul_serie_m4(mat, ob->imat, dmat, hmd->parentinv,
NULL, NULL, NULL, NULL, NULL);
- /* vertex indices? */
- if(hmd->indexar) {
- for(i = 0; i < hmd->totindex; i++) {
- int index = hmd->indexar[i];
-
- /* This should always be true and I don't generally like
- * "paranoid" style code like this, but old files can have
- * indices that are out of range because old blender did
- * not correct them on exit editmode. - zr
- */
- if(index < numVerts) {
- float *co = vertexCos[index];
- float fac = hmd->force;
-
- /* if DerivedMesh is present and has original index data,
- * use it
- */
- if(dm && dm->getVertDataArray(dm, CD_ORIGINDEX)) {
+ if((defgrp_index= defgroup_name_index(ob, hmd->name)) != -1) {
+ Mesh *me = ob->data;
+ if(dm) {
+ dvert= dm->getVertDataArray(dm, CD_MDEFORMVERT);
+ if(dvert) {
+ max_dvert = numVerts;
+ }
+ }
+ else if(me->dvert) {
+ dvert= me->dvert;
+ if(dvert) {
+ max_dvert = me->totvert;
+ }
+ }
+ }
+
+ /* Regarding index range checking below.
+ *
+ * This should always be true and I don't generally like
+ * "paranoid" style code like this, but old files can have
+ * indices that are out of range because old blender did
+ * not correct them on exit editmode. - zr
+ */
+
+ if(hmd->force == 0.0f) {
+ /* do nothing, avoid annoying checks in the loop */
+ }
+ else if(hmd->indexar) { /* vertex indices? */
+ const float fac_orig= hmd->force;
+ float fac;
+ const int *origindex_ar;
+
+ /* if DerivedMesh is present and has original index data,
+ * use it
+ */
+ if(dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) {
+ for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+ if(*index_pt < numVerts) {
int j;
- int orig_index;
- for(j = 0; j < numVerts; ++j) {
- fac = hmd->force;
- orig_index = *(int *)dm->getVertData(dm, j,
- CD_ORIGINDEX);
- if(orig_index == index) {
- co = vertexCos[j];
- if(hmd->falloff != 0.0) {
- float len = len_v3v3(co, hmd->cent);
- if(len > hmd->falloff) fac = 0.0;
- else if(len > 0.0)
- fac *= sqrt(1.0 - len / hmd->falloff);
- }
- if(fac != 0.0) {
- mul_v3_m4v3(vec, mat, co);
- interp_v3_v3v3(co, co, vec, fac);
+ for(j = 0; j < numVerts; j++) {
+ if(origindex_ar[j] == *index_pt) {
+ float *co = vertexCos[j];
+ if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+ if(dvert)
+ fac *= defvert_find_weight(dvert+j, defgrp_index);
+
+ if(fac) {
+ mul_v3_m4v3(vec, mat, co);
+ interp_v3_v3v3(co, co, vec, fac);
+ }
}
}
}
- } else {
- if(hmd->falloff != 0.0) {
- float len = len_v3v3(co, hmd->cent);
- if(len > hmd->falloff) fac = 0.0;
- else if(len > 0.0)
- fac *= sqrt(1.0 - len / hmd->falloff);
- }
-
- if(fac != 0.0) {
- mul_v3_m4v3(vec, mat, co);
- interp_v3_v3v3(co, co, vec, fac);
- }
}
}
}
- }
- else if(hmd->name[0]) { /* vertex group hook */
- Mesh *me = ob->data;
- int use_dverts = 0;
- int maxVerts = 0;
- int defgrp_index = defgroup_name_index(ob, hmd->name);
-
- if(dm) {
- if(dm->getVertData(dm, 0, CD_MDEFORMVERT)) {
- maxVerts = dm->getNumVerts(dm);
- use_dverts = 1;
+ else { /* missing dm or ORIGINDEX */
+ for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+ if(*index_pt < numVerts) {
+ float *co = vertexCos[*index_pt];
+ if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+ if(dvert)
+ fac *= defvert_find_weight(dvert+(*index_pt), defgrp_index);
+
+ if(fac) {
+ mul_v3_m4v3(vec, mat, co);
+ interp_v3_v3v3(co, co, vec, fac);
+ }
+ }
+ }
}
}
- else if(me->dvert) {
- maxVerts = me->totvert;
- use_dverts = 1;
- }
+ }
+ else if(dvert) { /* vertex group hook */
+ int i;
+ const float fac_orig= hmd->force;
- if(defgrp_index >= 0 && use_dverts) {
- MDeformVert *dvert = me->dvert;
- int i;
+ for(i = 0; i < max_dvert; i++, dvert++) {
float fac;
+ float *co = vertexCos[i];
- for(i = 0; i < maxVerts; i++, dvert++) {
- if(dm) dvert = dm->getVertData(dm, i, CD_MDEFORMVERT);
-
- fac= defvert_find_weight(dvert, defgrp_index);
-
- if(fac > 0.0f) {
- float *co = vertexCos[i];
-
- if(hmd->falloff != 0.0) {
- float len = len_v3v3(co, hmd->cent);
- if(len > hmd->falloff) fac = 0.0;
- else if(len > 0.0)
- fac *= sqrt(1.0 - len / hmd->falloff);
- }
-
+ if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+ fac *= defvert_find_weight(dvert, defgrp_index);
+ if(fac) {
mul_v3_m4v3(vec, mat, co);
interp_v3_v3v3(co, co, vec, fac);
}
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index 532475a3466..fdbc3fa0a50 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -34,6 +34,7 @@
#include "DNA_object_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_lattice.h"
#include "BKE_modifier.h"
@@ -52,7 +53,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strncpy(tlmd->name, lmd->name, 32);
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
LatticeModifierData *lmd = (LatticeModifierData *)md;
CustomDataMask dataMask = 0;
@@ -63,7 +64,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
return dataMask;
}
-static int isDisabled(ModifierData *md, int userRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(userRenderParams))
{
LatticeModifierData *lmd = (LatticeModifierData*) md;
@@ -80,8 +81,10 @@ static void foreachObjectLink(
walk(userData, ob, &lmd->object);
}
-static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene,
- Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
LatticeModifierData *lmd = (LatticeModifierData*) md;
@@ -93,9 +96,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc
}
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
LatticeModifierData *lmd = (LatticeModifierData*) md;
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index c1565352133..eddb21596a6 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -55,7 +55,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strcpy(tmmd->vgroup, mmd->vgroup);
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
{
return (1 << CD_MDEFORMVERT);
}
@@ -69,8 +69,10 @@ static void foreachObjectLink(
walk(userData, ob, &mmd->ob_arm);
}
-static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene,
- Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
MaskModifierData *mmd = (MaskModifierData *)md;
@@ -84,8 +86,9 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc
}
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
- DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
MaskModifierData *mmd= (MaskModifierData *)md;
DerivedMesh *dm= derivedData, *result= NULL;
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index af87fb6ef74..587b3b8f053 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -35,6 +35,7 @@
#include "BLI_math.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
@@ -76,7 +77,7 @@ static void copyData(ModifierData *md, ModifierData *target)
tmmd->object = mmd->object;
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
MeshDeformModifierData *mmd = (MeshDeformModifierData *)md;
CustomDataMask dataMask = 0;
@@ -87,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
return dataMask;
}
-static int isDisabled(ModifierData *md, int useRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
@@ -104,9 +105,10 @@ static void foreachObjectLink(
walk(userData, ob, &mmd->object);
}
-static void updateDepgraph(
- ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob,
- DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
@@ -204,7 +206,7 @@ static void meshdeformModifier_do(
/* if we don't have one computed, use derivedmesh from data
* without any modifiers */
if(!cagedm) {
- cagedm= get_dm(md->scene, mmd->object, NULL, NULL, NULL, 0);
+ cagedm= get_dm(mmd->object, NULL, NULL, NULL, 0);
if(cagedm)
cagedm->needsFree= 1;
}
@@ -338,11 +340,14 @@ static void meshdeformModifier_do(
cagedm->release(cagedm);
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
- DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0);;
+ DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0);;
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
@@ -352,11 +357,13 @@ static void deformVerts(
dm->release(dm);
}
-static void deformVertsEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+static void deformVertsEM(ModifierData *md, Object *ob,
+ struct EditMesh *UNUSED(editData),
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts)
{
- DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0);;
+ DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0);;
meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index 9289c44c414..6405f0e9d76 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -74,8 +74,10 @@ static void foreachObjectLink(
walk(userData, ob, &mmd->mirror_ob);
}
-static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene,
- Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
MirrorModifierData *mmd = (MirrorModifierData*) md;
@@ -298,9 +300,10 @@ static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd,
return result;
}
-static DerivedMesh *applyModifier(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *result;
MirrorModifierData *mmd = (MirrorModifierData*) md;
@@ -313,9 +316,9 @@ static DerivedMesh *applyModifier(
return result;
}
-static DerivedMesh *applyModifierEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
- DerivedMesh *derivedData)
+static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
+ struct EditMesh *UNUSED(editData),
+ DerivedMesh *derivedData)
{
return applyModifier(md, ob, derivedData, 0, 1);
}
diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c
index 8cfb2a59376..1b6a709e7f4 100644
--- a/source/blender/modifiers/intern/MOD_none.c
+++ b/source/blender/modifiers/intern/MOD_none.c
@@ -34,13 +34,14 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include "BKE_utildefines.h"
#include "MOD_modifiertypes.h"
/* We only need to define isDisabled; because it always returns 1,
* no other functions will be called
*/
-static int isDisabled(ModifierData *md, int userRenderParams)
+static int isDisabled(ModifierData *UNUSED(md), int UNUSED(userRenderParams))
{
return 1;
}
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index bbd0219d3f8..9fcefdba49a 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -72,12 +72,14 @@ static void copyData(ModifierData *md, ModifierData *target)
tpimd->random_position = pimd->random_position;
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 0;
}
static void updateDepgraph(ModifierData *md, DagForest *forest,
- struct Scene *scene,Object *ob, DagNode *obNode)
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData*) md;
@@ -98,9 +100,10 @@ static void foreachObjectLink(ModifierData *md, Object *ob,
walk(userData, ob, &pimd->ob);
}
-static DerivedMesh * applyModifier(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *dm = derivedData, *result;
ParticleInstanceModifierData *pimd= (ParticleInstanceModifierData*) md;
@@ -306,9 +309,9 @@ static DerivedMesh * applyModifier(
return result;
}
-static DerivedMesh *applyModifierEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
- DerivedMesh *derivedData)
+static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
+ struct EditMesh *UNUSED(editData),
+ DerivedMesh *derivedData)
{
return applyModifier(md, ob, derivedData, 0, 1);
}
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index 602b6dd1d56..0feea3b6bf5 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -34,6 +34,7 @@
#include "DNA_material_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_material.h"
#include "BKE_modifier.h"
@@ -119,9 +120,12 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
}
/* saves the current emitter state for a particle system and calculates particles */
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int UNUSED(numVerts),
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *dm = derivedData;
ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md;
@@ -137,7 +141,7 @@ static void deformVerts(
return;
if(dm==0) {
- dm= get_dm(md->scene, ob, NULL, NULL, vertexCos, 1);
+ dm= get_dm(ob, NULL, NULL, vertexCos, 1);
if(!dm)
return;
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 0016fd2d266..668f0a086d1 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -37,6 +37,7 @@
#include "BLI_math.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "depsgraph_private.h"
@@ -128,8 +129,9 @@ static void copyData(ModifierData *md, ModifierData *target)
}
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
- DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+ DerivedMesh *derivedData,
+ int useRenderParams,
+ int UNUSED(isFinalCalc))
{
DerivedMesh *dm= derivedData;
DerivedMesh *result;
@@ -832,9 +834,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
-static void updateDepgraph(
- ModifierData *md, DagForest *forest,
- struct Scene *scene, Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
ScrewModifierData *ltmd= (ScrewModifierData*) md;
@@ -859,13 +862,15 @@ static void foreachObjectLink(
/* This dosnt work with material*/
static DerivedMesh *applyModifierEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
+ ModifierData *md,
+ Object *ob,
+ struct EditMesh *UNUSED(editData),
DerivedMesh *derivedData)
{
return applyModifier(md, ob, derivedData, 0, 1);
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 0;
}
diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c
index bf675b874f6..a43e19a5fc1 100644
--- a/source/blender/modifiers/intern/MOD_shapekey.c
+++ b/source/blender/modifiers/intern/MOD_shapekey.c
@@ -34,6 +34,7 @@
#include "DNA_key_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_key.h"
#include "BKE_particle.h"
@@ -42,9 +43,12 @@
#include "MEM_guardedalloc.h"
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *UNUSED(derivedData),
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
KeyBlock *kb= ob_get_keyblock(ob);
float (*deformedVerts)[3];
@@ -58,9 +62,11 @@ static void deformVerts(
}
}
-static void deformVertsEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+static void deformVertsEM(ModifierData *md, Object *ob,
+ struct EditMesh *UNUSED(editData),
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts)
{
Key *key= ob_get_key(ob);
@@ -68,15 +74,19 @@ static void deformVertsEM(
deformVerts(md, ob, derivedData, vertexCos, numVerts, 0, 0);
}
-static void deformMatricesEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3],
- float (*defMats)[3][3], int numVerts)
+static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob,
+ struct EditMesh *UNUSED(editData),
+ DerivedMesh *UNUSED(derivedData),
+ float (*vertexCos)[3],
+ float (*defMats)[3][3],
+ int numVerts)
{
Key *key= ob_get_key(ob);
KeyBlock *kb= ob_get_keyblock(ob);
float scale[3][3];
int a;
+
+ (void)vertexCos; /* unused */
if(kb && kb->totelem==numVerts && kb!=key->refkey) {
scale_m3_fl(scale, kb->curval);
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index 6baee9f0d98..6eebe9b5e5e 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -32,6 +32,7 @@
#include <string.h>
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
#include "BKE_shrinkwrap.h"
@@ -71,7 +72,7 @@ static void copyData(ModifierData *md, ModifierData *target)
tsmd->subsurfLevels = smd->subsurfLevels;
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
CustomDataMask dataMask = 0;
@@ -87,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
return dataMask;
}
-static int isDisabled(ModifierData *md, int useRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md;
return !smd->target;
@@ -102,14 +103,19 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk,
walk(userData, ob, &smd->auxTarget);
}
-static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *dm = derivedData;
CustomDataMask dataMask = requiredDataMask(ob, md);
/* ensure we get a CDDM with applied vertex coords */
if(dataMask)
- dm= get_cddm(md->scene, ob, NULL, dm, vertexCos);
+ dm= get_cddm(ob, NULL, dm, vertexCos);
shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, md->scene, ob, dm, vertexCos, numVerts);
@@ -124,7 +130,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editDat
/* ensure we get a CDDM with applied vertex coords */
if(dataMask)
- dm= get_cddm(md->scene, ob, editData, dm, vertexCos);
+ dm= get_cddm(ob, editData, dm, vertexCos);
shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, md->scene, ob, dm, vertexCos, numVerts);
@@ -132,7 +138,10 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editDat
dm->release(dm);
}
-static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md;
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index ab580781351..7c47ab02157 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -290,7 +290,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strcpy(tsmd->vgroup_name, smd->vgroup_name);
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md;
CustomDataMask dataMask = 0;
@@ -308,7 +308,10 @@ static void foreachObjectLink(ModifierData *md, Object *ob, void (*walk)(void *u
walk(userData, ob, &smd->origin);
}
-static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
SimpleDeformModifierData *smd = (SimpleDeformModifierData*)md;
@@ -316,7 +319,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc
dag_add_relation(forest, dag_get_node(forest, smd->origin), obNode, DAG_RL_OB_DATA, "SimpleDeform Modifier");
}
-static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *dm = derivedData;
CustomDataMask dataMask = requiredDataMask(ob, md);
@@ -324,7 +332,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
/* we implement requiredDataMask but thats not really usefull since
mesh_calc_modifiers pass a NULL derivedData */
if(dataMask)
- dm= get_dm(md->scene, ob, NULL, dm, NULL, 0);
+ dm= get_dm(ob, NULL, dm, NULL, 0);
SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts);
@@ -332,7 +340,11 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
dm->release(dm);
}
-static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+static void deformVertsEM(ModifierData *md, Object *ob,
+ struct EditMesh *editData,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts)
{
DerivedMesh *dm = derivedData;
CustomDataMask dataMask = requiredDataMask(ob, md);
@@ -340,7 +352,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editDat
/* we implement requiredDataMask but thats not really usefull since
mesh_calc_modifiers pass a NULL derivedData */
if(dataMask)
- dm= get_dm(md->scene, ob, editData, dm, NULL, 0);
+ dm= get_dm(ob, editData, dm, NULL, 0);
SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c
index f89ff0bb1b5..aee466802ca 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -36,6 +36,7 @@
#include "DNA_object_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
#include "BKE_smoke.h"
@@ -71,12 +72,15 @@ static void freeData(ModifierData *md)
smokeModifier_free (smd);
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int UNUSED(numVerts),
+ int useRenderParams,
+ int isFinalCalc)
{
SmokeModifierData *smd = (SmokeModifierData*) md;
- DerivedMesh *dm = dm= get_cddm(md->scene, ob, NULL, derivedData, vertexCos);
+ DerivedMesh *dm = dm= get_cddm(ob, NULL, derivedData, vertexCos);
smokeModifier_do(smd, md->scene, ob, dm, useRenderParams, isFinalCalc);
@@ -84,14 +88,15 @@ static void deformVerts(
dm->release(dm);
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 1;
}
-static void updateDepgraph(
- ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob,
- DagNode *obNode)
+static void updateDepgraph(ModifierData *UNUSED(md), DagForest *UNUSED(forest),
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *UNUSED(obNode))
{
/*SmokeModifierData *smd = (SmokeModifierData *) md;
if(smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c
index 96269c092c9..db7013f53ce 100644
--- a/source/blender/modifiers/intern/MOD_smooth.c
+++ b/source/blender/modifiers/intern/MOD_smooth.c
@@ -37,6 +37,7 @@
#include "BKE_cdderivedmesh.h"
#include "BKE_particle.h"
#include "BKE_deform.h"
+#include "BKE_utildefines.h"
#include "MEM_guardedalloc.h"
@@ -65,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strncpy(tsmd->defgrp_name, smd->defgrp_name, 32);
}
-static int isDisabled(ModifierData *md, int useRenderParams)
+static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
SmoothModifierData *smd = (SmoothModifierData*) md;
short flag;
@@ -78,7 +79,7 @@ static int isDisabled(ModifierData *md, int useRenderParams)
return 0;
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
SmoothModifierData *smd = (SmoothModifierData *)md;
CustomDataMask dataMask = 0;
@@ -219,9 +220,9 @@ static void smoothModifier_do(
static void deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ float (*vertexCos)[3], int numVerts, int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
{
- DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0);
+ DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0);
smoothModifier_do((SmoothModifierData *)md, ob, dm,
vertexCos, numVerts);
@@ -234,7 +235,7 @@ static void deformVertsEM(
ModifierData *md, Object *ob, struct EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
- DerivedMesh *dm= get_dm(md->scene, ob, editData, derivedData, NULL, 0);
+ DerivedMesh *dm= get_dm(ob, editData, derivedData, NULL, 0);
smoothModifier_do((SmoothModifierData *)md, ob, dm,
vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c
index 931cfe2e2d3..8d962395d01 100644
--- a/source/blender/modifiers/intern/MOD_softbody.c
+++ b/source/blender/modifiers/intern/MOD_softbody.c
@@ -32,20 +32,24 @@
#include "DNA_scene_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_particle.h"
#include "BKE_softbody.h"
#include "MOD_modifiertypes.h"
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *UNUSED(derivedData),
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
sbObjectStep(md->scene, ob, (float)md->scene->r.cfra, vertexCos, numVerts);
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 1;
}
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 57155c4e1dc..6abe1262c0b 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -179,7 +179,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strcpy(tsmd->defgrp_name, smd->defgrp_name);
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
SolidifyModifierData *smd = (SolidifyModifierData*) md;
CustomDataMask dataMask = 0;
@@ -191,11 +191,10 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
}
-static DerivedMesh *applyModifier(ModifierData *md,
- Object *ob,
- DerivedMesh *dm,
- int useRenderParams,
- int isFinalCalc)
+static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
+ DerivedMesh *dm,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
int i;
DerivedMesh *result;
@@ -630,7 +629,7 @@ static DerivedMesh *applyModifier(ModifierData *md,
static DerivedMesh *applyModifierEM(ModifierData *md,
Object *ob,
- struct EditMesh *editData,
+ struct EditMesh *UNUSED(editData),
DerivedMesh *derivedData)
{
return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index c314e6b173c..a82b3af975b 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -35,6 +35,7 @@
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_scene.h"
#include "BKE_subsurf.h"
@@ -83,9 +84,10 @@ static int isDisabled(ModifierData *md, int useRenderParams)
return get_render_subsurf_level(&md->scene->r, levels) == 0;
}
-static DerivedMesh *applyModifier(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
+ DerivedMesh *derivedData,
+ int useRenderParams,
+ int isFinalCalc)
{
SubsurfModifierData *smd = (SubsurfModifierData*) md;
DerivedMesh *result;
@@ -102,9 +104,9 @@ static DerivedMesh *applyModifier(
return result;
}
-static DerivedMesh *applyModifierEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
- DerivedMesh *derivedData)
+static DerivedMesh *applyModifierEM(ModifierData *md, Object *UNUSED(ob),
+ struct EditMesh *UNUSED(editData),
+ DerivedMesh *derivedData)
{
SubsurfModifierData *smd = (SubsurfModifierData*) md;
DerivedMesh *result;
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index b2f55bde360..a1593df0ffa 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -36,6 +36,7 @@
#include "BLI_math.h"
+#include "BKE_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "MOD_modifiertypes.h"
@@ -76,14 +77,17 @@ static void freeData(ModifierData *md)
}
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 1;
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int UNUSED(numVerts),
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
SurfaceModifierData *surmd = (SurfaceModifierData*) md;
unsigned int numverts = 0, i = 0;
@@ -93,7 +97,7 @@ static void deformVerts(
/* if possible use/create DerivedMesh */
if(derivedData) surmd->dm = CDDM_copy(derivedData);
- else surmd->dm = get_dm(md->scene, ob, NULL, NULL, NULL, 0);
+ else surmd->dm = get_dm(ob, NULL, NULL, NULL, 0);
if(!ob->pd)
{
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index a33c80bc6ae..4ed5b22756b 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -68,13 +68,13 @@ void validate_layer_name(const CustomData *data, int type, char *name, char *out
/* if a layer name was given, try to find that layer */
if(name[0])
- index = CustomData_get_named_layer_index(data, CD_MTFACE, name);
+ index = CustomData_get_named_layer_index(data, type, name);
if(index < 0) {
/* either no layer was specified, or the layer we want has been
* deleted, so assign the active layer to name
*/
- index = CustomData_get_active_layer_index(data, CD_MTFACE);
+ index = CustomData_get_active_layer_index(data, type);
strcpy(outname, data->layers[index].name);
}
else
@@ -82,13 +82,13 @@ void validate_layer_name(const CustomData *data, int type, char *name, char *out
}
/* returns a cdderivedmesh if dm == NULL or is another type of derivedmesh */
-DerivedMesh *get_cddm(struct Scene *scene, Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3])
+DerivedMesh *get_cddm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3])
{
if(dm && dm->type == DM_TYPE_CDDM)
return dm;
if(!dm) {
- dm= get_dm(scene, ob, em, dm, vertexCos, 0);
+ dm= get_dm(ob, em, dm, vertexCos, 0);
}
else {
dm= CDDM_copy(dm);
@@ -102,7 +102,7 @@ DerivedMesh *get_cddm(struct Scene *scene, Object *ob, struct EditMesh *em, Deri
}
/* returns a derived mesh if dm == NULL, for deforming modifiers that need it */
-DerivedMesh *get_dm(struct Scene *scene, Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco)
+DerivedMesh *get_dm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco)
{
if(dm)
return dm;
@@ -127,7 +127,7 @@ DerivedMesh *get_dm(struct Scene *scene, Object *ob, struct EditMesh *em, Derive
}
/* only called by BKE_modifier.h/modifier.c */
-void modifier_type_init(ModifierTypeInfo *types[], ModifierType type)
+void modifier_type_init(ModifierTypeInfo *types[])
{
memset(types, 0, sizeof(types));
#define INIT_TYPE(typeName) (types[eModifierType_##typeName] = &modifierType_##typeName)
diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h
index c064f776897..6745d3ee564 100644
--- a/source/blender/modifiers/intern/MOD_util.h
+++ b/source/blender/modifiers/intern/MOD_util.h
@@ -39,9 +39,9 @@ struct ModifierData;
void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]);
void validate_layer_name(const struct CustomData *data, int type, char *name, char *outname);
-struct DerivedMesh *get_cddm(struct Scene *scene, struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]);
-struct DerivedMesh *get_dm(struct Scene *scene, struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco);
+struct DerivedMesh *get_cddm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]);
+struct DerivedMesh *get_dm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco);
-void modifier_type_init(struct ModifierTypeInfo *types[], ModifierType type);
+void modifier_type_init(struct ModifierTypeInfo *types[]);
#endif /* MOD_UTIL_H */
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 211640ad777..942b4b0b597 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -39,6 +39,7 @@
#include "BLI_math.h"
#include "BLI_uvproject.h"
+#include "BKE_utildefines.h"
#include "BKE_DerivedMesh.h"
#include "MOD_modifiertypes.h"
@@ -78,7 +79,7 @@ static void copyData(ModifierData *md, ModifierData *target)
tumd->scaley = umd->scaley;
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
{
CustomDataMask dataMask = 0;
@@ -109,8 +110,10 @@ static void foreachIDLink(ModifierData *md, Object *ob,
userData);
}
-static void updateDepgraph(ModifierData *md,
- DagForest *forest, struct Scene *scene, Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ struct Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
UVProjectModifierData *umd = (UVProjectModifierData*) md;
int i;
@@ -376,9 +379,10 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
return dm;
}
-static DerivedMesh *applyModifier(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc)
+static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *result;
UVProjectModifierData *umd = (UVProjectModifierData*) md;
@@ -388,9 +392,9 @@ static DerivedMesh *applyModifier(
return result;
}
-static DerivedMesh *applyModifierEM(
- ModifierData *md, Object *ob, struct EditMesh *editData,
- DerivedMesh *derivedData)
+static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
+ struct EditMesh *UNUSED(editData),
+ DerivedMesh *derivedData)
{
return applyModifier(md, ob, derivedData, 0, 1);
}
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index b4f20eed832..8c0e18f5248 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -36,6 +36,7 @@
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
+#include "BKE_utildefines.h"
#include "BKE_DerivedMesh.h"
#include "BKE_object.h"
#include "BKE_deform.h"
@@ -94,7 +95,7 @@ static void copyData(ModifierData *md, ModifierData *target)
strncpy(twmd->defgrp_name, wmd->defgrp_name, 32);
}
-static int dependsOnTime(ModifierData *md)
+static int dependsOnTime(ModifierData *UNUSED(md))
{
return 1;
}
@@ -119,9 +120,10 @@ static void foreachIDLink(ModifierData *md, Object *ob,
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
}
-static void updateDepgraph(
- ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
- DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+ Scene *UNUSED(scene),
+ Object *UNUSED(ob),
+ DagNode *obNode)
{
WaveModifierData *wmd = (WaveModifierData*) md;
@@ -140,7 +142,7 @@ static void updateDepgraph(
}
}
-static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
WaveModifierData *wmd = (WaveModifierData *)md;
CustomDataMask dataMask = 0;
@@ -400,17 +402,20 @@ static void waveModifier_do(WaveModifierData *md,
if(wmd->texture) MEM_freeN(tex_co);
}
-static void deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+static void deformVerts(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ float (*vertexCos)[3],
+ int numVerts,
+ int UNUSED(useRenderParams),
+ int UNUSED(isFinalCalc))
{
DerivedMesh *dm= derivedData;
WaveModifierData *wmd = (WaveModifierData *)md;
if(wmd->flag & MOD_WAVE_NORM)
- dm= get_cddm(md->scene, ob, NULL, dm, vertexCos);
+ dm= get_cddm(ob, NULL, dm, vertexCos);
else if(wmd->texture || wmd->defgrp_name[0])
- dm= get_dm(md->scene, ob, NULL, dm, NULL, 0);
+ dm= get_dm(ob, NULL, dm, NULL, 0);
waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts);
@@ -426,9 +431,9 @@ static void deformVertsEM(
WaveModifierData *wmd = (WaveModifierData *)md;
if(wmd->flag & MOD_WAVE_NORM)
- dm= get_cddm(md->scene, ob, editData, dm, vertexCos);
+ dm= get_cddm(ob, editData, dm, vertexCos);
else if(wmd->texture || wmd->defgrp_name[0])
- dm= get_dm(md->scene, ob, editData, dm, NULL, 0);
+ dm= get_dm(ob, editData, dm, NULL, 0);
waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
index 37061dd7eae..3f6bd989477 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
@@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_alphaover_out[]= {
{ -1, 0, "" }
};
-static void do_alphaover_premul(bNode *node, float *out, float *src, float *over, float *fac)
+static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
{
if(over[3]<=0.0f) {
@@ -61,7 +61,7 @@ static void do_alphaover_premul(bNode *node, float *out, float *src, float *over
}
/* result will be still premul, but the over part is premulled */
-static void do_alphaover_key(bNode *node, float *out, float *src, float *over, float *fac)
+static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
{
if(over[3]<=0.0f) {
@@ -107,7 +107,7 @@ static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over,
-static void node_composit_exec_alphaover(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: col col */
/* stack order out: col */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
index 97577fa6b5e..404f0aefb3c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
@@ -81,7 +81,7 @@ static bNodeSocketType cmp_node_bilateralblur_out[]= {
/* code of this node was heavily inspired by the smooth function of opencv library.
The main change is an optional image input */
-static void node_composit_exec_bilateralblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
NodeBilateralBlurData *nbbd= node->storage;
CompBuf *new, *source, *img= in[0]->data , *refimg= in[1]->data;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
index eb8b079f341..f367e7b473d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
@@ -93,109 +93,119 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
int x, y, pix= img->type;
int i, bigstep;
float *src, *dest;
-
+
/* helper image */
work= alloc_compbuf(imgx, imgy, img->type, 1); /* allocs */
-
- /* horizontal */
- rad = scale*(float)nbd->sizex;
- if(rad>imgx/2)
- rad= imgx/2;
- else if(rad<1)
- rad= 1;
- gausstab= make_gausstab(nbd->filtertype, rad);
- gausstabcent= gausstab+rad;
-
- for (y = 0; y < imgy; y++) {
- float *srcd= img->rect + pix*(y*img->x);
+ /* horizontal */
+ if(nbd->sizex == 0) {
+ memcpy(work->rect, img->rect, sizeof(float) * img->type * imgx * imgy);
+ }
+ else {
+ rad = scale*(float)nbd->sizex;
+ if(rad>imgx/2)
+ rad= imgx/2;
+ else if(rad<1)
+ rad= 1;
- dest = work->rect + pix*(y * img->x);
+ gausstab= make_gausstab(nbd->filtertype, rad);
+ gausstabcent= gausstab+rad;
- for (x = 0; x < imgx ; x++) {
- int minr= x-rad<0?-x:-rad;
- int maxr= x+rad>imgx?imgx-x:rad;
+ for (y = 0; y < imgy; y++) {
+ float *srcd= img->rect + pix*(y*img->x);
- src= srcd + pix*(x+minr);
+ dest = work->rect + pix*(y * img->x);
- sum= gval = rval= bval= aval= 0.0f;
- for (i= minr; i < maxr; i++) {
- val= gausstabcent[i];
- sum+= val;
- rval += val * (*src++);
+ for (x = 0; x < imgx ; x++) {
+ int minr= x-rad<0?-x:-rad;
+ int maxr= x+rad>imgx?imgx-x:rad;
+
+ src= srcd + pix*(x+minr);
+
+ sum= gval = rval= bval= aval= 0.0f;
+ for (i= minr; i < maxr; i++) {
+ val= gausstabcent[i];
+ sum+= val;
+ rval += val * (*src++);
+ if(pix==4) {
+ gval += val * (*src++);
+ bval += val * (*src++);
+ aval += val * (*src++);
+ }
+ }
+ sum= 1.0f/sum;
+ *dest++ = rval*sum;
if(pix==4) {
- gval += val * (*src++);
- bval += val * (*src++);
- aval += val * (*src++);
+ *dest++ = gval*sum;
+ *dest++ = bval*sum;
+ *dest++ = aval*sum;
}
}
- sum= 1.0f/sum;
- *dest++ = rval*sum;
- if(pix==4) {
- *dest++ = gval*sum;
- *dest++ = bval*sum;
- *dest++ = aval*sum;
- }
+ if(node->exec & NODE_BREAK)
+ break;
}
- if(node->exec & NODE_BREAK)
- break;
+
+ /* vertical */
+ MEM_freeN(gausstab);
}
- /* vertical */
- MEM_freeN(gausstab);
-
- rad = scale*(float)nbd->sizey;
- if(rad>imgy/2)
- rad= imgy/2;
- else if(rad<1)
- rad= 1;
-
- gausstab= make_gausstab(nbd->filtertype, rad);
- gausstabcent= gausstab+rad;
-
- bigstep = pix*imgx;
- for (x = 0; x < imgx; x++) {
- float *srcd= work->rect + pix*x;
-
- dest = new->rect + pix*x;
+ if(nbd->sizey == 0) {
+ memcpy(new->rect, work->rect, sizeof(float) * img->type * imgx * imgy);
+ }
+ else {
+ rad = scale*(float)nbd->sizey;
+ if(rad>imgy/2)
+ rad= imgy/2;
+ else if(rad<1)
+ rad= 1;
+
+ gausstab= make_gausstab(nbd->filtertype, rad);
+ gausstabcent= gausstab+rad;
- for (y = 0; y < imgy ; y++) {
- int minr= y-rad<0?-y:-rad;
- int maxr= y+rad>imgy?imgy-y:rad;
+ bigstep = pix*imgx;
+ for (x = 0; x < imgx; x++) {
+ float *srcd= work->rect + pix*x;
- src= srcd + bigstep*(y+minr);
+ dest = new->rect + pix*x;
- sum= gval = rval= bval= aval= 0.0f;
- for (i= minr; i < maxr; i++) {
- val= gausstabcent[i];
- sum+= val;
- rval += val * src[0];
+ for (y = 0; y < imgy ; y++) {
+ int minr= y-rad<0?-y:-rad;
+ int maxr= y+rad>imgy?imgy-y:rad;
+
+ src= srcd + bigstep*(y+minr);
+
+ sum= gval = rval= bval= aval= 0.0f;
+ for (i= minr; i < maxr; i++) {
+ val= gausstabcent[i];
+ sum+= val;
+ rval += val * src[0];
+ if(pix==4) {
+ gval += val * src[1];
+ bval += val * src[2];
+ aval += val * src[3];
+ }
+ src += bigstep;
+ }
+ sum= 1.0f/sum;
+ dest[0] = rval*sum;
if(pix==4) {
- gval += val * src[1];
- bval += val * src[2];
- aval += val * src[3];
+ dest[1] = gval*sum;
+ dest[2] = bval*sum;
+ dest[3] = aval*sum;
}
- src += bigstep;
+ dest+= bigstep;
}
- sum= 1.0f/sum;
- dest[0] = rval*sum;
- if(pix==4) {
- dest[1] = gval*sum;
- dest[2] = bval*sum;
- dest[3] = aval*sum;
- }
- dest+= bigstep;
+ if(node->exec & NODE_BREAK)
+ break;
}
- if(node->exec & NODE_BREAK)
- break;
+ MEM_freeN(gausstab);
}
-
+
free_compbuf(work);
- MEM_freeN(gausstab);
}
/* reference has to be mapped 0-1, and equal in size */
-static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, float fac, NodeBlurData *nbd)
+static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref), float UNUSED(fac), NodeBlurData *nbd)
{
CompBuf *wbuf;
register float val;
@@ -572,7 +582,11 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
nbd->sizey= (int)(nbd->percenty*nbd->image_in_height);
}
- if (((NodeBlurData *)node->storage)->filtertype == R_FILTER_FAST_GAUSS) {
+ if (nbd->sizex==0 && nbd->sizey==0) {
+ new= pass_on_compbuf(img);
+ out[0]->data= new;
+ }
+ else if (nbd->filtertype == R_FILTER_FAST_GAUSS) {
CompBuf *new, *img = in[0]->data;
/*from eeshlo's original patch, removed to fit in with the existing blur node */
/*const float sx = in[1]->vec[0], sy = in[2]->vec[0];*/
@@ -612,6 +626,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
/* if fac input, we do it different */
if(in[1]->data) {
+ CompBuf *gammabuf;
/* make output size of input image */
new= alloc_compbuf(img->x, img->y, img->type, 1); /* allocs */
@@ -620,7 +635,18 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
new->xof = img->xof;
new->yof = img->yof;
- blur_with_reference(node, new, img, in[1]->data);
+ if(nbd->gamma) {
+ gammabuf= dupalloc_compbuf(img);
+ gamma_correct_compbuf(gammabuf, 0);
+ }
+ else gammabuf= img;
+
+ blur_with_reference(node, new, gammabuf, in[1]->data);
+
+ if(nbd->gamma) {
+ gamma_correct_compbuf(new, 1);
+ free_compbuf(gammabuf);
+ }
if(node->exec & NODE_BREAK) {
free_compbuf(new);
new= NULL;
@@ -633,7 +659,6 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
new= pass_on_compbuf(img);
}
else {
- NodeBlurData *nbd= node->storage;
CompBuf *gammabuf;
/* make output size of input image */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c
index 03eed59a4c4..889d61fe4fa 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c
@@ -77,7 +77,7 @@ static void do_brightnesscontrast(bNode *node, float *out, float *in)
}
}
-static void node_composit_exec_brightcontrast(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
index ca7c19cc778..182c339132e 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_channel_matte_out[]={
{-1,0,""}
};
-static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in)
+static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float *in)
{
/*normalize to the range 0.0 to 1.0) */
rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
@@ -52,7 +52,7 @@ static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in)
out[3]=in[3];
}
-static void do_normalized_ycca_to_rgba2(bNode *node, float *out, float *in)
+static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *in)
{
/*un-normalize the normalize from above */
in[0]=in[0]*255.0;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
index e502129c3d3..d102afbbd16 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_chroma_out[]={
{-1,0,""}
};
-static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in)
+static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *in)
{
rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
@@ -62,7 +62,7 @@ static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in)
out[3]=in[3];
}
-static void do_ycca_to_rgba_normalized(bNode *node, float *out, float *in)
+static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in)
{
/*un-normalize the normalize from above */
in[0]=(in[0]+1.0)/2.0;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
index 3191ad757a0..408bda02ee4 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
@@ -182,7 +182,7 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma
}
}
-static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/*
Originally based on the information from the book "The Art and Science of Digital Composition" and
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
index 33f5680eaa9..c8e0108a5c8 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
@@ -120,7 +120,7 @@ static void do_colorbalance_lgg_fac(bNode *node, float* out, float *in, float *f
out[3] = in[3];
}
-static void node_composit_exec_colorbalance(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *cbuf= in[1]->data;
CompBuf *stackbuf;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c
index 7510a2d11d4..ffb090f3a94 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_composite_in[]= {
};
/* applies to render pipeline */
-static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
/* image assigned to output */
/* stack order input sockets: col, alpha, z */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
index dd5ce88bd36..7ecfe40f739 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_crop_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(in[0]->data) {
NodeTwoXYs *ntxy= node->storage;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
index e4afa1922bb..1a88e9541c6 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
@@ -38,7 +38,7 @@ static bNodeSocketType cmp_node_time_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
RenderData *rd= data;
/* stack order output: fac */
@@ -89,7 +89,7 @@ static bNodeSocketType cmp_node_curve_vec_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order input: vec */
/* stack order output: vec */
@@ -158,7 +158,7 @@ static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
out[3]= in[3];
}
-static void node_composit_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order input: fac, image, black level, white level */
/* stack order output: image */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
index a93a5760842..5c25bffa5d9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
@@ -791,7 +791,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
}
-static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *new, *old, *zbuf_use = NULL, *img = in[0]->data, *zbuf = in[1]->data;
NodeDefocus *nqd = node->storage;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c
index 6c67413ea1f..71990b7403a 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c
@@ -110,7 +110,7 @@ static void morpho_erode(CompBuf *cbuf)
}
-static void node_composit_exec_dilateerode(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: mask */
/* stack order out: mask */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c
index b0cf5559772..42bf48b9128 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c
@@ -102,7 +102,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap,
return img;
}
-static void node_composit_exec_dblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
NodeDBlurData *ndbd= node->storage;
CompBuf *new, *img= in[0]->data;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
index aa7fac81c2c..1ce545e2ca8 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
@@ -48,7 +48,7 @@ static bNodeSocketType cmp_node_displace_out[]= {
* in order to take effect */
#define DISPLACE_EPSILON 0.01
-static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *veccol, CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale)
+static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale)
{
ImBuf *ibuf;
int x, y;
@@ -60,7 +60,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
float vec[3], vecdx[3], vecdy[3];
float col[3];
- ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
+ ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
ibuf->rect_float= cbuf->rect;
for(y=0; y < stackbuf->y; y++) {
@@ -140,7 +140,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
}
-static void node_composit_exec_displace(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_displace(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c
index fbc570c4028..33a17f890d8 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_flip_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(in[0]->data) {
CompBuf *cbuf= in[0]->data;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c
index c0e524a3ae9..2e3162b0c30 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_gamma_out[]= {
{ -1, 0, "" }
};
-static void do_gamma(bNode *node, float *out, float *in, float *fac)
+static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac)
{
int i=0;
for(i=0; i<3; i++) {
@@ -51,7 +51,7 @@ static void do_gamma(bNode *node, float *out, float *in, float *fac)
}
out[3] = in[3];
}
-static void node_composit_exec_gamma(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: Fac, Image */
/* stack order out: Image */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
index 1d50acfdc26..d4968caee0f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
@@ -422,7 +422,7 @@ static void fglow(NodeGlare* ndg, CompBuf* dst, CompBuf* src)
//--------------------------------------------------------------------------------------------
-static void node_composit_exec_glare(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *new, *src, *img = in[0]->data;
NodeGlare* ndg = node->storage;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
index c274c580771..e8ce3e20f11 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
@@ -65,7 +65,7 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac)
}
}
-static void node_composit_exec_hue_sat(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: Fac, Image */
/* stack order out: Image */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
index 9eb79bb8c36..ac009ccb69d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
@@ -98,7 +98,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac)
out[3]= in[3];
}
-static void node_composit_exec_huecorrect(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *cbuf= in[1]->data;
CompBuf *stackbuf;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
index 9309d2939db..dcf9a059c83 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
@@ -77,25 +77,31 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
/* now we need a float buffer from the image
* with matching color management */
- if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
- if(ibuf->profile != IB_PROFILE_NONE) {
- rect= ibuf->rect_float;
+ if(ibuf->channels == 4) {
+ if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
+ if(ibuf->profile != IB_PROFILE_NONE) {
+ rect= ibuf->rect_float;
+ }
+ else {
+ rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+ srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
+ alloc= TRUE;
+ }
}
else {
- rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
- srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
- alloc= TRUE;
+ if(ibuf->profile == IB_PROFILE_NONE) {
+ rect= ibuf->rect_float;
+ }
+ else {
+ rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+ linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
+ alloc= TRUE;
+ }
}
}
else {
- if(ibuf->profile == IB_PROFILE_NONE) {
- rect= ibuf->rect_float;
- }
- else {
- rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
- linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
- alloc= TRUE;
- }
+ /* non-rgba passes can't use color profiles */
+ rect= ibuf->rect_float;
}
/* done coercing into the correct color management */
@@ -209,7 +215,7 @@ void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, I
};
-static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
/* image assigned to output */
@@ -372,7 +378,7 @@ void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out
out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT);
};
-static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
Scene *sce= (Scene *)node->id;
Render *re= (sce)? RE_GetRender(sce->id.name): NULL;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
index 08ae51975b9..7ea146c7d4d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
@@ -75,7 +75,7 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac)
QUATCOPY(out, col);
}
-static void node_composit_exec_invert(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: fac, Image, Image */
/* stack order out: Image */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
index fc9045caafd..b6e1fffcce8 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
@@ -147,7 +147,7 @@ static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb
}
-static void node_composit_exec_lensdist(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_lensdist(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *new, *img = in[0]->data;
NodeLensDist* nld = node->storage;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
index 91d1aa148b2..c605a661556 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
@@ -51,7 +51,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
int x, y, sx, sy, row= 3*stackbuf->x;
/* ibuf needed for sampling */
- ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
+ ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
ibuf->rect_float= cbuf->rect;
/* vars for efficient looping */
@@ -134,7 +134,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
}
-static void node_composit_exec_mapuv(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
index 357218ea937..92709025a84 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
@@ -52,7 +52,7 @@ static void do_map_value(bNode *node, float *out, float *src)
out[0]= texmap->max[0];
}
-static void node_composit_exec_map_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: valbuf */
/* stack order out: valbuf */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
index f663dc76b5c..98bbbf6c752 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
@@ -151,7 +151,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
}
}
-static void node_composit_exec_math(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *cbuf=in[0]->data;
CompBuf *cbuf2=in[1]->data;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c
index c57caf180ad..04162956ac3 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c
@@ -52,7 +52,7 @@ static void do_normal(bNode *node, float *out, float *in)
}
/* generates normal, does dot product */
-static void node_composit_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
/* stack order input: normal */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c
index 64855ba5cf3..07a11cdc997 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_normalize_out[]= {
{ -1, 0, "" }
};
-static void do_normalize(bNode *node, float *out, float *src, float *min, float *mult)
+static void do_normalize(bNode *UNUSED(node), float *out, float *src, float *min, float *mult)
{
float res;
res = (src[0] - min[0]) * mult[0];
@@ -58,7 +58,7 @@ static void do_normalize(bNode *node, float *out, float *src, float *min, float
/* The code below assumes all data is inside range +- this, and that input buffer is single channel */
#define BLENDER_ZMAX 10000.0f
-static void node_composit_exec_normalize(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: valbuf */
/* stack order out: valbuf */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
index 6f29548fcc3..85baa8c347a 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
@@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_output_file_in[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
/* image assigned to output */
/* stack order input sockets: col, alpha */
@@ -54,7 +54,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
return;
} else {
CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
- ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
+ ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
char string[256];
ibuf->rect_float= cbuf->rect;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c
index 5058fa51c11..1aa2e338f94 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c
@@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_premulkey_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_premulkey(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
return;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c
index 3b9b993d5f8..5fbed05ac8d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c
@@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_rgb_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
index ccb1d8abfd9..8fed6972c20 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_rotate_out[]= {
};
/* only supports RGBA nodes now */
-static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if(out[0]->hasoutput==0)
@@ -68,8 +68,8 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in,
maxy= -centy + (float)cbuf->y;
- ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
- obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0, 0);
+ ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
+ obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
if(ibuf && obuf){
ibuf->rect_float=cbuf->rect;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
index 9779875b01a..40785f3bc77 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
@@ -75,7 +75,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
newx= MIN2(newx, CMP_SCALE_MAX);
newy= MIN2(newy, CMP_SCALE_MAX);
- ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
+ ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
if(ibuf) {
ibuf->rect_float= cbuf->rect;
IMB_scaleImBuf(ibuf, newx, newy);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
index 0ac47c58ab3..ef8723fd4e9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
@@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sephsva_out[]= {
{ -1, 0, "" }
};
-static void do_sephsva(bNode *node, float *out, float *in)
+static void do_sephsva(bNode *UNUSED(node), float *out, float *in)
{
float h, s, v;
@@ -55,7 +55,7 @@ static void do_sephsva(bNode *node, float *out, float *in)
out[3]= in[3];
}
-static void node_composit_exec_sephsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw channels */
/* stack order in: col */
@@ -127,7 +127,7 @@ static bNodeSocketType cmp_node_combhsva_out[]= {
{ -1, 0, "" }
};
-static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4)
+static void do_comb_hsva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
float r,g,b;
hsv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b);
@@ -138,7 +138,7 @@ static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float
out[3] = in4[0];
}
-static void node_composit_exec_combhsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: 1 rgba channels */
/* stack order in: 4 value channels */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
index c5a57f8a175..36603785bb3 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
@@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_seprgba_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_seprgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw channels */
/* stack order in: col */
@@ -106,7 +106,7 @@ static bNodeSocketType cmp_node_combrgba_out[]= {
{ -1, 0, "" }
};
-static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4)
+static void do_combrgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
out[0] = in1[0];
out[1] = in2[0];
@@ -114,7 +114,7 @@ static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float *
out[3] = in4[0];
}
-static void node_composit_exec_combrgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: 1 rgba channels */
/* stack order in: 4 value channels */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
index 7b3dfccab50..4b164729bbc 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
@@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepycca_out[]= {
{ -1, 0, "" }
};
-static void do_sepycca(bNode *node, float *out, float *in)
+static void do_sepycca(bNode *UNUSED(node), float *out, float *in)
{
float y, cb, cr;
@@ -56,7 +56,7 @@ static void do_sepycca(bNode *node, float *out, float *in)
out[3]= in[3];
}
-static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* input no image? then only color operation */
if(in[0]->data==NULL) {
@@ -126,7 +126,7 @@ static bNodeSocketType cmp_node_combycca_out[]= {
{ -1, 0, "" }
};
-static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4)
+static void do_comb_ycca(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
float r,g,b;
float y, cb, cr;
@@ -144,7 +144,7 @@ static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float
out[3] = in4[0];
}
-static void node_composit_exec_combycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: 1 ycca channels */
/* stack order in: 4 value channels */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
index 13b71026054..333a4a2596e 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
@@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepyuva_out[]= {
{ -1, 0, "" }
};
-static void do_sepyuva(bNode *node, float *out, float *in)
+static void do_sepyuva(bNode *UNUSED(node), float *out, float *in)
{
float y, u, v;
@@ -55,7 +55,7 @@ static void do_sepyuva(bNode *node, float *out, float *in)
out[3]= in[3];
}
-static void node_composit_exec_sepyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw channels */
/* stack order in: col */
@@ -127,7 +127,7 @@ static bNodeSocketType cmp_node_combyuva_out[]= {
{ -1, 0, "" }
};
-static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4)
+static void do_comb_yuva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
float r,g,b;
yuv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b);
@@ -138,7 +138,7 @@ static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float
out[3] = in4[0];
}
-static void node_composit_exec_combyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: 1 rgba channels */
/* stack order in: 4 value channels */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c
index a7d10017c1f..f4c5603ce49 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c
@@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_setalpha_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_setalpha(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: RGBA image */
/* stack order in: col, alpha */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
index 98bda1bd7fa..efb8c12fa84 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
@@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_splitviewer_in[]= {
{ -1, 0, "" }
};
-static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2, float *fac)
+static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac)
{
if(*fac==0.0f) {
QUATCOPY(out, in1);
@@ -46,7 +46,7 @@ static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2,
}
}
-static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
/* image assigned to output */
/* stack order input sockets: image image */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
index 12f0c171f94..49031e1625a 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
@@ -123,7 +123,7 @@ static void tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src)
}
-static void node_composit_exec_tonemap(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *new, *img = in[0]->data;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c
index ca359d436f6..0d8ad41d2dd 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c
@@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_translate_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_translate(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
if(in[0]->data) {
CompBuf *cbuf= in[0]->data;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
index 6ce03f38cdb..7e0ecbcb888 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
@@ -46,7 +46,7 @@ static void do_colorband_composit(bNode *node, float *out, float *in)
do_colorband(node->storage, in[0], out);
}
-static void node_composit_exec_valtorgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: fac */
/* stack order out: col, alpha */
@@ -109,12 +109,12 @@ static bNodeSocketType cmp_node_rgbtobw_out[]= {
{ -1, 0, "" }
};
-static void do_rgbtobw(bNode *node, float *out, float *in)
+static void do_rgbtobw(bNode *UNUSED(node), float *out, float *in)
{
out[0]= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f;
}
-static void node_composit_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw */
/* stack order in: col */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_value.c b/source/blender/nodes/intern/CMP_nodes/CMP_value.c
index 14a3b6fe15c..a37742c77e9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_value.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_value.c
@@ -35,7 +35,7 @@ static bNodeSocketType cmp_node_value_out[]= {
{ -1, 0, "" }
};
-static void node_composit_exec_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
index eaeeadd02af..9ea626e39d6 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
@@ -44,7 +44,7 @@ static bNodeSocketType cmp_node_vecblur_out[]= {
-static void node_composit_exec_vecblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
NodeBlurData *nbd= node->storage;
CompBuf *new, *img= in[0]->data, *vecbuf= in[2]->data, *zbuf= in[1]->data;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
index 80200ad9ce6..24d8a9eb09e 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
@@ -39,7 +39,7 @@ static bNodeSocketType cmp_node_viewer_in[]= {
};
-static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
/* image assigned to output */
/* stack order input sockets: col, alpha, z */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
index 7be9f34f00b..80989feaf26 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
@@ -67,7 +67,7 @@ static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2)
}
}
-static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, float *acol)
+static void do_zcombine_add(bNode *UNUSED(node), float *out, float *col1, float *col2, float *acol)
{
float alpha= *acol;
float malpha= 1.0f - alpha;
diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/intern/CMP_util.c
index 9edcc8b0eec..c762d8cb42d 100644
--- a/source/blender/nodes/intern/CMP_util.c
+++ b/source/blender/nodes/intern/CMP_util.c
@@ -662,59 +662,59 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
}
}
-void do_rgba_to_yuva(bNode *node, float *out, float *in)
+void do_rgba_to_yuva(bNode *UNUSED(node), float *out, float *in)
{
rgb_to_yuv(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
out[3]=in[3];
}
-void do_rgba_to_hsva(bNode *node, float *out, float *in)
+void do_rgba_to_hsva(bNode *UNUSED(node), float *out, float *in)
{
rgb_to_hsv(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
out[3]=in[3];
}
-void do_rgba_to_ycca(bNode *node, float *out, float *in)
+void do_rgba_to_ycca(bNode *UNUSED(node), float *out, float *in)
{
rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
out[3]=in[3];
}
-void do_yuva_to_rgba(bNode *node, float *out, float *in)
+void do_yuva_to_rgba(bNode *UNUSED(node), float *out, float *in)
{
yuv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
out[3]=in[3];
}
-void do_hsva_to_rgba(bNode *node, float *out, float *in)
+void do_hsva_to_rgba(bNode *UNUSED(node), float *out, float *in)
{
hsv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
out[3]=in[3];
}
-void do_ycca_to_rgba(bNode *node, float *out, float *in)
+void do_ycca_to_rgba(bNode *UNUSED(node), float *out, float *in)
{
ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
out[3]=in[3];
}
-void do_copy_rgba(bNode *node, float *out, float *in)
+void do_copy_rgba(bNode *UNUSED(node), float *out, float *in)
{
QUATCOPY(out, in);
}
-void do_copy_rgb(bNode *node, float *out, float *in)
+void do_copy_rgb(bNode *UNUSED(node), float *out, float *in)
{
VECCOPY(out, in);
out[3]= 1.0f;
}
-void do_copy_value(bNode *node, float *out, float *in)
+void do_copy_value(bNode *UNUSED(node), float *out, float *in)
{
out[0]= in[0];
}
-void do_copy_a_rgba(bNode *node, float *out, float *in, float *fac)
+void do_copy_a_rgba(bNode *UNUSED(node), float *out, float *in, float *fac)
{
VECCOPY(out, in);
out[3]= *fac;
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c
index d89099955aa..869b1d1e54c 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c
@@ -38,7 +38,7 @@ static bNodeSocketType sh_node_camera_out[]= {
};
-static void node_shader_exec_camera(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **out)
{
if(data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi; /* Data we need for shading. */
@@ -49,7 +49,7 @@ static void node_shader_exec_camera(void *data, bNode *node, bNodeStack **in, bN
}
}
-static int gpu_shader_camera(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_camera(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{
return GPU_stack_link(mat, "camera", in, out, GPU_builtin(GPU_VIEW_POSITION));
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c
index 4e47e75993d..56aaa4fe8a7 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c
@@ -42,7 +42,7 @@ static bNodeSocketType sh_node_curve_vec_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
float vec[3];
@@ -97,7 +97,7 @@ static bNodeSocketType sh_node_curve_rgb_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
float vec[3];
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
index aefe7d104b5..a27918df275 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
@@ -47,7 +47,7 @@ static bNodeSocketType sh_node_geom_out[]= {
};
/* node execute callback */
-static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
if(data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi;
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
index 4f319f8937c..5c95577e32d 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
@@ -45,7 +45,7 @@ static bNodeSocketType sh_node_hue_sat_out[]= {
};
/* note: it would be possible to use CMP version for both nodes */
-static void do_hue_sat_fac(bNode *node, float *out, float *hue, float *sat, float *val, float *in, float *fac)
+static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac)
{
if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0 || *val!=1.0)) {
float col[3], hsv[3], mfac= 1.0f - *fac;
@@ -66,13 +66,13 @@ static void do_hue_sat_fac(bNode *node, float *out, float *hue, float *sat, floa
}
}
-static void node_shader_exec_hue_sat(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
do_hue_sat_fac(node, out[0]->vec, in[0]->vec, in[1]->vec, in[2]->vec, in[4]->vec, in[3]->vec);
}
-static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{
return GPU_stack_link(mat, "hue_sat", in, out);
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c
index 08666f4dd52..73fccf7cd0b 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c
@@ -43,7 +43,7 @@ static bNodeSocketType sh_node_invert_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_invert(void *data, bNode *node, bNodeStack **in,
+static void node_shader_exec_invert(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in,
bNodeStack **out)
{
float col[3], facm;
@@ -64,7 +64,7 @@ bNodeStack **out)
VECCOPY(out[0]->vec, col);
}
-static int gpu_shader_invert(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_invert(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{
return GPU_stack_link(mat, "invert", in, out);
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
index 49778625446..f01ed3d7ab8 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
@@ -41,7 +41,7 @@ static bNodeSocketType sh_node_mapping_out[]= {
};
/* do the regular mapping options for blender textures */
-static void node_shader_exec_mapping(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
TexMapping *texmap= node->storage;
float *vec= out[0]->vec;
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c
index 7429c084ab3..40a2e53c665 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c
@@ -43,7 +43,7 @@ static bNodeSocketType sh_node_math_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_math(void *data, bNode *node, bNodeStack **in,
+static void node_shader_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in,
bNodeStack **out)
{
switch(node->custom1){
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
index bc4342e11e3..56d863f002a 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
@@ -42,7 +42,7 @@ static bNodeSocketType sh_node_mix_rgb_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_mix_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: fac, col1, col2 */
/* stack order out: col */
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c
index eb3786286ae..8054f184cea 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c
@@ -42,7 +42,7 @@ static bNodeSocketType sh_node_normal_out[]= {
};
/* generates normal, does dot product */
-static void node_shader_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
float vec[3];
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_output.c b/source/blender/nodes/intern/SHD_nodes/SHD_output.c
index 740639b6ab4..4395716e599 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_output.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_output.c
@@ -36,7 +36,7 @@ static bNodeSocketType sh_node_output_in[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
if(data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi;
@@ -62,7 +62,7 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN
}
}
-static int gpu_shader_output(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{
GPUNodeLink *outlink;
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c
index 71af58beb67..600518962ab 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c
@@ -35,7 +35,7 @@ static bNodeSocketType sh_node_rgb_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c
index 883cd4d3bf4..1de200c7b1c 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c
@@ -41,14 +41,14 @@ static bNodeSocketType sh_node_seprgb_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_seprgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_seprgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
out[0]->vec[0] = in[0]->vec[0];
out[1]->vec[0] = in[0]->vec[1];
out[2]->vec[0] = in[0]->vec[2];
}
-static int gpu_shader_seprgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_seprgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{
return GPU_stack_link(mat, "separate_rgb", in, out);
}
@@ -85,14 +85,14 @@ static bNodeSocketType sh_node_combrgb_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_combrgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_combrgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
out[0]->vec[0] = in[0]->vec[0];
out[0]->vec[1] = in[1]->vec[0];
out[0]->vec[2] = in[2]->vec[0];
}
-static int gpu_shader_combrgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_combrgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{
return GPU_stack_link(mat, "combine_rgb", in, out);
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c
index 926dcd0f046..06b06affaa0 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c
@@ -42,7 +42,7 @@ static bNodeSocketType sh_node_squeeze_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_squeeze(void *data, bNode *node, bNodeStack **in,
+static void node_shader_exec_squeeze(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in,
bNodeStack **out)
{
float vec[3];
@@ -54,7 +54,7 @@ bNodeStack **out)
out[0]->vec[0] = 1.0f / (1.0f + pow(2.71828183,-((vec[0]-vec[2])*vec[1]))) ;
}
-static int gpu_shader_squeeze(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_squeeze(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{
return GPU_stack_link(mat, "squeeze", in, out);
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
index e2260461152..1e5b9cf935e 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
@@ -40,7 +40,7 @@ static bNodeSocketType sh_node_valtorgb_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_valtorgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: fac */
/* stack order out: col, alpha */
@@ -98,7 +98,7 @@ static bNodeSocketType sh_node_rgbtobw_out[]= {
};
-static void node_shader_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_rgbtobw(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw */
/* stack order in: col */
@@ -106,7 +106,7 @@ static void node_shader_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, b
out[0]->vec[0]= in[0]->vec[0]*0.35f + in[0]->vec[1]*0.45f + in[0]->vec[2]*0.2f;
}
-static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
+static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{
return GPU_stack_link(mat, "rgbtobw", in, out);
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_value.c b/source/blender/nodes/intern/SHD_nodes/SHD_value.c
index 1663ea352aa..f78480bd794 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_value.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_value.c
@@ -35,7 +35,7 @@ static bNodeSocketType sh_node_value_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
index 062c6402fb6..dbdb04c2a6a 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
@@ -44,7 +44,7 @@ static bNodeSocketType sh_node_vect_math_out[]= {
{ -1, 0, "" }
};
-static void node_shader_exec_vect_math(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
float vec1[3], vec2[3];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_at.c b/source/blender/nodes/intern/TEX_nodes/TEX_at.c
index 08c1c65792d..1ca293acb5b 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_at.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_at.c
@@ -38,7 +38,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
TexParams np = *p;
float new_co[3];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
index 4155cec4d7f..64b70455a19 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
@@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
float x = p->co[0];
float y = p->co[1];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c
index 7319a50b7d9..f05e1e987da 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c
@@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
int i;
for(i = 0; i < 4; i++)
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c
index 68e892ce77c..4ad32bc872e 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c
@@ -33,7 +33,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void vectorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void vectorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **UNUSED(in), short UNUSED(thread))
{
out[0] = p->co[0];
out[1] = p->co[1];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
index 49a1ef35fbb..0fca0aa30ad 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
@@ -36,7 +36,7 @@ static bNodeSocketType time_outputs[]= {
{ -1, 0, "" }
};
-static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread))
{
/* stack order output: fac */
float fac= 0.0f;
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c
index f031091e08d..13768aaa868 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c
@@ -41,25 +41,25 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void valuefn_r(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void valuefn_r(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
tex_input_rgba(out, in[0], p, thread);
*out = out[0];
}
-static void valuefn_g(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void valuefn_g(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
tex_input_rgba(out, in[0], p, thread);
*out = out[1];
}
-static void valuefn_b(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void valuefn_b(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
tex_input_rgba(out, in[0], p, thread);
*out = out[2];
}
-static void valuefn_a(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void valuefn_a(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
tex_input_rgba(out, in[0], p, thread);
*out = out[3];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
index e0fee3e3153..5d624205f43 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
@@ -41,7 +41,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
float co1[3], co2[3];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
index 367ea7b9e5f..2ccde083823 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
@@ -42,7 +42,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void do_hue_sat_fac(bNode *node, float *out, float hue, float sat, float val, float *in, float fac)
+static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, float *in, float fac)
{
if(fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) {
float col[3], hsv[3], mfac= 1.0f - fac;
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_image.c b/source/blender/nodes/intern/TEX_nodes/TEX_image.c
index 628d9026db1..c764c7a22d2 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_image.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_image.c
@@ -34,7 +34,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread))
{
float x = p->co[0];
float y = p->co[1];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c
index 1619ed73023..421082aeb34 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c
@@ -39,7 +39,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
float col[4];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/intern/TEX_nodes/TEX_output.c
index 09bc893cc1f..26733a94180 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_output.c
@@ -36,7 +36,7 @@ static bNodeSocketType inputs[]= {
};
/* applies to render pipeline */
-static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
TexCallData *cdata = (TexCallData *)data;
TexResult *target = cdata->target;
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
index 3e7ef0e94fe..a4a608e777c 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
@@ -111,7 +111,7 @@ static int count_outputs(bNode *node)
/* Boilerplate generators */
#define ProcNoInputs(name) \
- static void name##_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread) \
+ static void name##_map_inputs(Tex *UNUSED(tex), bNodeStack **UNUSED(in), TexParams *UNUSED(p), short UNUSED(thread)) \
{}
#define ProcDef(name) \
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
index 9a855938eef..88ed5382a6a 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
@@ -64,7 +64,7 @@ static void rotate(float new_co[3], float a, float ax[3], float co[3])
new_co[2] = para[2] + perp[2] + cp[2];
}
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
float new_co[3], new_dxt[3], new_dyt[3], a, ax[3];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c
index 721c322c540..8045c1ca07a 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c
@@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
float scale[3], new_co[3], new_dxt[3], new_dyt[3];
TexParams np = *p;
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c
index a823338faf9..a9d7fbcf3da 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c
@@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
float offset[3], new_co[3];
TexParams np = *p;
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c
index 46aefe5ad47..c71d442cef3 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c
@@ -39,7 +39,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void normalfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void normalfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
float new_co[3];
float *co = p->co;
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
index 3810167a58a..fcaa9550efa 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
@@ -87,7 +87,7 @@ static bNodeSocketType rgbtobw_out[]= {
};
-static void rgbtobw_valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void rgbtobw_valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
float cin[4];
tex_input_rgba(cin, in[0], p, thread);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
index 698c894a8d8..75fe6945261 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
@@ -37,7 +37,7 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
TexCallData *cdata = (TexCallData *)data;
diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/intern/TEX_util.c
index dc31685827f..4f085c84eda 100644
--- a/source/blender/nodes/intern/TEX_util.c
+++ b/source/blender/nodes/intern/TEX_util.c
@@ -173,7 +173,7 @@ int ntreeTexExecTree(
float *dxt, float *dyt,
int osatex,
short thread,
- Tex *tex,
+ Tex *UNUSED(tex),
short which_output,
int cfra,
int preview,
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index 9d865b1c63e..c64be00093c 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -24,6 +24,7 @@
*/
#include "BKE_idprop.h"
+#include "BKE_utildefines.h"
#include "IDProp.h"
#include "MEM_guardedalloc.h"
@@ -177,12 +178,12 @@ int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value)
return 0;
}
-PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *bleh)
+PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *UNUSED(closure))
{
return PyUnicode_FromString(self->prop->name);
}
-static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh)
+static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUSED(closure))
{
char *st;
if (!PyUnicode_Check(value)) {
@@ -860,7 +861,7 @@ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent)
static PyObject *IDArray_repr(BPy_IDArray *self)
{
- return PyUnicode_FromString("(ID Array)");
+ return PyUnicode_FromFormat("(ID Array [%d])", self->prop->len);
}
@@ -1071,7 +1072,7 @@ static PyObject *IDGroup_Iter_iterself(PyObject *self)
static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
{
- return PyUnicode_FromString("(ID Property Group)");
+ return PyUnicode_FromFormat("(ID Property Group Iter \"%s\")", self->group->prop->name);
}
static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 8ac2107f8d2..86b7bc522fe 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -35,6 +35,8 @@
#include <GL/glew.h>
#include "MEM_guardedalloc.h"
+#include "BKE_utildefines.h"
+
static char Method_Buffer_doc[] =
"(type, dimensions, [template]) - Create a new Buffer object\n\n\
(type) - The format to store data in\n\
@@ -51,7 +53,7 @@ For example, passing [100, 100] will create a 2 dimensional\n\
square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\
buffer which is twice as deep as it is wide or high.";
-static PyObject *Method_Buffer( PyObject * self, PyObject * args );
+static PyObject *Method_Buffer( PyObject * self, PyObject *args );
/* Buffer sequence methods */
@@ -99,7 +101,7 @@ PyTypeObject BGL_bufferType = {
/* #ifndef __APPLE__ */
#define BGL_Wrap(nargs, funcname, ret, arg_list) \
-static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
+static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\
arg_def##nargs arg_list; \
ret_def_##ret; \
if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
@@ -108,7 +110,7 @@ static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
}
#define BGLU_Wrap(nargs, funcname, ret, arg_list) \
-static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
+static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\
arg_def##nargs arg_list; \
ret_def_##ret; \
if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
@@ -181,7 +183,7 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf
}
#define MAX_DIMENSIONS 256
-static PyObject *Method_Buffer (PyObject *self, PyObject *args)
+static PyObject *Method_Buffer (PyObject *UNUSED(self), PyObject *args)
{
PyObject *length_ob= NULL, *template= NULL;
Buffer *buffer;
diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c
index a5f5f8815c7..66d8cdd923a 100644
--- a/source/blender/python/generic/blf_api.c
+++ b/source/blender/python/generic/blf_api.c
@@ -26,6 +26,7 @@
#include "blf_api.h"
#include "../../blenfont/BLF_api.h"
+#include "BKE_utildefines.h"
static char py_blf_position_doc[] =
".. function:: position(fontid, x, y, z)\n"
@@ -41,7 +42,7 @@ static char py_blf_position_doc[] =
" :arg z: Z axis position to draw the text.\n"
" :type z: float\n";
-static PyObject *py_blf_position(PyObject *self, PyObject *args)
+static PyObject *py_blf_position(PyObject *UNUSED(self), PyObject *args)
{
int fontid;
float x, y, z;
@@ -67,7 +68,7 @@ static char py_blf_size_doc[] =
" :arg dpi: dots per inch value to use for drawing.\n"
" :type dpi: int\n";
-static PyObject *py_blf_size(PyObject *self, PyObject *args)
+static PyObject *py_blf_size(PyObject *UNUSED(self), PyObject *args)
{
int fontid, size, dpi;
@@ -90,7 +91,7 @@ static char py_blf_aspect_doc[] =
" :arg aspect: The aspect ratio for text drawing to use.\n"
" :type aspect: float\n";
-static PyObject *py_blf_aspect(PyObject *self, PyObject *args)
+static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
{
float aspect;
int fontid;
@@ -114,7 +115,7 @@ static char py_blf_blur_doc[] =
" :arg radius: The radius for blurring text (in pixels).\n"
" :type radius: int\n";
-static PyObject *py_blf_blur(PyObject *self, PyObject *args)
+static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args)
{
int blur, fontid;
@@ -137,7 +138,7 @@ static char py_blf_draw_doc[] =
" :arg text: the text to draw.\n"
" :type text: string\n";
-static PyObject *py_blf_draw(PyObject *self, PyObject *args)
+static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args)
{
char *text;
int fontid;
@@ -162,7 +163,7 @@ static char py_blf_dimensions_doc[] =
" :return: the width and height of the text.\n"
" :rtype: tuple of 2 floats\n";
-static PyObject *py_blf_dimensions(PyObject *self, PyObject *args)
+static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
{
char *text;
float r_width, r_height;
@@ -196,7 +197,7 @@ static char py_blf_clipping_doc[] =
" :arg ymax: Clip the drawing area by these bounds.\n"
" :type ymax: float\n";
-static PyObject *py_blf_clipping(PyObject *self, PyObject *args)
+static PyObject *py_blf_clipping(PyObject *UNUSED(self), PyObject *args)
{
float xmin, ymin, xmax, ymax;
int fontid;
@@ -219,7 +220,7 @@ static char py_blf_disable_doc[] =
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
" :type option: int\n";
-static PyObject *py_blf_disable(PyObject *self, PyObject *args)
+static PyObject *py_blf_disable(PyObject *UNUSED(self), PyObject *args)
{
int option, fontid;
@@ -241,7 +242,7 @@ static char py_blf_enable_doc[] =
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
" :type option: int\n";
-static PyObject *py_blf_enable(PyObject *self, PyObject *args)
+static PyObject *py_blf_enable(PyObject *UNUSED(self), PyObject *args)
{
int option, fontid;
@@ -263,7 +264,7 @@ static char py_blf_rotation_doc[] =
" :arg angle: The angle for text drawing to use.\n"
" :type angle: float\n";
-static PyObject *py_blf_rotation(PyObject *self, PyObject *args)
+static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
{
float angle;
int fontid;
@@ -294,7 +295,7 @@ static char py_blf_shadow_doc[] =
" :arg a: Shadow color (alpha channel 0.0 - 1.0).\n"
" :type a: float\n";
-static PyObject *py_blf_shadow(PyObject *self, PyObject *args)
+static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
{
int level, fontid;
float r, g, b, a;
@@ -324,7 +325,7 @@ static char py_blf_shadow_offset_doc[] =
" :arg y: Horizontal shadow offset value in pixels.\n"
" :type y: float\n";
-static PyObject *py_blf_shadow_offset(PyObject *self, PyObject *args)
+static PyObject *py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args)
{
int x, y, fontid;
@@ -346,7 +347,7 @@ static char py_blf_load_doc[] =
" :return: the new font's fontid or -1 if there was an error.\n"
" :rtype: integer\n";
-static PyObject *py_blf_load(PyObject *self, PyObject *args)
+static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
{
char* filename;
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 394c388394a..3ee0c76a44a 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -30,9 +30,10 @@
#include "DNA_text_types.h"
#include "MEM_guardedalloc.h"
+#include "BKE_utildefines.h" /* UNUSED */
#include "BKE_text.h" /* txt_to_buf */
#include "BKE_main.h"
-#include "BKE_global.h" /* grr, only for G.sce */
+#include "BKE_global.h" /* grr, only for G.main->name */
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
@@ -61,7 +62,7 @@ void bpy_import_main_set(struct Main *maggie)
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
void bpy_text_filename_get(char *fn, Text *text)
{
- sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2);
+ sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.main->name, text->id.name+2);
/* XXX, this is a bug in python's Py_CompileString()!
the string encoding should not be required to be utf-8
@@ -191,24 +192,24 @@ PyObject *bpy_text_reimport( PyObject *module, int *found )
}
-static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * kw)
+static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw)
{
PyObject *exception, *err, *tb;
char *name;
int found= 0;
PyObject *globals = NULL, *locals = NULL, *fromlist = NULL;
- PyObject *newmodule;
+ int level= -1; /* relative imports */
+ PyObject *newmodule;
//PyObject_Print(args, stderr, 0);
- int dummy_val; /* what does this do?*/
static char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", 0};
if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOOi:bpy_import_meth", kwlist,
- &name, &globals, &locals, &fromlist, &dummy_val) )
+ &name, &globals, &locals, &fromlist, &level) )
return NULL;
/* import existing builtin modules or modules that have been imported already */
- newmodule = PyImport_ImportModuleEx( name, globals, locals, fromlist );
+ newmodule= PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
if(newmodule)
return newmodule;
@@ -244,7 +245,7 @@ static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * k
* our reload() module, to handle reloading in-memory scripts
*/
-static PyObject *blender_reload( PyObject * self, PyObject * module )
+static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module)
{
PyObject *exception, *err, *tb;
PyObject *newmodule = NULL;
diff --git a/source/blender/python/generic/geometry.c b/source/blender/python/generic/geometry.c
index 0e98760314d..e0583cc0028 100644
--- a/source/blender/python/generic/geometry.c
+++ b/source/blender/python/generic/geometry.c
@@ -60,7 +60,7 @@ static char M_Geometry_BezierInterp_doc[] = "";
//---------------------------------INTERSECTION FUNCTIONS--------------------
//----------------------------------geometry.Intersect() -------------------
-static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_Intersect(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *ray, *ray_off, *vec1, *vec2, *vec3;
float dir[3], orig[3], v1[3], v2[3], v3[3], e1[3], e2[3], pvec[3], tvec[3], qvec[3];
@@ -133,7 +133,7 @@ static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args )
}
//----------------------------------geometry.LineIntersect() -------------------
/* Line-Line intersection using algorithm from mathworld.wolfram.com */
-static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_LineIntersect(PyObject *UNUSED(self), PyObject* args)
{
PyObject * tuple;
VectorObject *vec1, *vec2, *vec3, *vec4;
@@ -201,7 +201,7 @@ static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args )
//---------------------------------NORMALS FUNCTIONS--------------------
//----------------------------------geometry.QuadNormal() -------------------
-static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_QuadNormal(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1;
VectorObject *vec2;
@@ -252,7 +252,7 @@ static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args )
}
//----------------------------geometry.TriangleNormal() -------------------
-static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_TriangleNormal(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1, *vec2, *vec3;
float v1[3], v2[3], v3[3], e1[3], e2[3], n[3];
@@ -289,7 +289,7 @@ static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args )
//--------------------------------- AREA FUNCTIONS--------------------
//----------------------------------geometry.TriangleArea() -------------------
-static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_TriangleArea(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1, *vec2, *vec3;
float v1[3], v2[3], v3[3];
@@ -335,7 +335,7 @@ static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args )
/*----------------------------------geometry.PolyFill() -------------------*/
/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */
-static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq )
+static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLineSeq )
{
PyObject *tri_list; /*return this list of tri's */
PyObject *polyLine, *polyVec;
@@ -450,7 +450,7 @@ static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq )
}
-static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_LineIntersect2D(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *line_a1, *line_a2, *line_b1, *line_b2;
float a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y, xi, yi, a1,a2,b1,b2, newvec[2];
@@ -548,7 +548,7 @@ static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args )
Py_RETURN_NONE;
}
-static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_ClosestPointOnLine(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt, *line_1, *line_2;
float pt_in[3], pt_out[3], l1[3], l2[3];
@@ -586,7 +586,7 @@ static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args
return ret;
}
-static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_PointInTriangle2D(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3;
@@ -606,7 +606,7 @@ static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args
return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec));
}
-static PyObject *M_Geometry_PointInQuad2D( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_PointInQuad2D(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4;
@@ -690,7 +690,7 @@ static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
}
-static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist )
+static PyObject *M_Geometry_BoxPack2D(PyObject *UNUSED(self), PyObject * boxlist )
{
boxPack *boxarray = NULL;
float tot_width, tot_height;
@@ -718,7 +718,7 @@ static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist )
return Py_BuildValue( "ff", tot_width, tot_height);
}
-static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_BezierInterp(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2;
int resolu;
@@ -767,7 +767,7 @@ static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args )
return list;
}
-static PyObject *M_Geometry_BarycentricTransform(PyObject * self, PyObject * args)
+static PyObject *M_Geometry_BarycentricTransform(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *vec_pt;
VectorObject *vec_t1_tar, *vec_t2_tar, *vec_t3_tar;
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c
index e81bc0cf239..c1f24e413c8 100644
--- a/source/blender/python/generic/mathutils.c
+++ b/source/blender/python/generic/mathutils.c
@@ -61,6 +61,8 @@
#include "BLI_math.h"
+#include "BKE_utildefines.h"
+
//-------------------------DOC STRINGS ---------------------------
static char M_Mathutils_doc[] =
"This module provides access to matrices, eulers, quaternions and vectors.";
@@ -203,7 +205,7 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index)
/* BaseMathObject generic functions for all mathutils types */
char BaseMathObject_Owner_doc[] = "The item this is wrapping or None (readonly).";
-PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type )
+PyObject *BaseMathObject_getOwner(BaseMathObject *self, void *UNUSED(closure))
{
PyObject *ret= self->cb_user ? self->cb_user : Py_None;
Py_INCREF(ret);
@@ -211,7 +213,7 @@ PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type )
}
char BaseMathObject_Wrapped_doc[] = "True when this object wraps external data (readonly).\n\n:type: boolean";
-PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void *type )
+PyObject *BaseMathObject_getWrapped(BaseMathObject *self, void *UNUSED(closure))
{
return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0);
}
diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c
index 57d2838238c..26af8a38f6d 100644
--- a/source/blender/python/generic/mathutils_color.c
+++ b/source/blender/python/generic/mathutils_color.c
@@ -31,10 +31,15 @@
//----------------------------------mathutils.Color() -------------------
//makes a new color for you to play with
-static PyObject *Color_new(PyTypeObject * type, PyObject * args, PyObject * kwargs)
+static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
float col[3]= {0.0f, 0.0f, 0.0f};
+ if(kwds && PyDict_Size(kwds)) {
+ PyErr_SetString(PyExc_TypeError, "mathutils.Color(): takes no keyword args");
+ return NULL;
+ }
+
switch(PyTuple_GET_SIZE(args)) {
case 0:
break;
@@ -83,7 +88,7 @@ static char Color_copy_doc[] =
"\n"
" .. note:: use this to get a copy of a wrapped color with no reference to the original data.\n";
-static PyObject *Color_copy(ColorObject * self, PyObject *args)
+static PyObject *Color_copy(ColorObject *self)
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -158,7 +163,7 @@ static PyObject* Color_richcmpr(PyObject *objectA, PyObject *objectB, int compar
//---------------------SEQUENCE PROTOCOLS------------------------
//----------------------------len(object)------------------------
//sequence length
-static int Color_len(ColorObject * self)
+static int Color_len(ColorObject *UNUSED(self))
{
return COLOR_SIZE;
}
@@ -394,7 +399,7 @@ static int Color_setChannelHSV(ColorObject * self, PyObject * value, void * type
}
/* color channel (HSV), color.h/s/v */
-static PyObject *Color_getHSV(ColorObject * self, void *type)
+static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure))
{
float hsv[3];
PyObject *ret;
@@ -411,7 +416,7 @@ static PyObject *Color_getHSV(ColorObject * self, void *type)
return ret;
}
-static int Color_setHSV(ColorObject * self, PyObject * value, void * type)
+static int Color_setHSV(ColorObject * self, PyObject * value, void *UNUSED(closure))
{
float hsv[3];
@@ -452,8 +457,8 @@ static PyGetSetDef Color_getseters[] = {
//-----------------------METHOD DEFINITIONS ----------------------
static struct PyMethodDef Color_methods[] = {
- {"__copy__", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc},
- {"copy", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc},
+ {"__copy__", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc},
+ {"copy", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c
index f85578dd31d..c7091347493 100644
--- a/source/blender/python/generic/mathutils_euler.c
+++ b/source/blender/python/generic/mathutils_euler.c
@@ -39,7 +39,7 @@
//----------------------------------mathutils.Euler() -------------------
//makes a new euler for you to play with
-static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwargs)
+static PyObject *Euler_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
PyObject *seq= NULL;
char *order_str= NULL;
@@ -47,6 +47,11 @@ static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwar
float eul[EULER_SIZE]= {0.0f, 0.0f, 0.0f};
short order= EULER_ORDER_XYZ;
+ if(kwds && PyDict_Size(kwds)) {
+ PyErr_SetString(PyExc_TypeError, "mathutils.Euler(): takes no keyword args");
+ return NULL;
+ }
+
if(!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str))
return NULL;
@@ -313,7 +318,7 @@ static char Euler_copy_doc[] =
"\n"
" .. note:: use this to get a copy of a wrapped euler with no reference to the original data.\n";
-static PyObject *Euler_copy(EulerObject * self, PyObject *args)
+static PyObject *Euler_copy(EulerObject *self)
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -388,7 +393,7 @@ static PyObject* Euler_richcmpr(PyObject *objectA, PyObject *objectB, int compar
//---------------------SEQUENCE PROTOCOLS------------------------
//----------------------------len(object)------------------------
//sequence length
-static int Euler_len(EulerObject * self)
+static int Euler_len(EulerObject *UNUSED(self))
{
return EULER_SIZE;
}
@@ -411,7 +416,7 @@ static PyObject *Euler_item(EulerObject * self, int i)
}
//----------------------------object[]-------------------------
//sequence accessor (set)
-static int Euler_ass_item(EulerObject * self, int i, PyObject * value)
+static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
{
float f = PyFloat_AsDouble(value);
@@ -577,18 +582,18 @@ static PyMappingMethods Euler_AsMapping = {
/*
* euler axis, euler.x/y/z
*/
-static PyObject *Euler_getAxis( EulerObject * self, void *type )
+static PyObject *Euler_getAxis(EulerObject *self, void *type )
{
return Euler_item(self, GET_INT_FROM_POINTER(type));
}
-static int Euler_setAxis( EulerObject * self, PyObject * value, void * type )
+static int Euler_setAxis(EulerObject *self, PyObject *value, void *type)
{
return Euler_ass_item(self, GET_INT_FROM_POINTER(type), value);
}
/* rotation order */
-static PyObject *Euler_getOrder(EulerObject *self, void *type)
+static PyObject *Euler_getOrder(EulerObject *self, void *UNUSED(closure))
{
const char order[][4] = {"XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"};
@@ -598,7 +603,7 @@ static PyObject *Euler_getOrder(EulerObject *self, void *type)
return PyUnicode_FromString(order[self->order-EULER_ORDER_XYZ]);
}
-static int Euler_setOrder( EulerObject * self, PyObject * value, void * type )
+static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closure))
{
char *order_str= _PyUnicode_AsString(value);
short order= euler_order_from_string(order_str, "euler.order");
@@ -634,8 +639,8 @@ static struct PyMethodDef Euler_methods[] = {
{"to_quat", (PyCFunction) Euler_ToQuat, METH_NOARGS, Euler_ToQuat_doc},
{"rotate_axis", (PyCFunction) Euler_rotate_axis, METH_VARARGS, Euler_rotate_axis_doc},
{"make_compatible", (PyCFunction) Euler_MakeCompatible, METH_O, Euler_MakeCompatible_doc},
- {"__copy__", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc},
- {"copy", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc},
+ {"__copy__", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc},
+ {"copy", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c
index 3b8c7d3122a..9476e8127b6 100644
--- a/source/blender/python/generic/mathutils_matrix.c
+++ b/source/blender/python/generic/mathutils_matrix.c
@@ -108,7 +108,7 @@ Mathutils_Callback mathutils_matrix_vector_cb = {
//----------------------------------mathutils.Matrix() -----------------
//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
//create a new matrix type
-static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *Matrix_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
PyObject *argObject, *m, *s;
MatrixObject *mat;
@@ -117,6 +117,11 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
float scalar;
+ if(kwds && PyDict_Size(kwds)) {
+ PyErr_SetString(PyExc_TypeError, "mathutils.Matrix(): takes no keyword args");
+ return NULL;
+ }
+
argSize = PyTuple_GET_SIZE(args);
if(argSize > MATRIX_MAX_DIM) { //bad arg nums
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
@@ -1142,7 +1147,7 @@ static char Matrix_copy_doc[] =
" :return: an instance of itself\n"
" :rtype: :class:`Matrix`\n";
-PyObject *Matrix_copy(MatrixObject * self)
+PyObject *Matrix_copy(MatrixObject *self)
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -1680,17 +1685,17 @@ static PyNumberMethods Matrix_NumMethods = {
0, /* nb_index */
};
-static PyObject *Matrix_getRowSize( MatrixObject * self, void *type )
+static PyObject *Matrix_getRowSize(MatrixObject *self, void *UNUSED(closure))
{
return PyLong_FromLong((long) self->rowSize);
}
-static PyObject *Matrix_getColSize( MatrixObject * self, void *type )
+static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure))
{
return PyLong_FromLong((long) self->colSize);
}
-static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type )
+static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure))
{
float mat[3][3];
@@ -1710,7 +1715,7 @@ static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type )
return PyFloat_FromDouble(mat3_to_scale(mat));
}
-static PyObject *Matrix_getIsNegative( MatrixObject * self, void *type )
+static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure))
{
if(!BaseMath_ReadCallback(self))
return NULL;
diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c
index 553844b6ee5..37f20ebbe31 100644
--- a/source/blender/python/generic/mathutils_quat.c
+++ b/source/blender/python/generic/mathutils_quat.c
@@ -352,7 +352,7 @@ static char Quaternion_copy_doc[] =
"\n"
" .. note:: use this to get a copy of a wrapped quaternion with no reference to the original data.\n";
-static PyObject *Quaternion_copy(QuaternionObject * self)
+static PyObject *Quaternion_copy(QuaternionObject *self)
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -429,7 +429,7 @@ static PyObject* Quaternion_richcmpr(PyObject *objectA, PyObject *objectB, int c
//---------------------SEQUENCE PROTOCOLS------------------------
//----------------------------len(object)------------------------
//sequence length
-static int Quaternion_len(QuaternionObject * self)
+static int Quaternion_len(QuaternionObject *UNUSED(self))
{
return QUAT_SIZE;
}
@@ -772,7 +772,7 @@ static int Quaternion_setAxis( QuaternionObject * self, PyObject * value, void *
return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value);
}
-static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type )
+static PyObject *Quaternion_getMagnitude(QuaternionObject * self, void *UNUSED(closure))
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -780,7 +780,7 @@ static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type )
return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat)));
}
-static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type )
+static PyObject *Quaternion_getAngle(QuaternionObject * self, void *UNUSED(closure))
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -788,7 +788,7 @@ static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type )
return PyFloat_FromDouble(2.0 * (saacos(self->quat[0])));
}
-static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void * type)
+static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void *UNUSED(closure))
{
float axis[3];
float angle;
@@ -821,7 +821,7 @@ static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void *
return 0;
}
-static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type)
+static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(closure))
{
float axis[3];
float angle;
@@ -842,7 +842,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type)
return (PyObject *) newVectorObject(axis, 3, Py_NEW, NULL);
}
-static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *type)
+static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
{
float axis[3];
float angle;
@@ -872,12 +872,17 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *
}
//----------------------------------mathutils.Quaternion() --------------
-static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *Quaternion_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
PyObject *seq= NULL;
float angle = 0.0f;
float quat[QUAT_SIZE]= {0.0f, 0.0f, 0.0f, 0.0f};
+ if(kwds && PyDict_Size(kwds)) {
+ PyErr_SetString(PyExc_TypeError, "mathutils.Quaternion(): takes no keyword args");
+ return NULL;
+ }
+
if(!PyArg_ParseTuple(args, "|Of:mathutils.Quaternion", &seq, &angle))
return NULL;
diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c
index 1fe2518c6ef..84f41b6e66a 100644
--- a/source/blender/python/generic/mathutils_vector.c
+++ b/source/blender/python/generic/mathutils_vector.c
@@ -45,7 +45,7 @@ static PyObject *Vector_ToTupleExt(VectorObject *self, int ndigits);
//----------------------------------mathutils.Vector() ------------------
// Supports 2D, 3D, and 4D vector objects both int and float values
// accepted. Mixed float and int values accepted. Ints are parsed to float
-static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
{
float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f};
int size= 3; /* default to a 3D vector */
@@ -1445,7 +1445,7 @@ static int Vector_setAxis(VectorObject *self, PyObject * value, void * type )
}
/* vector.length */
-static PyObject *Vector_getLength(VectorObject *self, void *type )
+static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure))
{
double dot = 0.0f;
int i;
diff --git a/source/blender/python/generic/noise.c b/source/blender/python/generic/noise.c
index 4a09cbb58d8..a9bbc016a54 100644
--- a/source/blender/python/generic/noise.c
+++ b/source/blender/python/generic/noise.c
@@ -39,6 +39,8 @@
#include "BLI_blenlib.h"
#include "DNA_texture_types.h"
+
+#include "BKE_utildefines.h"
/*-----------------------------------------*/
/* 'mersenne twister' random number generator */
@@ -207,12 +209,12 @@ static void randuvec(float v[3])
v[2] = 1.f;
}
-static PyObject *Noise_random(PyObject * self)
+static PyObject *Noise_random(PyObject *UNUSED(self))
{
return PyFloat_FromDouble(frand());
}
-static PyObject *Noise_random_unit_vector(PyObject * self)
+static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self))
{
float v[3] = {0.0f, 0.0f, 0.0f};
randuvec(v);
@@ -223,7 +225,7 @@ static PyObject *Noise_random_unit_vector(PyObject * self)
/* Random seed init. Only used for MT random() & randuvec() */
-static PyObject *Noise_seed_set(PyObject * self, PyObject * args)
+static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args)
{
int s;
if(!PyArg_ParseTuple(args, "i:seed_set", &s))
@@ -236,7 +238,7 @@ static PyObject *Noise_seed_set(PyObject * self, PyObject * args)
/* General noise */
-static PyObject *Noise_noise(PyObject * self, PyObject * args)
+static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z;
int nb = 1;
@@ -260,7 +262,7 @@ static void noise_vector(float x, float y, float z, int nb, float v[3])
nb) - 1.0);
}
-static PyObject *Noise_vector(PyObject * self, PyObject * args)
+static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, v[3];
int nb = 1;
@@ -296,7 +298,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
return out;
}
-static PyObject *Noise_turbulence(PyObject * self, PyObject * args)
+static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z;
int oct, hd, nb = 1;
@@ -340,7 +342,7 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb,
}
}
-static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args)
+static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, v[3];
int oct, hd, nb = 1;
@@ -355,7 +357,7 @@ static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args)
/* F. Kenton Musgrave's fractal functions */
-static PyObject *Noise_fractal(PyObject * self, PyObject * args)
+static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct;
int nb = 1;
@@ -366,7 +368,7 @@ static PyObject *Noise_fractal(PyObject * self, PyObject * args)
/*------------------------------------------------------------------------*/
-static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args)
+static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct;
int nb = 1;
@@ -378,7 +380,7 @@ static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args)
/*------------------------------------------------------------------------*/
-static PyObject *Noise_vl_vector(PyObject * self, PyObject * args)
+static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, d;
int nt1 = 1, nt2 = 1;
@@ -389,7 +391,7 @@ static PyObject *Noise_vl_vector(PyObject * self, PyObject * args)
/*-------------------------------------------------------------------------*/
-static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args)
+static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct, ofs;
int nb = 1;
@@ -401,7 +403,7 @@ static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args)
/*-------------------------------------------------------------------------*/
-static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args)
+static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct, ofs, gn;
int nb = 1;
@@ -413,7 +415,7 @@ static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args)
/*------------------------------------------------------------------------*/
-static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args)
+static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct, ofs, gn;
int nb = 1;
@@ -424,7 +426,7 @@ static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args)
/*-------------------------------------------------------------------------*/
-static PyObject *Noise_voronoi(PyObject * self, PyObject * args)
+static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, da[4], pa[12];
int dtype = 0;
@@ -441,7 +443,7 @@ static PyObject *Noise_voronoi(PyObject * self, PyObject * args)
/*-------------------------------------------------------------------------*/
-static PyObject *Noise_cell(PyObject * self, PyObject * args)
+static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z;
if(!PyArg_ParseTuple(args, "(fff):cell", &x, &y, &z))
@@ -452,7 +454,7 @@ static PyObject *Noise_cell(PyObject * self, PyObject * args)
/*--------------------------------------------------------------------------*/
-static PyObject *Noise_cell_vector(PyObject * self, PyObject * args)
+static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, ca[3];
if(!PyArg_ParseTuple(args, "(fff):cell_vector", &x, &y, &z))
@@ -603,22 +605,22 @@ look like anything from an earthquake to a very nervous or maybe even drunk came
/* Just in case, declarations for a header file */
/*
-static PyObject *Noise_random(PyObject *self);
-static PyObject *Noise_random_unit_vector(PyObject *self);
-static PyObject *Noise_seed_set(PyObject *self, PyObject *args);
-static PyObject *Noise_noise(PyObject *self, PyObject *args);
-static PyObject *Noise_vector(PyObject *self, PyObject *args);
-static PyObject *Noise_turbulence(PyObject *self, PyObject *args);
-static PyObject *Noise_turbulence_vector(PyObject *self, PyObject *args);
-static PyObject *Noise_fractal(PyObject *self, PyObject *args);
-static PyObject *Noise_multi_fractal(PyObject *self, PyObject *args);
-static PyObject *Noise_vl_vector(PyObject *self, PyObject *args);
-static PyObject *Noise_hetero_terrain(PyObject *self, PyObject *args);
-static PyObject *Noise_hybrid_multi_fractal(PyObject *self, PyObject *args);
-static PyObject *Noise_ridged_multi_fractal(PyObject *self, PyObject *args);
-static PyObject *Noise_voronoi(PyObject *self, PyObject *args);
-static PyObject *Noise_cell(PyObject *self, PyObject *args);
-static PyObject *Noise_cell_vector(PyObject *self, PyObject *args);
+static PyObject *Noise_random(PyObject *UNUSED(self));
+static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self));
+static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args);
*/
static PyMethodDef NoiseMethods[] = {
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 69b5faceca0..afcf7e757e6 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -34,7 +34,9 @@
#include "BLI_path_util.h"
#include "BLI_bpath.h"
-
+
+#include "BKE_utildefines.h"
+
/* external util modules */
#include "../generic/geometry.h"
#include "../generic/bgl.h"
@@ -51,7 +53,7 @@ static char bpy_script_paths_doc[] =
" :return: (system, user) strings will be empty when not found.\n"
" :rtype: tuple of strigs\n";
-PyObject *bpy_script_paths(PyObject *self)
+PyObject *bpy_script_paths(PyObject *UNUSED(self))
{
PyObject *ret= PyTuple_New(2);
char *path;
@@ -73,7 +75,7 @@ static char bpy_blend_paths_doc[] =
" :type absolute: boolean\n"
" :return: path list.\n"
" :rtype: list of strigs\n";
-static PyObject *bpy_blend_paths(PyObject * self, PyObject *args, PyObject *kw)
+static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
struct BPathIterator bpi;
PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */
@@ -124,7 +126,7 @@ static char bpy_user_resource_doc[] =
" :type subdir: string\n"
" :return: a path.\n"
" :rtype: string\n";
-static PyObject *bpy_user_resource(PyObject * self, PyObject *args, PyObject *kw)
+static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
char *type;
char *subdir= NULL;
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 78658a611a3..39494678a12 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -26,16 +26,22 @@
#include "BLI_path_util.h"
+#include "BKE_utildefines.h"
#include "BKE_blender.h"
#include "BKE_global.h"
#include "structseq.h"
+#include "../generic/py_capi_utils.h"
+
#ifdef BUILD_DATE
extern char build_date[];
extern char build_time[];
extern char build_rev[];
extern char build_platform[];
extern char build_type[];
+extern char build_cflags[];
+extern char build_cxxflags[];
+extern char build_linkflags[];
#endif
static PyTypeObject BlenderAppType;
@@ -44,7 +50,6 @@ static PyStructSequence_Field app_info_fields[] = {
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"},
{"version_string", "The Blender version formatted as a string"},
{"binary_path", "The location of blenders executable, useful for utilities that spawn new instances"},
- {"debug", "Boolean, set when blender is running in debug mode (started with -d)"},
{"background", "Boolean, True when blender is running without a user interface (started with -b)"},
/* buildinfo */
@@ -53,6 +58,9 @@ static PyStructSequence_Field app_info_fields[] = {
{"build_revision", "The subversion revision this blender instance was built with"},
{"build_platform", "The platform this blender instance was built for"},
{"build_type", "The type of build (Release, Debug)"},
+ {"build_cflags", ""},
+ {"build_cxxflags", ""},
+ {"build_linkflags", ""},
{0}
};
@@ -85,7 +93,6 @@ static PyObject *make_app_info(void)
SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
SetStrItem(bprogname);
- SetObjItem(PyBool_FromLong(G.f & G_DEBUG));
SetObjItem(PyBool_FromLong(G.background));
/* build info */
@@ -95,12 +102,18 @@ static PyObject *make_app_info(void)
SetStrItem(build_rev);
SetStrItem(build_platform);
SetStrItem(build_type);
+ SetStrItem(build_cflags);
+ SetStrItem(build_cxxflags);
+ SetStrItem(build_linkflags);
#else
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
+ SetStrItem("Unknown");
+ SetStrItem("Unknown");
+ SetStrItem("Unknown");
#endif
#undef SetIntItem
@@ -114,10 +127,51 @@ static PyObject *make_app_info(void)
return app_info;
}
+/* a few getsets because it makes sense for them to be in bpy.app even though
+ * they are not static */
+static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure))
+{
+ return PyBool_FromLong(G.f & G_DEBUG);
+}
+
+static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
+{
+ int param= PyObject_IsTrue(value);
+
+ if(param < 0) {
+ PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
+ return -1;
+ }
+
+ if(param) G.f |= G_DEBUG;
+ else G.f &= ~G_DEBUG;
+
+ return 0;
+}
+
+static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure))
+{
+ extern char btempdir[];
+ return PyC_UnicodeFromByte(btempdir);
+}
+
+PyGetSetDef bpy_app_debug_getset= {"debug", bpy_app_debug_get, bpy_app_debug_set, "Boolean, set when blender is running in debug mode (started with -d)", NULL};
+PyGetSetDef bpy_app_tempdir_getset= {"tempdir", bpy_app_tempdir_get, NULL, "String, the temp directory used by blender (read-only)", NULL};
+
+static void py_struct_seq_getset_init(void)
+{
+ /* tricky dynamic members, not to py-spec! */
+
+ PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_debug_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_debug_getset));
+ PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_tempdir_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_tempdir_getset));
+}
+/* end dynamic bpy.app */
+
+
PyObject *BPY_app_struct(void)
{
PyObject *ret;
-
+
PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
ret= make_app_info();
@@ -125,6 +179,10 @@ PyObject *BPY_app_struct(void)
/* prevent user from creating new instances */
BlenderAppType.tp_init = NULL;
BlenderAppType.tp_new = NULL;
-
+
+ /* kindof a hack ontop of PyStructSequence */
+ py_struct_seq_getset_init();
+
return ret;
}
+
diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c
index 6d971d8708e..d219757b777 100644
--- a/source/blender/python/intern/bpy_array.c
+++ b/source/blender/python/intern/bpy_array.c
@@ -237,7 +237,7 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int
return data;
}
-static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix)
+static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix)
{
int totdim, dim_size[MAX_ARRAY_DIMENSION];
int totitem;
@@ -358,18 +358,18 @@ static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *
RNA_property_boolean_set_index(ptr, prop, index, *(int*)value);
}
-int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix)
+int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix)
{
int ret;
switch (RNA_property_type(prop)) {
case PROP_FLOAT:
- ret= py_to_array(py, ptr, prop, parms, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
+ ret= py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
break;
case PROP_INT:
- ret= py_to_array(py, ptr, prop, parms, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
+ ret= py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
break;
case PROP_BOOLEAN:
- ret= py_to_array(py, ptr, prop, parms, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
+ ret= py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
break;
default:
PyErr_SetString(PyExc_TypeError, "not an array type");
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index bc79ba94756..3ff0d86b433 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -43,6 +43,7 @@
#include "BLI_math_base.h"
#include "BLI_string.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "BKE_text.h"
#include "BKE_font.h" /* only for utf8towchar */
@@ -104,7 +105,8 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
}
}
-void bpy_context_clear(bContext *C, PyGILState_STATE *gilstate)
+/* context should be used but not now because it causes some bugs */
+void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
{
py_call_level--;
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 2b475a57de6..3ffa78dab70 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -40,7 +40,7 @@
#include "MEM_guardedalloc.h"
#include "BKE_report.h"
-static PyObject *pyop_poll( PyObject * self, PyObject * args)
+static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
char *opname;
@@ -80,7 +80,7 @@ static PyObject *pyop_poll( PyObject * self, PyObject * args)
return ret;
}
-static PyObject *pyop_call( PyObject * self, PyObject * args)
+static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
int error_val = 0;
@@ -196,7 +196,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args)
}
-static PyObject *pyop_as_string( PyObject * self, PyObject * args)
+static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
PointerRNA ptr;
@@ -248,7 +248,7 @@ static PyObject *pyop_as_string( PyObject * self, PyObject * args)
return pybuf;
}
-static PyObject *pyop_dir(PyObject *self)
+static PyObject *pyop_dir(PyObject *UNUSED(self))
{
PyObject *list = PyList_New(0), *name;
wmOperatorType *ot;
@@ -262,7 +262,7 @@ static PyObject *pyop_dir(PyObject *self)
return list;
}
-static PyObject *pyop_getrna(PyObject *self, PyObject *value)
+static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
{
wmOperatorType *ot;
PointerRNA ptr;
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 6d16896fb16..fa1aeacbc42 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -84,7 +84,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata)
operator_properties_init(ot);
}
-PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args)
+PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 93106d5400f..a3b0c4739c4 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -58,7 +58,7 @@
#include "../generic/IDProp.h" /* for IDprop lookups */
#include "../generic/py_capi_utils.h"
-static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix);
+static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix);
static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length);
static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self);
static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self);
@@ -135,7 +135,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
return 1;
}
-static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int index)
+static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
@@ -146,7 +146,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int
return 1;
}
-static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int index)
+static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
@@ -176,7 +176,7 @@ Mathutils_Callback mathutils_rna_array_cb = {
/* bpyrna matrix callbacks */
static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
-static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype)
+static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
@@ -187,7 +187,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype)
return 1;
}
-static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype)
+static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
@@ -864,7 +864,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
break;
}
} else {
- if (pyrna_py_to_prop(ptr, prop, NULL, NULL, item, error_prefix)) {
+ if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) {
error_val= -1;
break;
}
@@ -918,7 +918,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func)
-static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix)
+static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix)
{
/* XXX hard limits should be checked here */
int type = RNA_property_type(prop);
@@ -941,7 +941,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p
return -1;
}
/* done getting the length */
- ok= pyrna_py_to_array(ptr, prop, parms, data, value, error_prefix);
+ ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix);
if (!ok) {
/* PyErr_Format(PyExc_AttributeError, "%.200s %s", error_prefix, error_str); */
@@ -964,7 +964,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p
else
param = PyLong_AsLong( value );
- if( param < 0 || param > 1) {
+ if(param < 0) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
return -1;
} else {
@@ -1391,7 +1391,7 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons
}
/* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, char *keyname) */
-static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length)
+static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop)
{
PointerRNA newptr;
PyObject *list = PyList_New(stop - start);
@@ -1513,7 +1513,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
return PyList_New(0);
}
else if (step == 1) {
- return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop, len);
+ return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop);
}
else {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported with rna");
@@ -2431,7 +2431,7 @@ static char pyrna_struct_type_recast_doc[] =
" :return: a new instance of this object with the type initialized again.\n"
" :rtype: subclass of :class:`bpy_struct`";
-static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self, PyObject *args)
+static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
{
PointerRNA r_ptr;
RNA_pointer_recast(&self->ptr, &r_ptr);
@@ -2751,7 +2751,7 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec
PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
return -1;
}
- return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:");
+ return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr = val:");
}
else {
return PyObject_GenericSetAttr((PyObject *)self, pyname, value);
@@ -2835,7 +2835,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna
else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
if ((prop = RNA_struct_find_property(&r_ptr, name))) {
/* pyrna_py_to_prop sets its own exceptions */
- return pyrna_py_to_prop(&r_ptr, prop, NULL, NULL, value, "BPy_PropertyRNA - Attribute (setattr):");
+ return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):");
}
}
@@ -3409,7 +3409,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
* todo - also accept useful args */
-static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
+static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) {
BPy_StructRNA *base;
@@ -3432,7 +3432,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject
/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
* todo - also accept useful args */
-static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
+static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) {
BPy_PropertyRNA *base;
@@ -3454,15 +3454,14 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *k
}
}
-PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *prop, void *data)
+PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
{
PyObject *ret;
int type = RNA_property_type(prop);
int flag = RNA_property_flag(prop);
- int a;
if(RNA_property_array_check(ptr, prop)) {
- int len;
+ int a, len;
if (flag & PROP_DYNAMIC) {
ParameterDynAlloc *data_alloc= data;
@@ -3705,7 +3704,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
continue;
}
- err= pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, "");
+ err= pyrna_py_to_prop(&funcptr, parm, iter.data, item, "");
if(err!=0) {
/* the error generated isnt that useful, so generate it again with a useful prefix
@@ -3718,7 +3717,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
else
snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with argument %d, \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), i, parm_id);
- pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, error_prefix);
+ pyrna_py_to_prop(&funcptr, parm, iter.data, item, error_prefix);
break;
}
@@ -3823,13 +3822,13 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
flag= RNA_property_flag(parm);
if (flag & PROP_OUTPUT)
- PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, &parms, parm, iter.data));
+ PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, parm, iter.data));
}
RNA_parameter_list_end(&iter);
}
else
- ret= pyrna_param_to_py(&funcptr, &parms, pret_single, retdata_single);
+ ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single);
/* possible there is an error in conversion */
if(ret==NULL)
@@ -5013,7 +5012,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
if(strcmp(identifier, rna_attr) == 0) { \
item= PyObject_GetAttrString(py_class, py_attr); \
if(item && item != Py_None) { \
- if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) { \
+ if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) { \
Py_DECREF(item); \
return -1; \
} \
@@ -5037,7 +5036,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
else {
Py_DECREF(item); /* no need to keep a ref, the class owns it */
- if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0)
+ if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0)
return -1;
}
}
@@ -5157,7 +5156,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
continue;
}
- parmitem= pyrna_param_to_py(&funcptr, parms, parm, iter.data);
+ parmitem= pyrna_param_to_py(&funcptr, parm, iter.data);
PyTuple_SET_ITEM(args, i, parmitem);
i++;
}
@@ -5192,7 +5191,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
err= -1;
}
else if(ret_len==1) {
- err= pyrna_py_to_prop(&funcptr, pret_single, parms, retdata_single, ret, "calling class function:");
+ err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "calling class function:");
}
else if (ret_len > 1) {
@@ -5215,7 +5214,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
/* only useful for single argument returns, we'll need another list loop for multiple */
if (flag & PROP_OUTPUT) {
- err= pyrna_py_to_prop(&funcptr, parm, parms, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:");
+ err= pyrna_py_to_prop(&funcptr, parm, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:");
if(err)
break;
}
@@ -5329,7 +5328,7 @@ void pyrna_free_types(void)
* - Should still be fixed - Campbell
* */
-static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class)
+static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_class)
{
bContext *C= NULL;
ReportList reports;
@@ -5426,7 +5425,7 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN
return 0;
}
-static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class)
+static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_class)
{
bContext *C= NULL;
StructUnregisterFunc unreg;
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 7f750f94242..77b602b6f83 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -99,7 +99,7 @@ void pyrna_alloc_types(void);
void pyrna_free_types(void);
/* primitive type conversion */
-int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix);
+int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix);
int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix);
PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index);
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index b2a7511f998..81d6e0cd4da 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -27,6 +27,7 @@
#include "bpy_util.h"
#include "DNA_screen_types.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "ED_space_api.h"
@@ -34,7 +35,7 @@
#define RNA_CAPSULE_ID "RNA_HANDLE"
#define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED"
-void cb_region_draw(const bContext *C, ARegion *ar, void *customdata)
+void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata)
{
PyObject *cb_func, *cb_args, *result;
PyGILState_STATE gilstate;
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index 73e23ea8abd..14a1163ee9a 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -41,6 +41,7 @@
#include "AUD_C-API.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_scene.h"
#include "BKE_report.h"
@@ -208,7 +209,7 @@ void makeqtstring (RenderData *rd, char *string) {
char txt[64];
strcpy(string, rd->pic);
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_make_existing_file(string);
@@ -222,7 +223,7 @@ void filepath_qt(char *string, RenderData *rd) {
if (string==NULL) return;
strcpy(string, rd->pic);
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_make_existing_file(string);
diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m
index 41c4e0cc5a3..f067d717a7c 100644
--- a/source/blender/quicktime/apple/qtkit_import.m
+++ b/source/blender/quicktime/apple/qtkit_import.m
@@ -149,7 +149,7 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height)
NSEnumerator *enumerator;
NSImageRep *representation;
- ibuf = IMB_allocImBuf (width, height, 32, IB_rect, 0);
+ ibuf = IMB_allocImBuf (width, height, 32, IB_rect);
if (!ibuf) {
if(QTIME_DEBUG) printf("quicktime_import: could not allocate memory for the " \
"image.\n");
@@ -359,7 +359,7 @@ int startquicktime (struct anim *anim)
return -1;
}
- anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect, 0);
+ anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect);
qtTimeDuration = [[anim->qtime->media attributeForKey:QTMediaDurationAttribute] QTTimeValue];
anim->qtime->durationTime = qtTimeDuration.timeValue;
@@ -450,7 +450,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
[bitmapImage setSize:bitmapSize];
/* allocate the image buffer */
- ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0, 0);
+ ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0);
if (!ibuf) {
fprintf(stderr,
"imb_cocoaLoadImage: could not allocate memory for the " \
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
index c1291fc6949..2623a598d5f 100644
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ b/source/blender/quicktime/apple/quicktime_export.c
@@ -40,6 +40,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@@ -379,8 +380,8 @@ static void QT_StartAddVideoSamplesToMedia (const Rect *trackFrame, int rectx, i
SCTemporalSettings gTemporalSettings;
OSErr err = noErr;
- qtexport->ibuf = IMB_allocImBuf (rectx, recty, 32, IB_rect, 0);
- qtexport->ibuf2 = IMB_allocImBuf (rectx, recty, 32, IB_rect, 0);
+ qtexport->ibuf = IMB_allocImBuf (rectx, recty, 32, IB_rect);
+ qtexport->ibuf2 = IMB_allocImBuf (rectx, recty, 32, IB_rect);
err = NewGWorldFromPtr( &qtexport->theGWorld,
k32ARGBPixelFormat,
@@ -494,7 +495,7 @@ void filepath_qt(char *string, RenderData *rd) {
if (string==0) return;
strcpy(string, rd->pic);
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_make_existing_file(string);
diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c
index f9793f04b88..699b2c4f6e3 100644
--- a/source/blender/quicktime/apple/quicktime_import.c
+++ b/source/blender/quicktime/apple/quicktime_import.c
@@ -335,7 +335,7 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position)
return (NULL);
}
- ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect, 0);
+ ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect);
rect = ibuf->rect;
SetMovieTimeValue(anim->qtime->movie, anim->qtime->frameIndex[position]);
@@ -496,7 +496,7 @@ int startquicktime (struct anim *anim)
return -1;
}
- anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect, 0);
+ anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect);
#ifdef _WIN32
err = NewGWorldFromPtr(&anim->qtime->offscreenGWorld,
@@ -676,7 +676,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
depth = (**desc).depth;
if (flags & IB_test) {
- ibuf = IMB_allocImBuf(x, y, depth, 0, 0);
+ ibuf = IMB_allocImBuf(x, y, depth, 0);
ibuf->ftype = QUICKTIME;
DisposeHandle((Handle)dataref);
if (gImporter != NULL) CloseComponent(gImporter);
@@ -684,8 +684,8 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
}
#ifdef __APPLE__
- ibuf = IMB_allocImBuf (x, y, 32, IB_rect, 0);
- wbuf = IMB_allocImBuf (x, y, 32, IB_rect, 0);
+ ibuf = IMB_allocImBuf (x, y, 32, IB_rect);
+ wbuf = IMB_allocImBuf (x, y, 32, IB_rect);
err = NewGWorldFromPtr(&offGWorld,
k32ARGBPixelFormat,
@@ -693,7 +693,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
(unsigned char *)wbuf->rect, x * 4);
#else
- ibuf = IMB_allocImBuf (x, y, 32, IB_rect, 0);
+ ibuf = IMB_allocImBuf (x, y, 32, IB_rect);
err = NewGWorldFromPtr(&offGWorld,
k32RGBAPixelFormat,
diff --git a/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c b/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c
index 33e9bfec446..c5b523b106f 100644
--- a/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c
+++ b/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c
@@ -41,7 +41,7 @@ int BLO_read_runtime( char *file);
BLO_readblenfilememory(
char *fromBuffer, int fromBufferSize)
{
-#ifndef NDEBUG
+#if defined(DEBUG)
fprintf(GEN_errorstream,
"Error BLO_readblenfilename is a stub\n");
#endif
@@ -52,7 +52,7 @@ BLO_readblenfilememory(
BLO_readblenfilename(
char *fileName)
{
-#ifndef NDEBUG
+#if defined(DEBUG)
fprintf(GEN_errorstream,
"Error BLO_readblenfilename is a stub\n");
#endif
@@ -63,7 +63,7 @@ BLO_readblenfilename(
BLO_readblenfilehandle(
int fileHandle)
{
-#ifndef NDEBUG
+#if defined(DEBUG)
fprintf(GEN_errorstream,
"Error BLO_readblenfilehandle is a stub\n");
#endif
@@ -74,7 +74,7 @@ BLO_readblenfilehandle(
BLO_is_a_runtime(
char *file)
{
-#ifndef NDEBUG
+#if defined(DEBUG)
fprintf(GEN_errorstream,
"Error BLO_is_a_runtime is a stub\n");
#endif
@@ -85,7 +85,7 @@ BLO_is_a_runtime(
BLO_read_runtime(
char *file)
{
-#ifndef NDEBUG
+#if defined(DEBUG)
fprintf(GEN_errorstream,
"Error BLO_read_runtime is a stub\n");
#endif
diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt
index 8e0dbb457e8..e6478098dad 100644
--- a/source/blender/render/CMakeLists.txt
+++ b/source/blender/render/CMakeLists.txt
@@ -24,6 +24,9 @@
#
# ***** END GPL LICENSE BLOCK *****
+# remove warning until render branch merged.
+STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+
FILE(GLOB SRC intern/source/*.c intern/raytrace/*.cpp)
SET(INC
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 01dafd2ce4a..e70287e522e 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -321,7 +321,7 @@ u | | F1 | F2 |
/* ------------------------------------------------------------------------- */
-static void split_v_renderfaces(ObjectRen *obr, int startvlak, int startvert, int usize, int vsize, int uIndex, int cyclu, int cyclv)
+static void split_v_renderfaces(ObjectRen *obr, int startvlak, int startvert, int usize, int vsize, int uIndex, int UNUSED(cyclu), int cyclv)
{
int vLen = vsize-1+(!!cyclv);
int v;
@@ -2341,7 +2341,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
VertRen *ver;
VlakRen *vlr, *vlr1;
Material *ma;
- float *data, *nors, *orco, mat[4][4], imat[3][3], xn, yn, zn;
+ float *data, *nors, *orco=NULL, mat[4][4], imat[3][3], xn, yn, zn;
int a, need_orco, vlakindex, *index;
ListBase dispbase= {NULL, NULL};
@@ -2375,7 +2375,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
}
}
- for(a=0; a<dl->nr; a++, data+=3, nors+=3, orco+=3) {
+ for(a=0; a<dl->nr; a++, data+=3, nors+=3) {
ver= RE_findOrAddVert(obr, obr->totvert++);
VECCOPY(ver->co, data);
@@ -2393,7 +2393,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
normalize_v3(ver->n);
//if(ob->transflag & OB_NEG_SCALE) negate_v3(ver->n);
- if(need_orco) ver->orco= orco;
+ if(need_orco) ver->orco= orco+=3;
}
index= dl->index;
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 8977bc7f379..f7da13373d1 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -86,7 +86,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
if (env->type == ENV_CUBE) {
for(part=0; part<6; part++) {
- env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat, 0);
+ env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat);
}
IMB_float_from_rect(ibuf);
@@ -458,7 +458,7 @@ static void render_envmap(Render *re, EnvMap *env)
int y;
float *alpha;
- ibuf= IMB_allocImBuf(envre->rectx, envre->recty, 24, IB_rect|IB_rectfloat, 0);
+ ibuf= IMB_allocImBuf(envre->rectx, envre->recty, 24, IB_rect|IB_rectfloat);
memcpy(ibuf->rect_float, rl->rectf, ibuf->channels * ibuf->x * ibuf->y * sizeof(float));
if (re->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index f78031c9030..9376c798c39 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -157,8 +157,8 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texre
}
}
- x = (int)(fx*ibuf->x);
- y = (int)(fy*ibuf->y);
+ x = (int)floorf(fx*ibuf->x);
+ y = (int)floorf(fy*ibuf->y);
if(tex->extend == TEX_CLIPCUBE) {
if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0 || texvec[2]>1.0) {
@@ -500,7 +500,7 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
}
}
-static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend, int intpol)
+static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend)
{
/* Sample box, performs clip. minx etc are in range 0.0 - 1.0 .
* Enlarge with antialiased edges of pixels.
@@ -1606,11 +1606,11 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
//minx*= 1.35f;
//miny*= 1.35f;
- boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0);
+ boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend);
val1= texres->tr+texres->tg+texres->tb;
- boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0);
+ boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend);
val2= texr.tr + texr.tg + texr.tb;
- boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0);
+ boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend);
val3= texr.tr + texr.tg + texr.tb;
/* don't switch x or y! */
@@ -1619,7 +1619,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
if(previbuf!=curibuf) { /* interpolate */
- boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend, 0);
+ boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend);
/* calc rgb */
dx= 2.0f*(pixsize-maxd)/pixsize;
@@ -1636,9 +1636,9 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
}
val1= dy*val1+ dx*(texr.tr + texr.tg + texr.tb);
- boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0);
+ boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend);
val2= dy*val2+ dx*(texr.tr + texr.tg + texr.tb);
- boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0);
+ boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend);
val3= dy*val3+ dx*(texr.tr + texr.tg + texr.tb);
texres->nor[0]= (val1-val2); /* vals have been interpolated above! */
@@ -1661,10 +1661,10 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
maxy= fy+miny;
miny= fy-miny;
- boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend, 0);
+ boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend);
if(previbuf!=curibuf) { /* interpolate */
- boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend, 0);
+ boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend);
fx= 2.0f*(pixsize-maxd)/pixsize;
@@ -1690,11 +1690,11 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
}
if(texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
- boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0);
+ boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend);
val1= texres->tr+texres->tg+texres->tb;
- boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0);
+ boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend);
val2= texr.tr + texr.tg + texr.tb;
- boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0);
+ boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend);
val3= texr.tr + texr.tg + texr.tb;
/* don't switch x or y! */
@@ -1702,7 +1702,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
texres->nor[1]= (val1-val3);
}
else
- boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0);
+ boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend);
}
if(tex->imaflag & TEX_CALCALPHA) {
@@ -1749,7 +1749,7 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
ibuf->rect+= (ibuf->x*ibuf->y);
- boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0);
+ boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1);
result[0]= texres.tr;
result[1]= texres.tg;
result[2]= texres.tb;
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 44c6a6f008f..7230e0b3909 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -122,20 +122,20 @@ Render R;
static volatile int g_break= 0;
-static int thread_break(void *unused)
+static int thread_break(void *UNUSED(arg))
{
return g_break;
}
/* default callbacks, set in each new render */
-static void result_nothing(void *unused, RenderResult *rr) {}
-static void result_rcti_nothing(void *unused, RenderResult *rr, volatile struct rcti *rect) {}
-static void stats_nothing(void *unused, RenderStats *rs) {}
-static void float_nothing(void *unused, float val) {}
-static void print_error(void *unused, char *str) {printf("ERROR: %s\n", str);}
-static int default_break(void *unused) {return G.afbreek == 1;}
+static void result_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr)) {}
+static void result_rcti_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) {}
+static void stats_nothing(void *UNUSED(arg), RenderStats *UNUSED(rs)) {}
+static void float_nothing(void *UNUSED(arg), float UNUSED(val)) {}
+static void print_error(void *UNUSED(arg), char *str) {printf("ERROR: %s\n", str);}
+static int default_break(void *UNUSED(arg)) {return G.afbreek == 1;}
-static void stats_background(void *unused, RenderStats *rs)
+static void stats_background(void *UNUSED(arg), RenderStats *rs)
{
char str[400], *spos= str;
uintptr_t mem_in_use, mmap_in_use, peak_memory;
@@ -452,7 +452,7 @@ static void render_unique_exr_name(Render *re, char *str, int sample)
{
char di[FILE_MAX], name[FILE_MAXFILE+MAX_ID_NAME+100], fi[FILE_MAXFILE];
- BLI_strncpy(di, G.sce, FILE_MAX);
+ BLI_strncpy(di, G.main->name, FILE_MAX);
BLI_splitdirstring(di, fi);
if(sample==0)
@@ -861,7 +861,7 @@ static void *ml_addlayer_cb(void *base, char *str)
BLI_strncpy(rl->name, str, EXR_LAY_MAXNAME);
return rl;
}
-static void ml_addpass_cb(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id)
+static void ml_addpass_cb(void *UNUSED(base), void *lay, char *str, float *rect, int totchan, char *chan_id)
{
RenderLayer *rl= lay;
RenderPass *rpass= MEM_callocN(sizeof(RenderPass), "loaded pass");
@@ -1398,7 +1398,7 @@ void RE_error_cb(Render *re, void *handle, void (*f)(void *handle, char *str))
/* object is considered fully prepared on correct time etc */
/* includes lights */
-void RE_AddObject(Render *re, Object *ob)
+void RE_AddObject(Render *UNUSED(re), Object *UNUSED(ob))
{
}
@@ -2032,7 +2032,7 @@ static void load_backbuffer(Render *re)
char name[256];
strcpy(name, re->r.backbuf);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
BLI_path_frame(name, re->r.cfra, 0);
if(re->backbuf) {
@@ -2041,7 +2041,7 @@ static void load_backbuffer(Render *re)
BKE_image_signal(re->backbuf, NULL, IMA_SIGNAL_RELOAD);
}
- re->backbuf= BKE_add_image_file(name, re->r.cfra);
+ re->backbuf= BKE_add_image_file(name);
ibuf= BKE_image_get_ibuf(re->backbuf, NULL);
if(ibuf==NULL) {
// error() doesnt work with render window open
@@ -2226,7 +2226,7 @@ static int composite_needs_render(Scene *sce)
}
/* bad call... need to think over proper method still */
-static void render_composit_stats(void *unused, char *str)
+static void render_composit_stats(void *UNUSED(arg), char *str)
{
R.i.infostr= str;
R.stats_draw(R.sdh, &R.i);
@@ -2677,7 +2677,7 @@ static int is_rendering_allowed(Render *re)
return 1;
}
-static void update_physics_cache(Render *re, Scene *scene, int anim_init)
+static void update_physics_cache(Render *re, Scene *scene, int UNUSED(anim_init))
{
PTCacheBaker baker;
@@ -2813,7 +2813,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R
}
}
else {
- ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0, 0);
+ ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0);
/* if not exists, BKE_write_ibuf makes one */
ibuf->rect= (unsigned int *)rres.rect32;
@@ -3170,7 +3170,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, char *file
if(ibuf->rect_float==NULL)
IMB_float_from_rect(ibuf);
- ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat, 0);
+ ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat);
if(ibuf_clip) {
IMB_rectcpy(ibuf_clip, ibuf, 0,0, 0,0, layer->rectx, layer->recty);
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index 1ca1ea10273..d8156594085 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -253,7 +253,7 @@ static void cache_pointdensity(Render *re, Tex *tex)
}
}
-static void free_pointdensity(Render *re, Tex *tex)
+static void free_pointdensity(Render *UNUSED(re), Tex *tex)
{
PointDensity *pd = tex->pd;
diff --git a/source/blender/render/intern/source/rayobject_instance.c b/source/blender/render/intern/source/rayobject_instance.c
index 25765c4763a..a8098d2e8ef 100644
--- a/source/blender/render/intern/source/rayobject_instance.c
+++ b/source/blender/render/intern/source/rayobject_instance.c
@@ -41,7 +41,7 @@ static void RE_rayobject_instance_free(RayObject *o);
static void RE_rayobject_instance_bb(RayObject *o, float *min, float *max);
static float RE_rayobject_instance_cost(RayObject *o);
-static void RE_rayobject_instance_hint_bb(RayObject *o, RayHint *hint, float *min, float *max)
+static void RE_rayobject_instance_hint_bb(RayObject *UNUSED(o), RayHint *UNUSED(hint), float *UNUSED(min), float *UNUSED(max))
{}
static RayObjectAPI instance_api =
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 724fd9a3110..1172bee7d67 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -697,17 +697,9 @@ static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol,
* note: 'col' must be initialized */
static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, float *start, float *vec, float *col, ObjectInstanceRen *obi, VlakRen *vlr, int traflag)
{
- ShadeInput shi;
- ShadeResult shr;
+ ShadeInput shi= {0};
Isect isec;
- float f, f1, fr, fg, fb;
- float ref[3];
float dist_mir = origshi->mat->dist_mir;
-
- /* Warning, This is not that nice, and possibly a bit slow for every ray,
- however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
- memset(&shi, 0, sizeof(ShadeInput));
- /* end warning! - Campbell */
VECCOPY(isec.start, start);
VECCOPY(isec.vec, vec );
@@ -721,8 +713,9 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
RE_RC_INIT(isec, shi);
if(RE_rayobject_raycast(R.raytree, &isec)) {
+ ShadeResult shr= {{0}};
float d= 1.0f;
-
+
shi.mask= origshi->mask;
shi.osatex= origshi->osatex;
shi.depth= 1; /* only used to indicate tracing */
@@ -737,16 +730,15 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
shi.light_override= origshi->light_override;
shi.mat_override= origshi->mat_override;
- memset(&shr, 0, sizeof(ShadeResult));
-
shade_ray(&isec, &shi, &shr);
if (traflag & RAY_TRA)
d= shade_by_transmission(&isec, &shi, &shr);
if(depth>0) {
+ float fr, fg, fb, f, f1;
if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f) {
- float nf, f, f1, refract[3], tracol[4];
+ float nf, f, refract[3], tracol[4];
tracol[0]= shi.r;
tracol[1]= shi.g;
@@ -799,6 +791,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
if(f!=0.0f) {
float mircol[4];
+ float ref[3];
reflection(ref, shi.vn, shi.view, NULL);
traceray(origshi, origshr, depth-1, shi.co, ref, mircol, shi.obi, shi.vlr, 0);
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 7101ce5daaf..e589bb3a840 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -820,7 +820,7 @@ static void *do_shadow_thread(void *re_v)
}
static volatile int g_break= 0;
-static int thread_break(void *unused)
+static int thread_break(void *UNUSED(arg))
{
return g_break;
}
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 81de553b209..4142522e003 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -1141,6 +1141,11 @@ float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist)
visifac = lar->dist/(lar->dist + dist[0]);
break;
case LA_FALLOFF_INVSQUARE:
+ /* NOTE: This seems to be a hack since commit r12045 says this
+ * option is similar to old Quad, but with slight changes.
+ * Correct inv square would be (which would be old Quad):
+ * visifac = lar->distkw / (lar->distkw + dist[0]*dist[0]);
+ */
visifac = lar->dist / (lar->dist + dist[0]*dist[0]);
break;
case LA_FALLOFF_SLIDERS:
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index e8c95a34ac4..1e8709d09f7 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -466,7 +466,7 @@ static void compute_radiance(ScatterTree *tree, float *co, float *rad)
/* building */
-static void sum_leaf_radiance(ScatterTree *tree, ScatterNode *node)
+static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
{
ScatterPoint *p;
float rad, totrad= 0.0f, inv;
@@ -540,7 +540,7 @@ static void sum_leaf_radiance(ScatterTree *tree, ScatterNode *node)
}
}
-static void sum_branch_radiance(ScatterTree *tree, ScatterNode *node)
+static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
{
ScatterNode *subnode;
float rad, totrad= 0.0f, inv;
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index be2c83a7edf..cdac27f352a 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -771,7 +771,7 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex
if (pit->version < 6) {
texres->tin = pit->result[0];
} else {
- texres->tin = result[0];
+ texres->tin = result[0]; /* XXX, assigning garbage value, fixme! */
}
if(rgbnor & TEX_NOR) {
diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c
index d3e8f4058c5..39e8315e7cf 100644
--- a/source/blender/render/intern/source/volume_precache.c
+++ b/source/blender/render/intern/source/volume_precache.c
@@ -89,7 +89,7 @@ int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int l
}
/* Uses ray tracing to check if a point is inside or outside an ObjectInstanceRen */
-int point_inside_obi(RayObject *tree, ObjectInstanceRen *obi, float *co)
+int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co)
{
Isect isect;
float vec[3] = {0.0f,0.0f,1.0f};
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index a58d96736d5..f3f31bf6b43 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -358,7 +358,7 @@ void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co)
/* phase function - determines in which directions the light
* is scattered in the volume relative to incoming direction
* and view direction */
-float vol_get_phasefunc(ShadeInput *shi, float g, float *w, float *wp)
+float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp)
{
const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI)
@@ -743,7 +743,6 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct
float tr[3] = {1.0,1.0,1.0};
Isect is;
float *startco, *endco;
- float density=0.f;
memset(shr, 0, sizeof(ShadeResult));
@@ -764,8 +763,7 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct
shr->alpha = shr->combined[3] = 1.f;
return;
}
-
- density = vol_get_density(shi, startco);
+
vol_get_transmittance(shi, tr, startco, endco);
copy_v3_v3(shr->combined, tr);
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 076d6355585..0a2ea54c5b0 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -178,7 +178,7 @@ static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
return 1;
}
-static void init_frame_smoke(VoxelData *vd, Tex *tex)
+static void init_frame_smoke(VoxelData *vd)
{
Object *ob;
ModifierData *md;
@@ -282,7 +282,7 @@ static void cache_voxeldata(struct Render *re,Tex *tex)
load_frame_image_sequence(vd, tex);
return;
case TEX_VD_SMOKE:
- init_frame_smoke(vd, tex);
+ init_frame_smoke(vd);
return;
case TEX_VD_BLENDERVOXEL:
if (!BLI_exists(vd->source_path)) return;
diff --git a/source/blender/verify/BLO_sign_verify_Header.h b/source/blender/verify/BLO_sign_verify_Header.h
deleted file mode 100644
index 9d73d9ba595..00000000000
--- a/source/blender/verify/BLO_sign_verify_Header.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- */
-
-#ifndef BLO_SIGN_VERIFY_H
-#define BLO_SIGN_VERIFY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef FREE_WINDOWS
-typedef int int32_t;
-#endif
-
-#include "BLO_sys_types.h"
-
-#define SIGNVERIFYHEADERSTRUCTSIZE sizeof(struct BLO_sign_verify_HeaderStruct)
-/* TODO use reasonable sizes
-Tests showed: pubKeyLen 64, cryptedKeyLen 64 bytes
-So we pick 2*64 bytes + tail for now : */
-
-#define MAXPUBKEYLEN 130
-#define MAXSIGNATURELEN 130
-
-struct BLO_sign_verify_HeaderStruct {
- uint8_t magic; /* poor mans header recognize check */
- uint32_t length; /* how much signed data is there */
- uint8_t pubKey[MAXPUBKEYLEN];
- uint32_t pubKeyLen; /* the actual pubKey length */
- uint8_t signature[MAXSIGNATURELEN];
- int32_t signatureLen; /* the actual signature length */
- uint32_t datacrc; /* data crc checksum */
- uint32_t headercrc; /* header minus crc itself checksum */
-};
-
-#define SIGNERHEADERSTRUCTSIZE sizeof(struct BLO_SignerHeaderStruct)
-#define MAXSIGNERLEN 100
-
-struct BLO_SignerHeaderStruct {
- uint8_t name[MAXSIGNERLEN]; /* the signers name (from the key) */
- uint8_t email[MAXSIGNERLEN]; /* the signers email (from the key) */
- uint8_t homeUrl[MAXSIGNERLEN]; /* the signers home page */
- uint8_t text[MAXSIGNERLEN]; /* optional additional user text */
- uint8_t pubKeyUrl1[MAXSIGNERLEN]; /* the signers pubKey store */
- uint8_t pubKeyUrl2[MAXSIGNERLEN]; /* the signers pubKey at NaN */
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_SIGN_VERIFY_H */
-
diff --git a/source/blender/verify/BLO_verify.h b/source/blender/verify/BLO_verify.h
deleted file mode 100644
index 5f7241c1cd5..00000000000
--- a/source/blender/verify/BLO_verify.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef BLO_VERIFY_H
-#define BLO_VERIFY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define VERIFY_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
-
-VERIFY_DECLARE_HANDLE(BLO_verifyStructHandle);
-
-/**
- * openssl verify initializer
- * @retval pointer to verify control structure
- */
- BLO_verifyStructHandle
-BLO_verify_begin(
- void *endControl);
-
-/**
- * openssl verify dataprocessor wrapper
- * @param BLO_verify Pointer to verify control structure
- * @param data Pointer to new data
- * @param dataIn New data amount
- * @retval streamGlueRead return value
- */
- int
-BLO_verify_process(
- BLO_verifyStructHandle BLO_verifyHandle,
- unsigned char *data,
- unsigned int dataIn);
-
-/**
- * openssl verify final call and cleanup
- * @param BLO_verify Pointer to verify control structure
- * @retval streamGlueRead return value
- */
- int
-BLO_verify_end(
- BLO_verifyStructHandle BLO_verifyHandle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_VERIFY_H */
-
diff --git a/source/blender/verify/Makefile b/source/blender/verify/Makefile
deleted file mode 100644
index 4451d5baf22..00000000000
--- a/source/blender/verify/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/verify
-DIRS = intern
-
-include nan_subdirs.mk
diff --git a/source/blender/verify/intern/BLO_verify.c b/source/blender/verify/intern/BLO_verify.c
deleted file mode 100644
index ccdc8a7e916..00000000000
--- a/source/blender/verify/intern/BLO_verify.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * openssl verify wrapper library
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "openssl/rsa.h"
-#include "openssl/ripemd.h"
-#include "openssl/objects.h"
-#include "zlib.h"
-
-#include "GEN_messaging.h"
-
-#include "BLO_readStreamGlue.h"
-#include "BLO_verify.h"
-#include "BLO_sign_verify_Header.h" /* used by verify and encrypt */
-
-#include "BLO_signer_info.h" /* external signer info struct */
-
-static struct BLO_SignerInfo g_SignerInfo = {"", "", ""};
-
-struct verifyStructType {
- struct readStreamGlueStruct *streamGlue;
- unsigned int streamDone;
- unsigned char headerbuffer[SIGNVERIFYHEADERSTRUCTSIZE];
- uint32_t datacrc;
- struct BLO_sign_verify_HeaderStruct *streamHeader;
- RIPEMD160_CTX ripemd160_ctx;
- struct BLO_SignerHeaderStruct *signerHeader;
- unsigned char signerHeaderBuffer[SIGNERHEADERSTRUCTSIZE];
- void *endControl;
-};
-
- BLO_verifyStructHandle
-BLO_verify_begin(
- void *endControl)
-{
- struct verifyStructType *control;
- control = malloc(sizeof(struct verifyStructType));
- if (!control) return NULL;
-
- control->streamGlue = NULL;
- control->streamDone = 0;
- memset(control->headerbuffer, 0, SIGNVERIFYHEADERSTRUCTSIZE);
- control->datacrc = 0;
-
- control->streamHeader = malloc(SIGNVERIFYHEADERSTRUCTSIZE);
- if (!control->streamHeader) {
- free(control);
- return NULL;
- }
- control->streamHeader->magic = 0;
- control->streamHeader->length = 0;
- strcpy(control->streamHeader->pubKey, "");
- control->streamHeader->pubKeyLen = 0;
- strcpy(control->streamHeader->signature, "");
- control->streamHeader->signatureLen = 0;
- control->streamHeader->datacrc = 0;
- control->streamHeader->headercrc = 0;
-
- RIPEMD160_Init(&(control->ripemd160_ctx));
-
- control->signerHeader = malloc(SIGNERHEADERSTRUCTSIZE);
- if (!control->signerHeader) {
- free(control->streamHeader);
- free(control);
- return NULL;
- }
- memset(control->signerHeader->name, 0, MAXSIGNERLEN);
- memset(control->signerHeader->email, 0, MAXSIGNERLEN);
- memset(control->signerHeader->homeUrl, 0, MAXSIGNERLEN);
- memset(control->signerHeader->text, 0, MAXSIGNERLEN);
- memset(control->signerHeader->pubKeyUrl1, 0, MAXSIGNERLEN);
- memset(control->signerHeader->pubKeyUrl2, 0, MAXSIGNERLEN);
-
- control->endControl = endControl;
- return((BLO_verifyStructHandle) control);
-}
-
- int
-BLO_verify_process(
- BLO_verifyStructHandle BLO_verifyHandle,
- unsigned char *data,
- unsigned int dataIn)
-{
- int err = 0;
- struct verifyStructType *BLO_verify =
- (struct verifyStructType *) BLO_verifyHandle;
-
- if (!BLO_verify) {
- err = BRS_SETFUNCTION(BRS_VERIFY) |
- BRS_SETGENERR(BRS_NULL);
- return err;
- }
-
- /* First check if we have our header filled in yet */
- if (BLO_verify->streamHeader->length == 0) {
- unsigned int processed;
- if (dataIn == 0) return err; /* really need data to do anything */
- processed = ((dataIn + BLO_verify->streamDone) <=
- SIGNVERIFYHEADERSTRUCTSIZE)
- ? dataIn : SIGNVERIFYHEADERSTRUCTSIZE;
- memcpy(BLO_verify->headerbuffer + BLO_verify->streamDone,
- data, processed);
- BLO_verify->streamDone += processed;
- dataIn -= processed;
- data += processed;
- if (BLO_verify->streamDone == SIGNVERIFYHEADERSTRUCTSIZE) {
- /* we have the whole header, absorb it */
- struct BLO_sign_verify_HeaderStruct *header;
- uint32_t crc;
-
- header = (struct BLO_sign_verify_HeaderStruct *)
- BLO_verify->headerbuffer;
- crc = crc32(0L, (const Bytef *) header,
- SIGNVERIFYHEADERSTRUCTSIZE - 4);
-
- if (header->magic == 'A') {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_sign_verify_HeaderStruct Magic confirmed\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "ERROR BLO_sign_verify_HeaderStruct Magic NOT confirmed\n");
-#endif
- err = BRS_SETFUNCTION(BRS_VERIFY) |
- BRS_SETGENERR(BRS_MAGIC);
- if (BLO_verify->streamGlue) free(BLO_verify->streamGlue);
- if (BLO_verify->streamHeader) free(BLO_verify->streamHeader);
- if (BLO_verify->signerHeader) free(BLO_verify->signerHeader);
- free(BLO_verify);
- return err;
- }
-
- if (crc == ntohl(header->headercrc)) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,"BLO_sign_verify_Header CRC correct\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,"ERROR BLO_sign_verify_Header CRC NOT correct\n");
-#endif
- err = BRS_SETFUNCTION(BRS_VERIFY) |
- BRS_SETGENERR(BRS_CRCHEADER);
- if (BLO_verify->streamGlue) free(BLO_verify->streamGlue);
- if (BLO_verify->streamHeader) free(BLO_verify->streamHeader);
- if (BLO_verify->signerHeader) free(BLO_verify->signerHeader);
- free(BLO_verify);
- return err;
- }
- BLO_verify->streamHeader->length = ntohl(header->length);
- BLO_verify->streamHeader->pubKeyLen = ntohl(header->pubKeyLen);
- memcpy(BLO_verify->streamHeader->pubKey, header->pubKey,
- BLO_verify->streamHeader->pubKeyLen);
- BLO_verify->streamHeader->signatureLen =
- ntohl(header->signatureLen);
- memcpy(BLO_verify->streamHeader->signature, header->signature,
- BLO_verify->streamHeader->signatureLen);
- BLO_verify->streamHeader->datacrc = ntohl(header->datacrc);
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_verify_process gets %u bytes\n",
- (unsigned int) BLO_verify->streamHeader->length);
-#endif
-
- }
- }
-
- /* Is there really (still) new data available ? */
- if (dataIn > 0) {
- /* BLO_SignerHeaderStruct */
- if (BLO_verify->signerHeader->name[0] == 0) {
- /* we don't have our signerHeader complete yet */
- unsigned int processed;
- processed = ((dataIn + BLO_verify->streamDone -
- SIGNVERIFYHEADERSTRUCTSIZE) <= SIGNERHEADERSTRUCTSIZE)
- ? dataIn : SIGNERHEADERSTRUCTSIZE;
- memcpy(BLO_verify->signerHeaderBuffer +
- BLO_verify->streamDone - SIGNVERIFYHEADERSTRUCTSIZE,
- data, processed);
- BLO_verify->streamDone += processed;
- dataIn -= processed;
- data += processed;
- if (BLO_verify->streamDone == SIGNVERIFYHEADERSTRUCTSIZE +
- SIGNERHEADERSTRUCTSIZE) {
- /* we have the whole header, absorb it */
- struct BLO_SignerHeaderStruct *signerHeader;
- signerHeader = (struct BLO_SignerHeaderStruct *)
- BLO_verify->signerHeaderBuffer;
- strncpy(BLO_verify->signerHeader->name,
- signerHeader->name, MAXSIGNERLEN-1);
- strncpy(BLO_verify->signerHeader->email,
- signerHeader->email, MAXSIGNERLEN-1);
- strncpy(BLO_verify->signerHeader->homeUrl,
- signerHeader->homeUrl, MAXSIGNERLEN-1);
- strncpy(BLO_verify->signerHeader->text,
- signerHeader->text, MAXSIGNERLEN-1);
- strncpy(BLO_verify->signerHeader->pubKeyUrl1,
- signerHeader->pubKeyUrl1, MAXSIGNERLEN-1);
- strncpy(BLO_verify->signerHeader->pubKeyUrl2,
- signerHeader->pubKeyUrl2, MAXSIGNERLEN-1);
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "name %s\nemail %s\nhomeUrl %s\ntext %s\n",
- BLO_verify->signerHeader->name,
- BLO_verify->signerHeader->email,
- BLO_verify->signerHeader->homeUrl,
- BLO_verify->signerHeader->text);
- fprintf(GEN_errorstream,
- "pubKeyUrl1 %s\npubKeyUrl2 %s\n",
- BLO_verify->signerHeader->pubKeyUrl1,
- BLO_verify->signerHeader->pubKeyUrl2);
-#endif
- /* also update the signature and crc checksum */
- RIPEMD160_Update(&(BLO_verify->ripemd160_ctx),
- BLO_verify->signerHeaderBuffer,
- SIGNERHEADERSTRUCTSIZE);
-
- /* update datacrc */
- BLO_verify->datacrc = crc32(
- BLO_verify->datacrc, (const Bytef *)
- BLO_verify->signerHeaderBuffer,
- SIGNERHEADERSTRUCTSIZE);
- }
- }
- }
-
- /* Is there really (still) new data available ? */
- if (dataIn > 0) {
- RIPEMD160_Update(&(BLO_verify->ripemd160_ctx), data, dataIn);
-
- /* update datacrc */
- BLO_verify->datacrc = crc32(
- BLO_verify->datacrc, (const Bytef *) data, dataIn);
-
- BLO_verify->streamDone += dataIn;
-
- /* give data to streamGlueRead, it will find out what to do next */
- err = readStreamGlue(
- BLO_verify->endControl,
- &(BLO_verify->streamGlue),
- (unsigned char *) data,
- dataIn);
- }
- return err;
-}
-
-/**
- * openssl verify final call and cleanup
- * @param BLO_verify Pointer to verify control structure
- * @retval streamGlueRead return value
- */
- int
-BLO_verify_end(
- BLO_verifyStructHandle BLO_verifyHandle)
-{
- int err = 0;
- unsigned char *digest;
- static unsigned char rsa_e[] = "\x01\x00\x01";
- RSA *rsa = NULL;
- int verifySuccess;
- struct verifyStructType *BLO_verify =
- (struct verifyStructType *) BLO_verifyHandle;
-
- if (!BLO_verify) {
- err = BRS_SETFUNCTION(BRS_VERIFY) |
- BRS_SETGENERR(BRS_NULL);
- return err;
- }
-
- if (BLO_verify->streamDone == BLO_verify->streamHeader->length +
- SIGNVERIFYHEADERSTRUCTSIZE) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Signed data length is correct\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Signed data length is NOT correct\n");
-#endif
- err = BRS_SETFUNCTION(BRS_VERIFY) |
- BRS_SETGENERR(BRS_DATALEN);
- if (BLO_verify->streamGlue) free(BLO_verify->streamGlue);
- if (BLO_verify->streamHeader) free(BLO_verify->streamHeader);
- if (BLO_verify->signerHeader) free(BLO_verify->signerHeader);
- free(BLO_verify);
- return err;
- }
-
- if (BLO_verify->datacrc == BLO_verify->streamHeader->datacrc) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Signed data CRC is correct\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Signed data CRC is NOT correct\n");
-#endif
- err = BRS_SETFUNCTION(BRS_VERIFY) |
- BRS_SETGENERR(BRS_CRCDATA);
- if (BLO_verify->streamGlue) free(BLO_verify->streamGlue);
- if (BLO_verify->streamHeader) free(BLO_verify->streamHeader);
- if (BLO_verify->signerHeader) free(BLO_verify->signerHeader);
- free(BLO_verify);
- return err;
- }
-
- digest = malloc(RIPEMD160_DIGEST_LENGTH);
- if (!digest) {
- err = BRS_SETFUNCTION(BRS_VERIFY) |
- BRS_SETGENERR(BRS_MALLOC);
- if (BLO_verify->streamGlue) free(BLO_verify->streamGlue);
- if (BLO_verify->streamHeader) free(BLO_verify->streamHeader);
- if (BLO_verify->signerHeader) free(BLO_verify->signerHeader);
- free(BLO_verify);
- return err;
- }
-
- RIPEMD160_Final(digest, &(BLO_verify->ripemd160_ctx));
-
- rsa = RSA_new();
- if (rsa == NULL) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Error in RSA_new\n");
-#endif
- err = BRS_SETFUNCTION(BRS_VERIFY) |
- BRS_SETSPECERR(BRS_RSANEWERROR);
- free(digest);
- if (BLO_verify->streamGlue) free(BLO_verify->streamGlue);
- if (BLO_verify->streamHeader) free(BLO_verify->streamHeader);
- if (BLO_verify->signerHeader) free(BLO_verify->signerHeader);
- free(BLO_verify);
- return err;
- }
- /* static exponent */
- rsa->e = BN_bin2bn(rsa_e, sizeof(rsa_e)-1, rsa->e);
-
- /* public part into rsa->n */
- rsa->n = BN_bin2bn(BLO_verify->streamHeader->pubKey,
- BLO_verify->streamHeader->pubKeyLen,
- rsa->n);
- /*DEBUG RSA_print_fp(stdout, rsa, 0); */
-
- /* verify the signature */
- verifySuccess = RSA_verify(NID_ripemd160, digest, RIPEMD160_DIGEST_LENGTH,
- BLO_verify->streamHeader->signature,
- BLO_verify->streamHeader->signatureLen, rsa);
- if (verifySuccess == 1) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Signature verified\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Signature INCORRECT\n");
-#endif
- err = BRS_SETFUNCTION(BRS_VERIFY) |
- BRS_SETSPECERR(BRS_SIGFAILED);
- }
-
-/* copy signer information to external struct */
-
- strncpy(g_SignerInfo.name, BLO_verify->signerHeader->name, MAXSIGNERLEN-1);
- strncpy(g_SignerInfo.email, BLO_verify->signerHeader->email, MAXSIGNERLEN-1);
- strncpy(g_SignerInfo.homeUrl, BLO_verify->signerHeader->homeUrl, MAXSIGNERLEN-1);
-
- free(digest);
- free(BLO_verify->streamGlue);
- free(BLO_verify->streamHeader);
- free(BLO_verify->signerHeader);
- free(BLO_verify);
- RSA_free(rsa);
-
- return err;
-}
-
-struct BLO_SignerInfo *BLO_getSignerInfo(){
- return &g_SignerInfo;
-}
-
-int BLO_isValidSignerInfo(struct BLO_SignerInfo *info){
- return info->name[0] != 0;
-}
-
-void BLO_clrSignerInfo(struct BLO_SignerInfo *info)
-{
- info->name[0] = 0;
-}
-
diff --git a/source/blender/verify/intern/Makefile b/source/blender/verify/intern/Makefile
deleted file mode 100644
index 009fd1c6e28..00000000000
--- a/source/blender/verify/intern/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = verify
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../readstreamglue
-
-CPPFLAGS += -I$(NAN_OPENSSL)/include
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 690d8ad0f75..2a36e91ac66 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -31,6 +31,10 @@
/* dna-savable wmStructs here */
#include "DNA_windowmanager_types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct bContext;
struct IDProperty;
struct wmEvent;
@@ -103,7 +107,7 @@ wmKeyConfig *WM_keyconfig_new (struct wmWindowManager *wm, char *idname);
wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, char *idname);
void WM_keyconfig_remove (struct wmWindowManager *wm, struct wmKeyConfig *keyconf);
void WM_keyconfig_free (struct wmKeyConfig *keyconf);
-void WM_keyconfig_userdef(struct wmWindowManager *wm);
+void WM_keyconfig_userdef(void);
void WM_keymap_init (struct bContext *C);
void WM_keymap_free (struct wmKeyMap *keymap);
@@ -115,7 +119,7 @@ wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, char *idname, int type
wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, char *idname, int type,
int val, int modifier, int keymodifier);
-void WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
+void WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len);
wmKeyMap *WM_keymap_list_find(ListBase *lb, char *idname, int spaceid, int regionid);
@@ -216,7 +220,7 @@ struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *
int WM_operator_poll (struct bContext *C, struct wmOperatorType *ot);
int WM_operator_call (struct bContext *C, struct wmOperator *op);
int WM_operator_repeat (struct bContext *C, struct wmOperator *op);
-int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties);
+int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties);
int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, int context, struct PointerRNA *properties, struct ReportList *reports);
void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */
@@ -338,5 +342,14 @@ void WM_clipboard_text_set(char *buf, int selection);
void WM_progress_set(struct wmWindow *win, float progress);
void WM_progress_clear(struct wmWindow *win);
+#ifdef WIN32
+ /* Windows System Console */
+void WM_toggle_console(struct bContext *C, short show);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* WM_API_H */
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 73f1fe8cbd3..7af6de6c86c 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -28,6 +28,10 @@
#ifndef WM_TYPES_H
#define WM_TYPES_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct bContext;
struct wmEvent;
struct wmWindowManager;
@@ -187,6 +191,7 @@ typedef struct wmNotifier {
#define ND_TOOLSETTINGS (15<<16)
#define ND_LAYER (16<<16)
#define ND_FRAME_RANGE (17<<16)
+#define ND_WORLD (92<<16)
#define ND_LAYER_CONTENT (101<<16)
/* NC_OBJECT Object */
@@ -511,5 +516,9 @@ typedef struct RecentFile {
} RecentFile;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* WM_TYPES_H */
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 148932fa941..1b0870194a6 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -205,7 +205,7 @@ void WM_keymap_init(bContext *C)
/* create default key config */
wm_window_keymap(wm->defaultconf);
ED_spacetypes_keymap(wm->defaultconf);
- WM_keyconfig_userdef(wm);
+ WM_keyconfig_userdef();
wm->initialized |= WM_INIT_KEYMAP;
}
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 81417e8f8f1..9123cdeef20 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -127,7 +127,7 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
wm_paintcursor_draw(C, ar);
- ED_area_overdraw_flush(C, sa, ar);
+ ED_area_overdraw_flush(sa, ar);
CTX_wm_region_set(C, NULL);
}
}
@@ -242,7 +242,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
wm_paintcursor_draw(C, ar);
- ED_area_overdraw_flush(C, sa, ar);
+ ED_area_overdraw_flush(sa, ar);
CTX_wm_region_set(C, NULL);
if(exchange)
@@ -253,7 +253,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
wm_paintcursor_draw(C, ar);
- ED_area_overdraw_flush(C, sa, ar);
+ ED_area_overdraw_flush(sa, ar);
CTX_wm_region_set(C, NULL);
ar->swap= WIN_BOTH_OK;
@@ -592,7 +592,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
if(ar->swinid && ar->do_draw) {
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
- ED_area_overdraw_flush(C, sa, ar);
+ ED_area_overdraw_flush(sa, ar);
CTX_wm_region_set(C, NULL);
copytex= 1;
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 590d28012f9..47ca4314cc7 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1452,11 +1452,24 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
wmWindow *win = CTX_wm_window(C);
if (win && win->eventstate->prevtype == event->type && win->eventstate->prevval == KM_PRESS) {
- /* test for double click first */
- if ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time) {
+ /* test for double click first,
+ * note1: this can be problematic because single click operators can get the
+ * double click event but then with old mouse coords which is highly confusing,
+ * so check for mouse moves too.
+ * note2: the first click event will be handled but still used to create a
+ * double click event if clicking again quickly.
+ * If no double click events are found itwill fallback to a single click.
+ * So a double click event can result in 2 successive single click calls
+ * if its not handled by the keymap - campbell */
+ if ( (ABS(event->x - win->eventstate->prevclickx)) <= 2 &&
+ (ABS(event->y - win->eventstate->prevclicky)) <= 2 &&
+ ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time)
+ ) {
event->val = KM_DBL_CLICK;
- event->x = win->eventstate->prevclickx;
- event->y = win->eventstate->prevclicky;
+ /* removed this because in cases where we're this is used as a single click
+ * event, this will give old coords, since the distance is checked above, using new coords should be ok. */
+ // event->x = win->eventstate->prevclickx;
+ // event->y = win->eventstate->prevclicky;
action |= wm_handlers_do(C, event, handlers);
}
@@ -1894,7 +1907,7 @@ wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap
}
/* priorities not implemented yet, for time being just insert in begin of list */
-wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int priority)
+wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int UNUSED(priority))
{
wmEventHandler *handler;
@@ -2067,7 +2080,7 @@ static int convert_key(GHOST_TKey key)
case GHOST_kKeyRightShift: return RIGHTSHIFTKEY;
case GHOST_kKeyLeftControl: return LEFTCTRLKEY;
case GHOST_kKeyRightControl: return RIGHTCTRLKEY;
- case GHOST_kKeyCommand: return COMMANDKEY;
+ case GHOST_kKeyOS: return OSKEY;
case GHOST_kKeyLeftAlt: return LEFTALTKEY;
case GHOST_kKeyRightAlt: return RIGHTALTKEY;
@@ -2167,7 +2180,7 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
/* windows store own event queues, no bContext here */
/* time is in 1000s of seconds, from ghost */
-void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata)
+void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int UNUSED(time), void *customdata)
{
wmWindow *owin;
wmEvent event, *evt= win->eventstate;
@@ -2324,7 +2337,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t
if(event.val==KM_PRESS && (evt->ctrl || evt->shift || evt->oskey))
event.alt= evt->alt = 3; // define?
}
- else if (event.type==COMMANDKEY) {
+ else if (event.type==OSKEY) {
event.oskey= evt->oskey= (event.val==KM_PRESS);
if(event.val==KM_PRESS && (evt->ctrl || evt->alt || evt->shift))
event.oskey= evt->oskey = 3; // define?
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 2888cf9b8d0..50d6c885022 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -259,8 +259,7 @@ static void wm_init_userdef(bContext *C)
/* set the python auto-execute setting from user prefs */
/* disabled by default, unless explicitly enabled in the command line */
if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC;
-
- if(U.tempdir[0]) strncpy(btempdir, U.tempdir, FILE_MAXDIR+FILE_MAXFILE);
+ if(U.tempdir[0]) BLI_where_is_temp(btempdir, 1);
}
void WM_read_file(bContext *C, char *name, ReportList *reports)
@@ -284,7 +283,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
/* also exit screens and editors */
wm_window_match_init(C, &wmbase);
- retval= BKE_read_file(C, name, NULL, reports);
+ retval= BKE_read_file(C, name, reports);
G.save_over = 1;
/* this flag is initialized by the operator but overwritten on read.
@@ -336,13 +335,10 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
/* called on startup, (context entirely filled with NULLs) */
/* or called for 'New File' */
/* op can be NULL */
-/* note: G.sce is used to store the last saved path so backup and restore after loading
- * G.main->name is similar to G.sce but when loading from memory set the name to startup.blend
- * ...this could be changed but seems better then setting to "" */
int WM_read_homefile(bContext *C, wmOperator *op)
{
ListBase wmbase;
- char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
+ char tstr[FILE_MAXDIR+FILE_MAXFILE];
int from_memory= op && strcmp(op->type->idname, "WM_OT_read_factory_settings")==0;
int success;
@@ -352,7 +348,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
if (!from_memory) {
char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
if (cfgdir) {
- BLI_make_file_string(G.sce, tstr, cfgdir, BLENDER_STARTUP_FILE);
+ BLI_make_file_string(G.main->name, tstr, cfgdir, BLENDER_STARTUP_FILE);
} else {
tstr[0] = '\0';
from_memory = 1;
@@ -361,7 +357,6 @@ int WM_read_homefile(bContext *C, wmOperator *op)
}
}
}
- strcpy(scestr, G.sce); /* temporary store */
/* prevent loading no UI */
G.fileflags &= ~G_FILE_NO_UI;
@@ -370,9 +365,9 @@ int WM_read_homefile(bContext *C, wmOperator *op)
wm_window_match_init(C, &wmbase);
if (!from_memory && BLI_exists(tstr)) {
- success = BKE_read_file(C, tstr, NULL, NULL);
+ success = BKE_read_file(C, tstr, NULL);
} else {
- success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL, NULL);
+ success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL);
if (wmbase.first == NULL) wm_clear_default_size(C);
}
@@ -384,7 +379,6 @@ int WM_read_homefile(bContext *C, wmOperator *op)
wm_window_match_do(C, &wmbase);
WM_check(C); /* opens window(s), checks keymaps */
- strcpy(G.sce, scestr); /* restore */
G.main->name[0]= '\0';
wm_init_userdef(C);
@@ -441,9 +435,6 @@ void read_history(void)
for (l= lines, num= 0; l && (num<U.recent_files); l= l->next) {
line = l->link;
if (line[0] && BLI_exists(line)) {
- if (num==0)
- strcpy(G.sce, line); /* note: this seems highly dodgy since the file isnt actually read. please explain. - campbell */
-
recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
BLI_addtail(&(G.recent_files), recent);
recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(line)+1), "name of file");
@@ -469,14 +460,14 @@ static void write_history(void)
recent = G.recent_files.first;
/* refresh recent-files.txt of recent opened files, when current file was changed */
- if(!(recent) || (strcmp(recent->filepath, G.sce)!=0)) {
+ if(!(recent) || (strcmp(recent->filepath, G.main->name)!=0)) {
fp= fopen(name, "w");
if (fp) {
/* add current file to the beginning of list */
recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
- recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.sce)+1), "name of file");
+ recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.main->name)+1), "name of file");
recent->filepath[0] = '\0';
- strcpy(recent->filepath, G.sce);
+ strcpy(recent->filepath, G.main->name);
BLI_addhead(&(G.recent_files), recent);
/* write current file to recent-files.txt */
fprintf(fp, "%s\n", recent->filepath);
@@ -485,7 +476,7 @@ static void write_history(void)
/* write rest of recent opened files to recent-files.txt */
while((i<U.recent_files) && (recent)){
/* this prevents to have duplicities in list */
- if (strcmp(recent->filepath, G.sce)!=0) {
+ if (strcmp(recent->filepath, G.main->name)!=0) {
fprintf(fp, "%s\n", recent->filepath);
recent = recent->next;
}
@@ -527,7 +518,7 @@ static void do_history(char *name, ReportList *reports)
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
}
-static ImBuf *blend_file_thumb(const char *path, Scene *scene, int **thumb_pt)
+static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
{
/* will be scaled down, but gives some nice oversampling */
ImBuf *ibuf;
@@ -573,7 +564,7 @@ static ImBuf *blend_file_thumb(const char *path, Scene *scene, int **thumb_pt)
int write_crash_blend(void)
{
char path[FILE_MAX];
- BLI_strncpy(path, G.sce, sizeof(path));
+ BLI_strncpy(path, G.main->name, sizeof(path));
BLI_replace_extension(path, sizeof(path), "_crash.blend");
if(BLO_write_file(G.main, path, G.fileflags, NULL, NULL)) {
printf("written: %s\n", path);
@@ -628,14 +619,13 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
ED_paint_force_update(C);
/* blend file thumbnail */
- ibuf_thumb= blend_file_thumb(di, CTX_data_scene(C), &thumb);
+ ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb);
/* rename to .blend1, do this as last before write */
do_history(di, reports);
if (BLO_write_file(CTX_data_main(C), di, fileflags, reports, thumb)) {
if(!copy) {
- strcpy(G.sce, di);
G.relbase_valid = 1;
strcpy(G.main->name, di); /* is guaranteed current file */
@@ -736,7 +726,7 @@ void WM_autosave_init(wmWindowManager *wm)
wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0);
}
-void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
+void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt))
{
wmWindow *win;
wmEventHandler *handler;
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index e87d2d79c39..8dcf65886e4 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -121,7 +121,7 @@ void WM_gestures_remove(bContext *C)
/* tweak and line gestures */
#define TWEAK_THRESHOLD 10
-int wm_gesture_evaluate(bContext *C, wmGesture *gesture)
+int wm_gesture_evaluate(wmGesture *gesture)
{
if(gesture->type==WM_GESTURE_TWEAK) {
rcti *rect= gesture->customdata;
@@ -159,7 +159,7 @@ int wm_gesture_evaluate(bContext *C, wmGesture *gesture)
/* ******************* gesture draw ******************* */
-static void wm_gesture_draw_rect(wmWindow *win, wmGesture *gt)
+static void wm_gesture_draw_rect(wmGesture *gt)
{
rcti *rect= (rcti *)gt->customdata;
@@ -183,7 +183,7 @@ static void wm_gesture_draw_rect(wmWindow *win, wmGesture *gt)
glDisable(GL_LINE_STIPPLE);
}
-static void wm_gesture_draw_line(wmWindow *win, wmGesture *gt)
+static void wm_gesture_draw_line(wmGesture *gt)
{
rcti *rect= (rcti *)gt->customdata;
@@ -199,7 +199,7 @@ static void wm_gesture_draw_line(wmWindow *win, wmGesture *gt)
}
-static void wm_gesture_draw_circle(wmWindow *win, wmGesture *gt)
+static void wm_gesture_draw_circle(wmGesture *gt)
{
rcti *rect= (rcti *)gt->customdata;
@@ -244,7 +244,7 @@ static void draw_filled_lasso(wmGesture *gt)
/* highly unlikely this will fail, but could crash if (gt->points == 0) */
if(firstv) {
BLI_addfilledge(firstv, v);
- BLI_edgefill(0, 0);
+ BLI_edgefill(0);
glEnable(GL_BLEND);
glColor4f(1.0, 1.0, 1.0, 0.05);
@@ -261,7 +261,7 @@ static void draw_filled_lasso(wmGesture *gt)
}
}
-static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt)
+static void wm_gesture_draw_lasso(wmGesture *gt)
{
short *lasso= (short *)gt->customdata;
int i;
@@ -320,23 +320,23 @@ void wm_gesture_draw(wmWindow *win)
wmSubWindowSet(win, gt->swinid);
if(gt->type==WM_GESTURE_RECT)
- wm_gesture_draw_rect(win, gt);
+ wm_gesture_draw_rect(gt);
else if(gt->type==WM_GESTURE_TWEAK)
- wm_gesture_draw_line(win, gt);
+ wm_gesture_draw_line(gt);
else if(gt->type==WM_GESTURE_CIRCLE)
- wm_gesture_draw_circle(win, gt);
+ wm_gesture_draw_circle(gt);
else if(gt->type==WM_GESTURE_CROSS_RECT) {
if(gt->mode==1)
- wm_gesture_draw_rect(win, gt);
+ wm_gesture_draw_rect(gt);
else
wm_gesture_draw_cross(win, gt);
}
else if(gt->type==WM_GESTURE_LINES)
- wm_gesture_draw_lasso(win, gt);
+ wm_gesture_draw_lasso(gt);
else if(gt->type==WM_GESTURE_LASSO)
- wm_gesture_draw_lasso(win, gt);
+ wm_gesture_draw_lasso(gt);
else if(gt->type==WM_GESTURE_STRAIGHTLINE)
- wm_gesture_draw_line(win, gt);
+ wm_gesture_draw_line(gt);
}
}
@@ -351,5 +351,3 @@ void wm_gesture_tag_redraw(bContext *C)
wm_tag_redraw_overlay(win, ar);
}
-
-
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 983361f01ff..b319058ce5c 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -167,10 +167,10 @@ void WM_init(bContext *C, int argc, char **argv)
read_history();
- if(G.sce[0] == 0)
- BLI_make_file_string("/", G.sce, BLI_getDefaultDocumentFolder(), "untitled.blend");
+ if(G.main->name[0] == 0)
+ BLI_make_file_string("/", G.main->name, BLI_getDefaultDocumentFolder(), "untitled.blend");
- BLI_strncpy(G.lib, G.sce, FILE_MAX);
+ BLI_strncpy(G.lib, G.main->name, FILE_MAX);
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index f1873b14232..436494be975 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -118,7 +118,7 @@ void WM_keyconfig_free(wmKeyConfig *keyconf)
MEM_freeN(keyconf);
}
-void WM_keyconfig_userdef(wmWindowManager *wm)
+void WM_keyconfig_userdef(void)
{
wmKeyMap *km;
wmKeyMapItem *kmi;
@@ -419,7 +419,7 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
return str;
}
-static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int opcontext, IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r)
+static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext), IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r)
{
wmWindowManager *wm= CTX_wm_manager(C);
wmEventHandler *handler;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 121d2d3d21a..ef0572d3a12 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -31,7 +31,10 @@
#include <ctype.h>
#include <stdio.h>
#include <stddef.h>
-
+#ifdef WIN32
+#include <windows.h>
+#include <io.h>
+#endif
#include "DNA_ID.h"
#include "DNA_object_types.h"
@@ -619,7 +622,7 @@ void WM_operator_properties_free(PointerRNA *ptr)
/* ************ default op callbacks, exported *********** */
/* invoke callback, uses enum property named "type" */
-int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
+int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
PropertyRNA *prop= op->type->prop;
uiPopupMenu *pup;
@@ -724,7 +727,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op)
}
-int WM_enum_search_invoke(bContext *C, wmOperator *op, wmEvent *event)
+int WM_enum_search_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
uiPupBlock(C, wm_enum_search_menu, op);
return OPERATOR_CANCELLED;
@@ -751,13 +754,13 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, char *message)
}
-int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *event)
+int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
return WM_operator_confirm_message(C, op, NULL);
}
/* op->invoke, opens fileselect if path property not set, otherwise executes */
-int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *event)
+int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if (RNA_property_is_set(op->ptr, "filepath")) {
return WM_operator_call(C, op);
@@ -862,7 +865,7 @@ int WM_operator_winactive(bContext *C)
}
/* op->invoke */
-static void redo_cb(bContext *C, void *arg_op, int event)
+static void redo_cb(bContext *C, void *arg_op, int UNUSED(event))
{
wmOperator *lastop= arg_op;
@@ -903,7 +906,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
op->layout= NULL;
}
else
- uiDefAutoButsRNA(C, layout, &ptr, columns);
+ uiDefAutoButsRNA(layout, &ptr, columns);
uiPopupBoundsBlock(block, 4.0f, 0, 0);
uiEndBlock(C, block);
@@ -922,7 +925,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
uiPupBlockClose(C, block);
}
-void dialog_check_cb(bContext *C, void *op_ptr, void *dummy2)
+void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg))
{
wmOperator *op= op_ptr;
if(op->type->check) {
@@ -966,7 +969,7 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData)
op->layout= NULL;
}
else
- uiDefAutoButsRNA(C, layout, &ptr, columns);
+ uiDefAutoButsRNA(layout, &ptr, columns);
uiBlockSetFunc(block, NULL, NULL, NULL);
@@ -1014,7 +1017,7 @@ static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData)
return block;
}
-int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *event)
+int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
int retval= OPERATOR_CANCELLED;
@@ -1083,7 +1086,7 @@ static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op)
op->layout= NULL;
}
else
- uiDefAutoButsRNA(C, layout, op->ptr, 2);
+ uiDefAutoButsRNA(layout, op->ptr, 2);
uiPopupBoundsBlock(block, 4.0f, 0, 0);
uiEndBlock(C, block);
@@ -1100,7 +1103,7 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
RNA_int_set(op->ptr, "debugval", G.rt);
@@ -1127,7 +1130,7 @@ static void WM_OT_debug_menu(wmOperatorType *ot)
/* ***************** Splash Screen ************************* */
-static void wm_block_splash_close(bContext *C, void *arg_block, void *arg_unused)
+static void wm_block_splash_close(bContext *C, void *arg_block, void *UNUSED(arg))
{
uiPupBlockClose(C, arg_block);
}
@@ -1136,7 +1139,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
/* XXX: hack to refresh splash screen with updated prest menu name,
* since popup blocks don't get regenerated like panels do */
-void wm_block_splash_refreshmenu (bContext *C, void *arg_block, void *unused)
+void wm_block_splash_refreshmenu (bContext *UNUSED(C), void *UNUSED(arg_block), void *UNUSED(arg))
{
/* ugh, causes crashes in other buttons, disabling for now until
* a better fix
@@ -1145,7 +1148,7 @@ void wm_block_splash_refreshmenu (bContext *C, void *arg_block, void *unused)
*/
}
-static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused)
+static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg))
{
uiBlock *block;
uiBut *but;
@@ -1153,7 +1156,6 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
uiStyle *style= U.uistyles.first;
struct RecentFile *recent;
int i;
- Menu menu= {0};
MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE);
char url[64];
@@ -1193,9 +1195,13 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
uiBlockSetEmboss(block, UI_EMBOSS);
/* show the splash menu (containing interaction presets), using python */
if (mt) {
+ Menu menu= {0};
menu.layout= layout;
menu.type= mt;
mt->draw(C, &menu);
+
+// wmWindowManager *wm= CTX_wm_manager(C);
+// uiItemM(layout, C, "USERPREF_MT_keyconfigs", U.keyconfigstr, 0);
}
uiBlockSetEmboss(block, UI_EMBOSSP);
@@ -1228,7 +1234,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
return block;
}
-static int wm_splash_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int wm_splash_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
uiPupBlock(C, wm_block_create_splash, NULL);
@@ -1247,7 +1253,7 @@ static void WM_OT_splash(wmOperatorType *ot)
/* ***************** Search menu ************************* */
-static void operator_call_cb(struct bContext *C, void *arg1, void *arg2)
+static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2)
{
wmOperatorType *ot= arg2;
@@ -1255,7 +1261,7 @@ static void operator_call_cb(struct bContext *C, void *arg1, void *arg2)
WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
}
-static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items)
+static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items)
{
wmOperatorType *ot = WM_operatortype_first();
@@ -1282,7 +1288,7 @@ static void operator_search_cb(const struct bContext *C, void *arg, char *str, u
}
}
-static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op)
+static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op))
{
static char search[256]= "";
wmEvent event;
@@ -1312,15 +1318,13 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op)
return block;
}
-static int wm_search_menu_exec(bContext *C, wmOperator *op)
+static int wm_search_menu_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
{
-
return OPERATOR_FINISHED;
}
-static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
-
uiPupBlock(C, wm_block_search_menu, op);
return OPERATOR_CANCELLED;
@@ -1386,7 +1390,7 @@ static void WM_OT_window_duplicate(wmOperatorType *ot)
ot->idname= "WM_OT_window_duplicate";
ot->description="Duplicate the current Blender window";
- ot->exec= wm_window_duplicate_op;
+ ot->exec= wm_window_duplicate_exec;
ot->poll= wm_operator_winactive_normal;
}
@@ -1437,9 +1441,9 @@ static void open_set_use_scripts(wmOperator *op)
RNA_boolean_set(op->ptr, "use_scripts", !(U.flag & USER_SCRIPT_AUTOEXEC_DISABLE));
}
-static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- RNA_string_set(op->ptr, "filepath", G.sce);
+ RNA_string_set(op->ptr, "filepath", G.main->name);
open_set_load_ui(op);
open_set_use_scripts(op);
@@ -1493,7 +1497,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
/* **************** link/append *************** */
-static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
if(!RNA_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
@@ -1718,7 +1722,7 @@ static int wm_recover_auto_save_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
char filename[FILE_MAX];
@@ -1766,13 +1770,13 @@ static void save_set_compress(wmOperator *op)
}
}
-static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
char name[FILE_MAX];
save_set_compress(op);
- BLI_strncpy(name, G.sce, FILE_MAX);
+ BLI_strncpy(name, G.main->name, FILE_MAX);
untitled(name);
RNA_string_set(op->ptr, "filepath", name);
@@ -1793,7 +1797,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
if(RNA_property_is_set(op->ptr, "filepath"))
RNA_string_get(op->ptr, "filepath", path);
else {
- BLI_strncpy(path, G.sce, FILE_MAX);
+ BLI_strncpy(path, G.main->name, FILE_MAX);
untitled(path);
}
@@ -1817,7 +1821,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
}
/* function used for WM_OT_save_mainfile too */
-static int blend_save_check(bContext *C, wmOperator *op)
+static int blend_save_check(bContext *UNUSED(C), wmOperator *op)
{
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
@@ -1847,7 +1851,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
/* *************** save file directly ******** */
-static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
char name[FILE_MAX];
int check_existing=1;
@@ -1858,7 +1862,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
save_set_compress(op);
- BLI_strncpy(name, G.sce, FILE_MAX);
+ BLI_strncpy(name, G.main->name, FILE_MAX);
untitled(name);
RNA_string_set(op->ptr, "filepath", name);
@@ -1904,7 +1908,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(!RNA_property_is_set(op->ptr, "filepath")) {
char filepath[FILE_MAX];
- BLI_strncpy(filepath, G.sce, sizeof(filepath));
+ BLI_strncpy(filepath, G.main->name, sizeof(filepath));
BLI_replace_extension(filepath, sizeof(filepath), ".dae");
RNA_string_set(op->ptr, "filepath", filepath);
}
@@ -1982,7 +1986,7 @@ static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
ot->idname= "WM_OT_window_fullscreen_toggle";
ot->description="Toggle the current window fullscreen";
- ot->exec= wm_window_fullscreen_toggle_op;
+ ot->exec= wm_window_fullscreen_toggle_exec;
ot->poll= WM_operator_winactive;
}
@@ -1995,10 +1999,10 @@ static int wm_exit_blender_op(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static void WM_OT_exit_blender(wmOperatorType *ot)
+static void WM_OT_quit_blender(wmOperatorType *ot)
{
- ot->name= "Exit Blender";
- ot->idname= "WM_OT_exit_blender";
+ ot->name= "Quit Blender";
+ ot->idname= "WM_OT_quit_blender";
ot->description= "Quit Blender";
ot->invoke= WM_operator_confirm;
@@ -2006,6 +2010,60 @@ static void WM_OT_exit_blender(wmOperatorType *ot)
ot->poll= WM_operator_winactive;
}
+/* *********************** */
+#ifdef WIN32
+static int console= 1;
+void WM_toggle_console(bContext *C, short show)
+{
+ if(show) {
+ FILE *fp;
+ char fn[FILE_MAX];
+ char tmp[FILE_MAXDIR];
+ BLI_where_is_temp(tmp, 1);
+ BLI_make_file_string("/", fn, tmp, "blenderlog.txt");
+ /* open the console */
+ AllocConsole();
+
+ /* redirect stdin */
+ fp= freopen(fn, "r", stdin);
+ SetStdHandle(STD_INPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdin)));
+ /* redirect stdout */
+ fp= freopen(fn, "w", stdout);
+ SetStdHandle(STD_OUTPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdout)));
+ /* redirect stderr */
+ fp= freopen(fn, "w", stderr);
+ SetStdHandle(STD_ERROR_HANDLE, (HANDLE)_get_osfhandle(_fileno(stderr)));
+
+ console= 1;
+ }
+ else {
+ FreeConsole();
+ console= 0;
+ }
+}
+
+static int wm_toggle_console_op(bContext *C, wmOperator *op)
+{
+ if(console) {
+ WM_toggle_console(C, 0);
+ }
+ else {
+ WM_toggle_console(C, 1);
+ }
+ return OPERATOR_FINISHED;
+}
+
+static void WM_OT_toggle_console(wmOperatorType *ot)
+{
+ ot->name= "Toggle System Console";
+ ot->idname= "WM_OT_toggle_console";
+ ot->description= "Toggle System Console";
+
+ ot->exec= wm_toggle_console_op;
+ ot->poll= WM_operator_winactive;
+}
+#endif
+
/* ************ default paint cursors, draw always around cursor *********** */
/*
- returns handler to free
@@ -2298,7 +2356,7 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
rect->xmax= event->x - sx;
rect->ymax= event->y - sy;
- if((val= wm_gesture_evaluate(C, gesture))) {
+ if((val= wm_gesture_evaluate(gesture))) {
wmEvent event;
event= *(window->eventstate);
@@ -2391,7 +2449,7 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
-static void gesture_lasso_apply(bContext *C, wmOperator *op, int event_type)
+static void gesture_lasso_apply(bContext *C, wmOperator *op)
{
wmGesture *gesture= op->customdata;
PointerRNA itemptr;
@@ -2460,7 +2518,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
case MIDDLEMOUSE:
case RIGHTMOUSE:
if(event->val==KM_RELEASE) { /* key release */
- gesture_lasso_apply(C, op, event->type);
+ gesture_lasso_apply(C, op);
return OPERATOR_FINISHED;
}
break;
@@ -2853,11 +2911,11 @@ void WM_radial_control_string(wmOperator *op, char str[], int maxlen)
float v = RNA_float_get(op->ptr, "new_value");
if(mode == WM_RADIALCONTROL_SIZE)
- sprintf(str, "Size: %d", (int)v);
+ BLI_snprintf(str, maxlen, "Size: %d", (int)v);
else if(mode == WM_RADIALCONTROL_STRENGTH)
- sprintf(str, "Strength: %d", (int)v);
+ BLI_snprintf(str, maxlen, "Strength: %d", (int)v);
else if(mode == WM_RADIALCONTROL_ANGLE)
- sprintf(str, "Angle: %d", (int)(v * 180.0f/M_PI));
+ BLI_snprintf(str, maxlen, "Angle: %d", (int)(v * 180.0f/M_PI));
}
/** Important: this doesn't define an actual operator, it
@@ -3024,7 +3082,7 @@ static void WM_OT_redraw_timer(wmOperatorType *ot)
/* ************************** memory statistics for testing ***************** */
-static int memory_statistics_exec(bContext *C, wmOperator *op)
+static int memory_statistics_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
{
MEM_printmemlist_stats();
return OPERATOR_FINISHED;
@@ -3065,7 +3123,7 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_read_factory_settings);
WM_operatortype_append(WM_OT_save_homefile);
WM_operatortype_append(WM_OT_window_fullscreen_toggle);
- WM_operatortype_append(WM_OT_exit_blender);
+ WM_operatortype_append(WM_OT_quit_blender);
WM_operatortype_append(WM_OT_open_mainfile);
WM_operatortype_append(WM_OT_link_append);
WM_operatortype_append(WM_OT_recover_last_session);
@@ -3078,6 +3136,9 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_splash);
WM_operatortype_append(WM_OT_search_menu);
WM_operatortype_append(WM_OT_call_menu);
+#ifdef WIN32
+ WM_operatortype_append(WM_OT_toggle_console);
+#endif
#ifdef WITH_COLLADA
/* XXX: move these */
@@ -3268,7 +3329,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
- WM_keymap_add_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_OSKEY, 0);
+ WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_OSKEY, 0);
#endif
WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
@@ -3288,7 +3349,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "copy", 1);
WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_add_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_CTRL, 0);
/* debug/testing */
WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
@@ -3349,7 +3410,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
}
/* Generic itemf's for operators that take library args */
-static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, ID *id, int local)
+static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), int *free, ID *id, int local)
{
EnumPropertyItem *item= NULL, item_tmp;
int totitem= 0;
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 207b6cebfe6..271b32359f5 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -40,6 +40,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -73,7 +74,7 @@ typedef struct wmSubWindow {
/* ******************* open, free, set, get data ******************** */
/* not subwindow itself */
-static void wm_subwindow_free(wmSubWindow *swin)
+static void wm_subwindow_free(wmSubWindow *UNUSED(swin))
{
/* future fancy stuff */
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 328c3e80259..69a29092058 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -45,6 +45,7 @@
#include "BKE_blender.h"
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_utildefines.h"
#include "BIF_gl.h"
@@ -68,6 +69,7 @@ GHOST_SystemHandle g_system= NULL;
/* set by commandline */
static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal;
+static unsigned short useprefsize= 0;
/* ******** win open & close ************ */
@@ -259,17 +261,15 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
else {
/* this is set to 1 if you don't have startup.blend open */
- if(G.save_over) {
- char *str= MEM_mallocN(strlen(G.sce) + 16, "title");
+ if(G.save_over && G.main->name[0]) {
+ char str[sizeof(G.main->name) + 12];
if(wm->file_saved)
- sprintf(str, "Blender [%s]", G.sce);
+ sprintf(str, "Blender [%s]", G.main->name);
else
- sprintf(str, "Blender* [%s]", G.sce);
+ sprintf(str, "Blender* [%s]", G.main->name);
GHOST_SetTitle(win->ghostwin, str);
-
- MEM_freeN(str);
}
else
GHOST_SetTitle(win->ghostwin, "Blender");
@@ -289,7 +289,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
}
/* belongs to below */
-static void wm_window_add_ghostwindow(bContext *C, wmWindowManager *wm, char *title, wmWindow *win)
+static void wm_window_add_ghostwindow(bContext *C, char *title, wmWindow *win)
{
GHOST_WindowHandle ghostwin;
int scr_w, scr_h, posy;
@@ -352,7 +352,10 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm)
wmKeyMap *keymap;
wmWindow *win;
- /* no commandline prefsize? then we set this */
+ /* no commandline prefsize? then we set this.
+ * Note that these values will be used only
+ * when there is no startup.blend yet.
+ */
if (!prefsizx) {
wm_get_screensize(&prefsizx, &prefsizy);
@@ -372,18 +375,19 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm)
for(win= wm->windows.first; win; win= win->next) {
if(win->ghostwin==NULL) {
- if(win->sizex==0) {
+ if(win->sizex==0 || useprefsize) {
win->posx= prefstax;
win->posy= prefstay;
win->sizex= prefsizx;
win->sizey= prefsizy;
win->windowstate= initialstate;
+ useprefsize= 0;
}
- wm_window_add_ghostwindow(C, wm, "Blender", win);
+ wm_window_add_ghostwindow(C, "Blender", win);
}
/* happens after fileread */
if(win->eventstate==NULL)
- win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state");
+ win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state");
/* add keymap handlers (1 handler for all keys in map!) */
keymap= WM_keymap_find(wm->defaultconf, "Window", 0, 0);
@@ -488,7 +492,7 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
/* ****************** Operators ****************** */
/* operator callback */
-int wm_window_duplicate_op(bContext *C, wmOperator *op)
+int wm_window_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
wm_window_copy(C, CTX_wm_window(C));
WM_check(C);
@@ -500,7 +504,7 @@ int wm_window_duplicate_op(bContext *C, wmOperator *op)
/* fullscreen operator callback */
-int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op)
+int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
wmWindow *window= CTX_wm_window(C);
GHOST_TWindowState state = GHOST_GetWindowState(window->ghostwin);
@@ -516,22 +520,37 @@ int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op)
/* ************ events *************** */
-static int query_qual(char qual)
+typedef enum
+{
+ SHIFT = 's',
+ CONTROL = 'c',
+ ALT = 'a',
+ OS = 'C'
+} modifierKeyType;
+
+/* check if specified modifier key type is pressed */
+static int query_qual(modifierKeyType qual)
{
GHOST_TModifierKeyMask left, right;
int val= 0;
- if (qual=='s') {
- left= GHOST_kModifierKeyLeftShift;
- right= GHOST_kModifierKeyRightShift;
- } else if (qual=='c') {
- left= GHOST_kModifierKeyLeftControl;
- right= GHOST_kModifierKeyRightControl;
- } else if (qual=='C') {
- left= right= GHOST_kModifierKeyCommand;
- } else {
- left= GHOST_kModifierKeyLeftAlt;
- right= GHOST_kModifierKeyRightAlt;
+ switch(qual) {
+ case SHIFT:
+ left= GHOST_kModifierKeyLeftShift;
+ right= GHOST_kModifierKeyRightShift;
+ break;
+ case CONTROL:
+ left= GHOST_kModifierKeyLeftControl;
+ right= GHOST_kModifierKeyRightControl;
+ break;
+ case OS:
+ left= right= GHOST_kModifierKeyOS;
+ break;
+ case ALT:
+ default:
+ left= GHOST_kModifierKeyLeftAlt;
+ right= GHOST_kModifierKeyRightAlt;
+ break;
}
GHOST_GetModifierKeyState(g_system, left, &val);
@@ -600,20 +619,20 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
/* bad ghost support for modifier keys... so on activate we set the modifiers again */
kdata.ascii= 0;
- if (win->eventstate->shift && !query_qual('s')) {
+ if (win->eventstate->shift && !query_qual(SHIFT)) {
kdata.key= GHOST_kKeyLeftShift;
wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
}
- if (win->eventstate->ctrl && !query_qual('c')) {
+ if (win->eventstate->ctrl && !query_qual(CONTROL)) {
kdata.key= GHOST_kKeyLeftControl;
wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
}
- if (win->eventstate->alt && !query_qual('a')) {
+ if (win->eventstate->alt && !query_qual(ALT)) {
kdata.key= GHOST_kKeyLeftAlt;
wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
}
- if (win->eventstate->oskey && !query_qual('C')) {
- kdata.key= GHOST_kKeyCommand;
+ if (win->eventstate->oskey && !query_qual(OS)) {
+ kdata.key= GHOST_kKeyOS;
wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
}
/* keymodifier zero, it hangs on hotkeys that open windows otherwise */
@@ -875,7 +894,7 @@ void wm_window_process_events(const bContext *C)
PIL_sleep_ms(5);
}
-void wm_window_process_events_nosleep(const bContext *C)
+void wm_window_process_events_nosleep(void)
{
if(GHOST_ProcessEvents(g_system, 0))
GHOST_DispatchEvents(g_system);
@@ -923,7 +942,7 @@ void wm_ghost_exit(void)
/* **************** timer ********************** */
/* to (de)activate running timers temporary */
-void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *win, wmTimer *timer, int dosleep)
+void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer, int dosleep)
{
wmTimer *wt;
@@ -951,7 +970,7 @@ wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type,
return wt;
}
-void WM_event_remove_timer(wmWindowManager *wm, wmWindow *win, wmTimer *timer)
+void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
{
wmTimer *wt;
@@ -1109,6 +1128,7 @@ void WM_setprefsize(int stax, int stay, int sizx, int sizy)
prefstay= stay;
prefsizx= sizx;
prefsizy= sizy;
+ useprefsize= 1;
}
/* for borderless and border windows set from command-line */
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index 7228a6dcd93..e1ca1793c04 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -61,7 +61,7 @@ void wm_tweakevent_test(bContext *C, wmEvent *event, int action);
/* wm_gesture.c */
#define WM_LASSO_MIN_POINTS 1024
void wm_gesture_draw(struct wmWindow *win);
-int wm_gesture_evaluate(bContext *C, wmGesture *gesture);
+int wm_gesture_evaluate(wmGesture *gesture);
void wm_gesture_tag_redraw(bContext *C);
/* wm_jobs.c */
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index 8fd650fb184..4888f9aced3 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -84,7 +84,6 @@ enum {
/* wm_event_system.c */
-void wm_event_add (wmWindow *win, wmEvent *event_to_add);
void wm_event_free_all (wmWindow *win);
void wm_event_free (wmEvent *event);
void wm_event_free_handler (wmEventHandler *handler);
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index e4b56080b03..efc31f6f7c3 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -204,7 +204,7 @@
#define ENDKEY 170
#define UNKNOWNKEY 171
-#define COMMANDKEY 172
+#define OSKEY 172
#define GRLESSKEY 173
/* for event checks */
@@ -215,7 +215,7 @@
#define ISKEYBOARD(event) (event >=' ' && event <=320)
/* test whether the event is a modifier key */
-#define ISKEYMODIFIER(event) ((event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) || event == COMMANDKEY)
+#define ISKEYMODIFIER(event) ((event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) || event == OSKEY)
/* test whether the event is a mouse button */
#define ISMOUSE(event) (event >= LEFTMOUSE && event <= MOUSEROTATE)
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index 5a425df01e1..b0aec50e228 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -45,7 +45,7 @@ void wm_window_close (bContext *C, wmWindowManager *wm, wmWindow *win);
void wm_window_title (wmWindowManager *wm, wmWindow *win);
void wm_window_add_ghostwindows (bContext *C, wmWindowManager *wm);
void wm_window_process_events (const bContext *C);
-void wm_window_process_events_nosleep(const bContext *C);
+void wm_window_process_events_nosleep(void);
void wm_window_make_drawable(bContext *C, wmWindow *win);
@@ -65,8 +65,8 @@ wmWindow *wm_window_copy (bContext *C, wmWindow *winorig);
void wm_window_testbreak (void);
/* *************** window operators ************** */
-int wm_window_duplicate_op (bContext *C, struct wmOperator *op);
-int wm_window_fullscreen_toggle_op(bContext *C, struct wmOperator *op);
+int wm_window_duplicate_exec(bContext *C, struct wmOperator *op);
+int wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op);
#endif /* WM_WINDOW_H */
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index a61152d37ba..b1dbde8d4b1 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -65,7 +65,7 @@ IF(UNIX)
gp_ghost
gp_common
bf_intern_string
- bf_intern_ghost
+ bf_intern_ghost
bf_rna
bf_blenkernel
bf_blenloader
@@ -81,10 +81,10 @@ IF(UNIX)
bf_oglrasterizer
bf_expressions
bf_scenegraph
- bf_ikplugin
- bf_intern_itasc
- bf_intern_ik
- bf_intern_smoke
+ bf_ikplugin
+ bf_intern_itasc
+ bf_intern_ik
+ bf_intern_smoke
bf_modifiers
bf_intern_moto
bf_kernel
@@ -114,6 +114,8 @@ IF(UNIX)
extern_binreloc
extern_glew
extern_minilzo
+ bf_intern_ghost # duplicate for linking
+ bf_blenkernel # duplicate for linking
)
IF(WITH_QUICKTIME)
diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
index dbcf4d96942..473cc823f12 100644
--- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
+++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
@@ -24,6 +24,9 @@
#
# ***** END GPL LICENSE BLOCK *****
+# this warning on generated files gets annoying
+STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+
FILE(GLOB SRC stubs.c)
IF(WITH_BUILDINFO)
@@ -37,6 +40,7 @@ SET(INC
../../../intern/guardedalloc
../../../source/blender/makesdna
../../../source/blender/makesrna
+ ../../../source/blender/blenkernel
)
IF(WITH_GAMEENGINE)
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index b341f798478..5fa09cebf29 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -42,6 +42,7 @@ struct CSG_FaceIteratorDescriptor;
struct CSG_VertexIteratorDescriptor;
struct ColorBand;
struct CurveMapping;
+struct Curve;
struct EditBone;
struct EditFace;
struct EditMesh;
@@ -162,6 +163,7 @@ void ED_node_composit_default(struct Scene *sce){}
void *ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *custumdata, int type){return 0;} /* XXX this one looks weird */
void *ED_region_draw_cb_customdata(void *handle){return 0;} /* XXX This one looks wrong also */
void ED_region_draw_cb_exit(struct ARegionType *art, void *handle){}
+void ED_area_headerprint(struct ScrArea *sa, char *str){}
struct EditBone *ED_armature_bone_get_mirrored(struct ListBase *edbo, struct EditBone *ebo){return (struct EditBone *) NULL;}
struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, char *name){return (struct EditBone*) NULL;}
@@ -204,7 +206,7 @@ struct KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]){return
struct KeyingSet *ANIM_scene_get_active_keyingset (struct Scene *scene){return (struct KeyingSet *) NULL;}
int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks){return 0;}
struct ListBase builtin_keyingsets;
-void ANIM_keyingset_info_register (const struct bContext *C, struct KeyingSetInfo *ksi){}
+void ANIM_keyingset_info_register (struct KeyingSetInfo *ksi){}
void ANIM_keyingset_info_unregister (const struct bContext *C, struct KeyingSetInfo *ksi){}
short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, short flag, int type){return 0;}
short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag){return 0;}
@@ -218,7 +220,7 @@ void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op){}
void WM_cursor_wait (int val) {}
void ED_node_texture_default(struct Tex *tx){}
void ED_node_changed_update(struct bContext *C, struct bNode *node){}
-void ED_node_generic_update(struct Main *bmain, struct Scene *scene, struct bNodeTree *ntree, struct bNode *node){}
+void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node){}
void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene){}
int ED_view3d_scene_layer_set(int lay, const int *values){return 0;}
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar){}
@@ -253,7 +255,7 @@ void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count)
void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count){}
void ED_mesh_material_link(struct Mesh *mesh, struct Material *ma){}
int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;}
-int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;}
+int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me){return 0;}
void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob){}
void ED_object_constraint_update(struct Object *ob){}
struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, char *name){return (struct bDeformGroup *) NULL;}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index fec10222b02..8e513c64b1a 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -101,6 +101,9 @@ IF(WITH_BUILDINFO)
-DBUILD_REV="${BUILD_REV}"
-DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}"
-DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
+ -DBUILD_CFLAGS="${CMAKE_C_FLAGS}"
+ -DBUILD_CXXFLAGS="${CMAKE_CXX_FLAGS}"
+ -DBUILD_LINKFLAGS="${PLATFORM_LINKFLAGS}"
)
LIST(APPEND EXESRC buildinfo.c)
@@ -212,7 +215,7 @@ IF(WITH_INSTALL)
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
INSTALL(
- FILES ${CMAKE_SOURCE_DIR}/doc/blender.1
+ FILES ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
)
INSTALL(
@@ -254,16 +257,17 @@ IF(WITH_INSTALL)
COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
- COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles
- COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
- COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
+ COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
+ COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
+ COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
+ COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
)
IF(WITH_INTERNATIONAL)
ADD_CUSTOM_COMMAND(
TARGET blender POST_BUILD MAIN_DEPENDENCY blender
- COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
- COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
+ COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
+ COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
)
ENDIF(WITH_INTERNATIONAL)
@@ -271,10 +275,9 @@ IF(WITH_INSTALL)
SET(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
ADD_CUSTOM_COMMAND(
TARGET blender POST_BUILD MAIN_DEPENDENCY blender
- COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/
- COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/python/
- COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/python/
- COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/python/
+ COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/
+ COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
+ COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;"
)
ENDIF(WITH_PYTHON)
@@ -451,9 +454,6 @@ IF(WITH_FLUID)
LIST(APPEND BLENDER_LINK_LIBS bf_intern_elbeem)
ENDIF(WITH_FLUID)
-IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
- LIST(APPEND BLENDER_LINK_LIBS extern_binreloc)
-ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
#IF(UNIX)
# Sort libraries
@@ -498,7 +498,6 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_editor_animation
bf_editor_datafiles
- bf_intern_bsp
bf_render
bf_intern_opennl
bf_python
@@ -529,8 +528,6 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_intern_memutil
bf_intern_guardedalloc
bf_intern_ctr
- bf_intern_moto
- bf_windowmanager
bf_blroutines
bf_converter
bf_dummy
@@ -545,19 +542,13 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_oglrasterizer
bf_expressions
bf_scenegraph
- bf_intern_moto
- bf_blroutines
kx_network
- bf_kernel
+ bf_kernel
+ bf_python # duplicate for BPY_eval_driver
bf_ngnetwork
extern_bullet
bf_loopbacknetwork
- bf_intern_itasc
- bf_common
bf_intern_moto
- bf_python
- bf_python_ext
- extern_binreloc
extern_glew
extern_ptex
bf_videotex
@@ -565,10 +556,12 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_dna
bf_blenfont
bf_intern_audaspace
- bf_intern_decimate
-
)
+ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ LIST(APPEND BLENDER_SORTED_LIBS extern_binreloc)
+ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+
IF(WITH_CXX_GUARDEDALLOC)
LIST(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
ENDIF(WITH_CXX_GUARDEDALLOC)
diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c
index a14cb94b859..cf6f5a11c45 100644
--- a/source/creator/buildinfo.c
+++ b/source/creator/buildinfo.c
@@ -35,4 +35,15 @@ char build_time[]= STRINGIFY(BUILD_TIME);
char build_rev[]= STRINGIFY(BUILD_REV);
char build_platform[]= STRINGIFY(BUILD_PLATFORM);
char build_type[]= STRINGIFY(BUILD_TYPE);
+
+#ifdef BUILD_CFLAGS
+char build_cflags[]= STRINGIFY(BUILD_CFLAGS);
+char build_cxxflags[]= STRINGIFY(BUILD_CXXFLAGS);
+char build_linkflags[]= STRINGIFY(BUILD_LINKFLAGS);
+#else
+char build_cflags[]= "unmaintained buildsystem alert!";
+char build_cxxflags[]= "unmaintained buildsystem alert!";
+char build_linkflags[]= "unmaintained buildsystem alert!";
#endif
+
+#endif // BUILD_DATE
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 83392224444..117efe6bba6 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -118,6 +118,9 @@ extern char build_time[];
extern char build_rev[];
extern char build_platform[];
extern char build_type[];
+extern char build_cflags[];
+extern char build_cxxflags[];
+extern char build_linkflags[];
#endif
/* Local Function prototypes */
@@ -138,7 +141,7 @@ static void setCallbacks(void);
/* set breakpoints here when running in debug mode, useful to catch floating point errors */
#if defined(__sgi) || defined(__linux__) || defined(_WIN32) || OSX_SSE_FPE
-static void fpe_handler(int sig)
+static void fpe_handler(int UNUSED(sig))
{
// printf("SIGFPE trapped\n");
}
@@ -175,7 +178,7 @@ static void strip_quotes(char *str)
}
#endif
-static int print_version(int argc, char **argv, void *data)
+static int print_version(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
printf (BLEND_VERSION_STRING_FMT);
#ifdef BUILD_DATE
@@ -184,13 +187,16 @@ static int print_version(int argc, char **argv, void *data)
printf ("\tbuild revision: %s\n", build_rev);
printf ("\tbuild platform: %s\n", build_platform);
printf ("\tbuild type: %s\n", build_type);
+ printf ("\tbuild c flags: %s\n", build_cflags);
+ printf ("\tbuild c++ flags: %s\n", build_cxxflags);
+ printf ("\tbuild link flags: %s\n", build_linkflags);
#endif
exit(0);
return 0;
}
-static int print_help(int argc, char **argv, void *data)
+static int print_help(int UNUSED(argc), char **UNUSED(argv), void *data)
{
bArgs *ba = (bArgs*)data;
@@ -317,30 +323,30 @@ double PIL_check_seconds_timer(void);
}
}*/
-static int end_arguments(int argc, char **argv, void *data)
+static int end_arguments(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
return -1;
}
-static int enable_python(int argc, char **argv, void *data)
+static int enable_python(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
G.f |= G_SCRIPT_AUTOEXEC;
return 0;
}
-static int disable_python(int argc, char **argv, void *data)
+static int disable_python(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
G.f &= ~G_SCRIPT_AUTOEXEC;
return 0;
}
-static int background_mode(int argc, char **argv, void *data)
+static int background_mode(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
G.background = 1;
return 0;
}
-static int debug_mode(int argc, char **argv, void *data)
+static int debug_mode(int UNUSED(argc), char **UNUSED(argv), void *data)
{
G.f |= G_DEBUG; /* std output printf's */
printf(BLEND_VERSION_STRING_FMT);
@@ -354,7 +360,7 @@ static int debug_mode(int argc, char **argv, void *data)
return 0;
}
-static int set_fpe(int argc, char **argv, void *data)
+static int set_fpe(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
#if defined(__sgi) || defined(__linux__) || defined(_WIN32) || OSX_SSE_FPE
/* zealous but makes float issues a heck of a lot easier to find!
@@ -379,7 +385,7 @@ static int set_fpe(int argc, char **argv, void *data)
return 0;
}
-static int playback_mode(int argc, char **argv, void *data)
+static int playback_mode(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
/* not if -b was given first */
if (G.background == 0) {
@@ -391,7 +397,7 @@ static int playback_mode(int argc, char **argv, void *data)
return -2;
}
-static int prefsize(int argc, char **argv, void *data)
+static int prefsize(int argc, char **argv, void *UNUSED(data))
{
int stax, stay, sizx, sizy;
@@ -410,29 +416,31 @@ static int prefsize(int argc, char **argv, void *data)
return 4;
}
-static int with_borders(int argc, char **argv, void *data)
+static int with_borders(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
WM_setinitialstate_normal();
return 0;
}
-static int without_borders(int argc, char **argv, void *data)
+static int without_borders(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
WM_setinitialstate_fullscreen();
return 0;
}
-static int register_extension(int argc, char **argv, void *data)
+static int register_extension(int UNUSED(argc), char **UNUSED(argv), void *data)
{
#ifdef WIN32
char *path = BLI_argsArgv(data)[0];
RegisterBlendExtension(path);
+#else
+ (void)data; /* unused */
#endif
return 0;
}
-static int no_joystick(int argc, char **argv, void *data)
+static int no_joystick(int UNUSED(argc), char **UNUSED(argv), void *data)
{
SYS_SystemHandle *syshandle = data;
@@ -446,19 +454,19 @@ static int no_joystick(int argc, char **argv, void *data)
return 0;
}
-static int no_glsl(int argc, char **argv, void *data)
+static int no_glsl(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
GPU_extensions_disable();
return 0;
}
-static int no_audio(int argc, char **argv, void *data)
+static int no_audio(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
{
sound_force_device(0);
return 0;
}
-static int set_audio(int argc, char **argv, void *data)
+static int set_audio(int argc, char **argv, void *UNUSED(data))
{
if (argc < 1) {
printf("-setaudio require one argument\n");
@@ -583,7 +591,7 @@ static int set_image_type(int argc, char **argv, void *data)
}
}
-static int set_threads(int argc, char **argv, void *data)
+static int set_threads(int argc, char **argv, void *UNUSED(data))
{
if (argc >= 1) {
if(G.background) {
@@ -714,7 +722,7 @@ static int render_frame(int argc, char **argv, void *data)
}
}
-static int render_animation(int argc, char **argv, void *data)
+static int render_animation(int UNUSED(argc), char **UNUSED(argv), void *data)
{
bContext *C = data;
if (CTX_data_scene(C)) {
@@ -848,7 +856,7 @@ static int run_python(int argc, char **argv, void *data)
#endif /* DISABLE_PYTHON */
}
-static int run_python_console(int argc, char **argv, void *data)
+static int run_python_console(int UNUSED(argc), char **argv, void *data)
{
#ifndef DISABLE_PYTHON
bContext *C = data;
@@ -863,7 +871,7 @@ static int run_python_console(int argc, char **argv, void *data)
#endif /* DISABLE_PYTHON */
}
-static int load_file(int argc, char **argv, void *data)
+static int load_file(int UNUSED(argc), char **argv, void *data)
{
bContext *C = data;
@@ -873,7 +881,7 @@ static int load_file(int argc, char **argv, void *data)
BLI_path_cwd(filename);
if (G.background) {
- int retval = BKE_read_file(C, filename, NULL, NULL);
+ int retval = BKE_read_file(C, filename, NULL);
/*we successfully loaded a blend file, get sure that
pointcache works */
@@ -1038,11 +1046,14 @@ int main(int argc, char **argv)
BLI_where_am_i(bprogname, argv[0]);
#ifdef BUILD_DATE
- strip_quotes(build_date);
- strip_quotes(build_time);
- strip_quotes(build_rev);
- strip_quotes(build_platform);
- strip_quotes(build_type);
+ strip_quotes(build_date);
+ strip_quotes(build_time);
+ strip_quotes(build_rev);
+ strip_quotes(build_platform);
+ strip_quotes(build_type);
+ strip_quotes(build_cflags);
+ strip_quotes(build_cxxflags);
+ strip_quotes(build_linkflags);
#endif
BLI_threadapi_init();
diff --git a/source/darwin/Makefile b/source/darwin/Makefile
index 5c68f43f606..a9d9d7f2f20 100644
--- a/source/darwin/Makefile
+++ b/source/darwin/Makefile
@@ -30,6 +30,7 @@
include nan_definitions.mk
DIR = $(OCGDIR)/$(DEBUG_DIR)
+VERSION = $(shell $(NANBLENDERHOME)/release/getversion.py)
PYARCHIVE = python_$(MACOSX_ARCHITECTURE).zip
@@ -38,22 +39,25 @@ all::
@echo "---> creating directory structure for $(APPLICATION)"
@rm -rf $(DIR)/bin/$(APPLICATION).app
@cp -R $(APPLICATION).app $(DIR)/bin
- @cat $(APPLICATION).app/Contents/Info.plist | sed s/VERSION/`cat ../../release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > $(DIR)/bin/$(APPLICATION).app/Contents/Info.plist
+ @cat $(APPLICATION).app/Contents/Info.plist | sed s/VERSION/$(VERSION)/ | sed s/DATE/`date +'%Y-%b-%d'`/ > $(DIR)/bin/$(APPLICATION).app/Contents/Info.plist
@echo "---> copying binary"
@cp $(DIR)/bin/$(APPLICATION) $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/
@echo "---> adding excutable attributes"
@chmod +x $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(APPLICATION)
ifeq ($(APPLICATION), blender)
+ @mkdir -p $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)
@echo "---> copying message files"
@cp -R $(NANBLENDERHOME)/release/bin/.blender/locale $(DIR)/bin/$(APPLICATION).app/Contents/Resources
@echo "---> copying .Blanguages"
@cp $(NANBLENDERHOME)/release/bin/.blender/.Blanguages $(DIR)/bin/$(APPLICATION).app/Contents/Resources
- @echo "---> copying .blender/ scripts"
- @cp -R $(NANBLENDERHOME)/release/bin/.blender $(DIR)/bin/$(APPLICATION).app/Contents/MacOS
- @cp -R $(NANBLENDERHOME)/release/scripts $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/
+ @echo "---> copying bfont.ttf"
+ @cp $(NANBLENDERHOME)/release/datafiles/bfont.ttf $(DIR)/bin/$(APPLICATION).app/Contents/Resources/
+ @cp $(NANBLENDERHOME)/release/datafiles/bmonofont.ttf $(DIR)/bin/$(APPLICATION).app/Contents/Resources/
+ @echo "---> copying release scripts"
+ @cp -R $(NANBLENDERHOME)/release/scripts $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)/
@echo "---> copying python modules"
- @mkdir $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/python
- @unzip -q $(LCGDIR)/release/$(PYARCHIVE) -d $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/python/
+ @mkdir $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)/python
+ @unzip -q $(LCGDIR)/release/$(PYARCHIVE) -d $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)/python/
endif
@echo "---> removing SVN directories and Mac hidden files from distribution"
@find $(DIR)/bin/$(APPLICATION).app -name CVS -prune -exec rm -rf {} \;
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 5a0522a9aa6..858a5964a52 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -141,10 +141,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
BlendFileData *bfd= NULL;
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
- BLI_strncpy(oldsce, G.sce, sizeof(oldsce));
+ BLI_strncpy(oldsce, G.main->name, sizeof(oldsce));
#ifndef DISABLE_PYTHON
resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path
- setGamePythonPath(G.sce);
+ setGamePythonPath(G.main->name);
// Acquire Python's GIL (global interpreter lock)
// so we can safely run Python code and API calls
@@ -309,10 +309,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
startscenename = bfd->curscene->id.name + 2;
if(blenderdata) {
- BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce));
+ BLI_strncpy(G.main->name, blenderdata->name, sizeof(G.main->name));
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
#ifndef DISABLE_PYTHON
- setGamePythonPath(G.sce);
+ setGamePythonPath(G.main->name);
#endif
}
}
@@ -425,7 +425,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
ketsjiengine->SetAnimFrameRate(FPS);
// the mainloop
- printf("\nBlender Game Engine Started\n\n");
+ printf("\nBlender Game Engine Started\n");
while (!exitrequested)
{
// first check if we want to exit
@@ -440,7 +440,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
ketsjiengine->Render();
}
- wm_window_process_events_nosleep(C);
+ wm_window_process_events_nosleep();
// test for the ESC key
//XXX while (qtest())
@@ -472,7 +472,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
}
}
- printf("\nBlender Game Engine Finished\n\n");
+ printf("Blender Game Engine Finished\n");
exitstring = ketsjiengine->GetExitString();
@@ -573,7 +573,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
if (bfd) BLO_blendfiledata_free(bfd);
- BLI_strncpy(G.sce, oldsce, sizeof(G.sce));
+ BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name));
#ifndef DISABLE_PYTHON
Py_DECREF(pyGlobalDict);
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
index b04e951028d..f1e30ed4227 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
@@ -203,5 +203,11 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y)
void KX_BlenderCanvas::MakeScreenShot(const char* filename)
{
-// BL_MakeScreenShot(m_ar, filename);
+ ScrArea area_dummy= {0};
+ area_dummy.totrct.xmin = m_frame_rect.GetLeft();
+ area_dummy.totrct.xmax = m_frame_rect.GetRight();
+ area_dummy.totrct.ymin = m_frame_rect.GetBottom();
+ area_dummy.totrct.ymax = m_frame_rect.GetTop();
+
+ BL_MakeScreenShot(&area_dummy, filename);
}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index 55a687c0baa..5e1e213c570 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -49,6 +49,8 @@ extern "C" {
#include "GL/glew.h"
+#include "MEM_guardedalloc.h"
+
#include "BL_Material.h" // MAXTEX
/* Data types encoding the game world: */
@@ -65,10 +67,15 @@ extern "C" {
#include "DNA_windowmanager_types.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_bmfont.h"
#include "BKE_image.h"
+#include "BLI_path_util.h"
+
extern "C" {
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
#include "WM_api.h"
#include "WM_types.h"
#include "wm_event_system.h"
@@ -206,18 +213,53 @@ void BL_NormalMouse(wmWindow *win)
}
#define MAX_FILE_LENGTH 512
+/* get shot from frontbuffer sort of a copy from screendump.c */
+static unsigned int *screenshot(ScrArea *curarea, int *dumpsx, int *dumpsy)
+{
+ int x=0, y=0;
+ unsigned int *dumprect= NULL;
+
+ x= curarea->totrct.xmin;
+ y= curarea->totrct.ymin;
+ *dumpsx= curarea->totrct.xmax-x;
+ *dumpsy= curarea->totrct.ymax-y;
+
+ if (*dumpsx && *dumpsy) {
+
+ dumprect= (unsigned int *)MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect");
+ glReadBuffer(GL_FRONT);
+ glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
+ glFinish();
+ glReadBuffer(GL_BACK);
+ }
-void BL_MakeScreenShot(struct ARegion *ar, const char* filename)
+ return dumprect;
+}
+
+/* based on screendump.c::screenshot_exec */
+void BL_MakeScreenShot(ScrArea *curarea, const char* filename)
{
- char copyfilename[MAX_FILE_LENGTH];
- strcpy(copyfilename,filename);
+ char path[MAX_FILE_LENGTH];
+ strcpy(path,filename);
- // filename read - only
+ unsigned int *dumprect;
+ int dumpsx, dumpsy;
- /* XXX will need to change at some point */
- //XXX BIF_screendump(0);
-
- // write+read filename
- //XXX write_screendump((char*) copyfilename);
+ dumprect= screenshot(curarea, &dumpsx, &dumpsy);
+ if(dumprect) {
+ ImBuf *ibuf;
+ BLI_path_abs(path, G.main->name);
+ /* BKE_add_image_extension() checks for if extension was already set */
+ BKE_add_image_extension(path, R_PNG); /* scene->r.imtype */
+ ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0);
+ ibuf->rect= dumprect;
+ ibuf->ftype= PNG;
+
+ IMB_saveiff(ibuf, path, IB_rect);
+
+ ibuf->rect= NULL;
+ IMB_freeImBuf(ibuf);
+ MEM_freeN(dumprect);
+ }
}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
index 84d174cec68..9c5254dd661 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
@@ -41,7 +41,7 @@ void BL_SwapBuffers(struct wmWindow *win);
void BL_warp_pointer(struct wmWindow *win,int x,int y);
-void BL_MakeScreenShot(struct ARegion *ar, const char* filename);
+void BL_MakeScreenShot(struct ScrArea *curarea, const char* filename);
void BL_HideMouse(struct wmWindow *win);
void BL_NormalMouse(struct wmWindow *win);
diff --git a/source/gameengine/BlenderRoutines/Makefile b/source/gameengine/BlenderRoutines/Makefile
index 3d0f5344c74..cc0c6cf11dd 100644
--- a/source/gameengine/BlenderRoutines/Makefile
+++ b/source/gameengine/BlenderRoutines/Makefile
@@ -41,6 +41,8 @@ CPPFLAGS += -I$(NAN_MOTO)/include
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
CPPFLAGS += -I$(NAN_AUDASPACE)/include
+# path to the guarded memory allocator
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# because of kernel dependency on makesdna
CPPFLAGS += -I../../blender/makesdna
CPPFLAGS += -I../../blender/editors/include
diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript
index f53fc509c6d..1a774fc8aba 100644
--- a/source/gameengine/BlenderRoutines/SConscript
+++ b/source/gameengine/BlenderRoutines/SConscript
@@ -30,6 +30,9 @@ if env['WITH_BF_PYTHON']:
else:
defs.append('DISABLE_PYTHON')
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
incs += ' ' + env['BF_BULLET_INC']
incs += ' ' + env['BF_OPENGL_INC']
diff --git a/source/gameengine/CMakeLists.txt b/source/gameengine/CMakeLists.txt
index 7b58a2a6875..eea600cb0cb 100644
--- a/source/gameengine/CMakeLists.txt
+++ b/source/gameengine/CMakeLists.txt
@@ -37,7 +37,10 @@ ADD_SUBDIRECTORY(Physics/Dummy)
ADD_SUBDIRECTORY(Rasterizer)
ADD_SUBDIRECTORY(Rasterizer/RAS_OpenGLRasterizer)
ADD_SUBDIRECTORY(SceneGraph)
-ADD_SUBDIRECTORY(Physics/Bullet)
+
+IF(WITH_BULLET)
+ ADD_SUBDIRECTORY(Physics/Bullet)
+ENDIF(WITH_BULLET)
IF(WITH_PYTHON)
ADD_SUBDIRECTORY(VideoTexture)
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index f9bca9a2cdd..69483aed1ec 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1766,9 +1766,11 @@ static KX_GameObject *gameobject_from_blenderobject(
BL_MeshDeformer *dcont = new BL_MeshDeformer((BL_DeformableGameObject*)gameobj,
ob, meshobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
+#ifdef USE_BULLET
} else if (bHasSoftBody) {
KX_SoftBodyDeformer *dcont = new KX_SoftBodyDeformer(meshobj, (BL_DeformableGameObject*)gameobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
+#endif
}
MT_Point3 min = MT_Point3(center) - MT_Vector3(extents);
diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt
index c5b8128903b..87e413c3a44 100644
--- a/source/gameengine/Converter/CMakeLists.txt
+++ b/source/gameengine/Converter/CMakeLists.txt
@@ -69,4 +69,8 @@ ELSE(WITH_PYTHON)
ADD_DEFINITIONS(-DDISABLE_PYTHON)
ENDIF(WITH_PYTHON)
+IF(WITH_BULLET)
+ ADD_DEFINITIONS(-DUSE_BULLET)
+ENDIF(WITH_BULLET)
+
BLENDERLIB(bf_converter "${SRC}" "${INC}")
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index f50fb6838e3..6f64f4e33af 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -40,6 +40,7 @@
#include "KX_KetsjiEngine.h"
#include "KX_IPhysicsController.h"
#include "BL_Material.h"
+#include "BL_ActionActuator.h"
#include "KX_BlenderMaterial.h"
#include "KX_PolygonMaterial.h"
@@ -960,7 +961,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
static char err_local[255];
/* only scene and mesh supported right now */
- if(idcode!=ID_SCE && idcode!=ID_ME) {
+ if(idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) {
snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group);
return false;
}
@@ -1018,6 +1019,16 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj);
}
}
+ else if(idcode==ID_AC) {
+ /* Convert all actions */
+ ID *action;
+ KX_Scene *kx_scene= m_currentScene;
+
+ for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) {
+ printf("ActionName: %s\n", action->name);
+ kx_scene->GetLogicManager()->RegisterActionName(action->name+2, action);
+ }
+ }
else if(idcode==ID_SCE) {
/* Merge all new linked in scene into the existing one */
ID *scene;
@@ -1092,6 +1103,23 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
}
}
}
+
+ /* Now unregister actions */
+ {
+ GEN_Map<STR_HashedString,void*> &mapStringToActions = scene->GetLogicManager()->GetActionMap();
+
+ for(int i=0; i<mapStringToActions.size(); i++)
+ {
+ ID *action= (ID*) *mapStringToActions.at(i);
+
+ if(IS_TAGGED(action))
+ {
+ STR_HashedString an = action->name+2;
+ mapStringToActions.remove(an);
+ i--;
+ }
+ }
+ }
//scene->FreeTagged(); /* removed tagged objects and meshes*/
CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL};
@@ -1128,6 +1156,17 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
break;
}
}
+
+ /* make sure action actuators are not referencing tagged actions */
+ for (int act_idx=0; act_idx<gameobj->GetActuators().size(); act_idx++)
+ {
+ if (gameobj->GetActuators()[act_idx]->IsType(SCA_IActuator::KX_ACT_ACTION))
+ {
+ BL_ActionActuator *act = (BL_ActionActuator*)gameobj->GetActuators()[act_idx];
+ if(IS_TAGGED(act->GetAction()))
+ act->SetAction(NULL);
+ }
+ }
}
}
}
diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript
index ab1d7574d89..a276d1623df 100644
--- a/source/gameengine/Converter/SConscript
+++ b/source/gameengine/Converter/SConscript
@@ -32,4 +32,10 @@ if env['WITH_BF_PYTHON']:
else:
defs.append('DISABLE_PYTHON')
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
+if env['WITH_BF_BULLET']:
+ defs.append('USE_BULLET')
+
env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 625549a272e..b2688231a43 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -461,6 +461,7 @@ typedef PyTypeObject * PyParentObject; // Define the PyParent Object
#else // DISABLE_PYTHON
+#ifdef WITH_CXX_GUARDEDALLOC
#define Py_Header \
public: \
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlus"); } \
@@ -471,6 +472,16 @@ typedef PyTypeObject * PyParentObject; // Define the PyParent Object
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlusPtr"); } \
void operator delete( void *mem ) { MEM_freeN(mem); } \
+#else // WITH_CXX_GUARDEDALLOC
+
+#define Py_Header \
+ public: \
+
+#define Py_HeaderPtr \
+ public: \
+
+#endif // WITH_CXX_GUARDEDALLOC
+
#endif
diff --git a/source/gameengine/Expressions/SConscript b/source/gameengine/Expressions/SConscript
index 007d6373c77..85db689a9ba 100644
--- a/source/gameengine/Expressions/SConscript
+++ b/source/gameengine/Expressions/SConscript
@@ -12,4 +12,7 @@ if env['WITH_BF_PYTHON']:
else:
defs.append('DISABLE_PYTHON')
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
env.BlenderLib ( 'bf_expressions', sources, Split(incs), defs, libtype=['core','player'], priority = [360,80], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index 9ddb62df361..f92b27f641a 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -127,6 +127,7 @@ public:
void RegisterMeshName(const STR_String& meshname,void* mesh);
void UnregisterMeshName(const STR_String& meshname,void* mesh);
GEN_Map<STR_HashedString,void*>& GetMeshMap() { return m_mapStringToMeshes; };
+ GEN_Map<STR_HashedString,void*>& GetActionMap() { return m_mapStringToActions; };
void RegisterActionName(const STR_String& actname,void* action);
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 1f05846abe4..45f0684c02f 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -214,7 +214,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str));
Py_DECREF(value_str);
- return false;
+ return NULL;
}
const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()";
diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript
index 507bb7f0bdd..c9d1fed875d 100644
--- a/source/gameengine/GameLogic/SConscript
+++ b/source/gameengine/GameLogic/SConscript
@@ -23,4 +23,8 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
if env['BF_DEBUG']:
defs.append('_DEBUG')
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #/intern/guardedalloc'
+
env.BlenderLib ( 'bf_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330,65], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
index e02b5fedaf0..a985decabe4 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
@@ -284,8 +284,9 @@ void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode,
int width,
int height)
{
+ /*
STR_String tmpstr(text);
- char* s = tmpstr.Ptr();
+ char* s = tmpstr.Ptr(); */
// Save and change OpenGL settings
int texture2D;
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 9c0b5a24aeb..94142e7a604 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -95,9 +95,9 @@ extern char btempdir[]; /* use this to store a valid temp directory */
#ifdef WIN32
#include <windows.h>
-#ifdef NDEBUG
+#if !defined(DEBUG)
#include <wincon.h>
-#endif // NDEBUG
+#endif // !defined(DEBUG)
#endif // WIN32
const int kMinWindowWidth = 100;
@@ -391,7 +391,7 @@ int main(int argc, char** argv)
IMB_init();
// Parse command line options
-#ifndef NDEBUG
+#if defined(DEBUG)
printf("argv[0] = '%s'\n", argv[0]);
#endif
@@ -438,7 +438,7 @@ int main(int argc, char** argv)
;)
{
-#ifndef NDEBUG
+#if defined(DEBUG)
printf("argv[%d] = '%s' , %i\n", i, argv[i],argc);
#endif
if (argv[i][0] == '-')
@@ -469,7 +469,7 @@ int main(int argc, char** argv)
SYS_WriteCommandLineInt(syshandle, paramname, atoi(argv[i]));
SYS_WriteCommandLineFloat(syshandle, paramname, atof(argv[i]));
SYS_WriteCommandLineString(syshandle, paramname, argv[i]);
-#ifndef NDEBUG
+#if defined(DEBUG)
printf("%s = '%s'\n", paramname, argv[i]);
#endif
i++;
@@ -542,9 +542,9 @@ int main(int argc, char** argv)
printf("error: too few options for parent window argument.\n");
}
-#ifndef NDEBUG
+#if defined(DEBUG)
printf("XWindows ID = %d\n", parentWindow);
-#endif //NDEBUG
+#endif // defined(DEBUG)
#endif // _WIN32
case 'c':
@@ -745,12 +745,12 @@ int main(int argc, char** argv)
else
{
#ifdef WIN32
-#ifdef NDEBUG
+#if !defined(DEBUG)
if (closeConsole)
{
//::FreeConsole(); // Close a console window
}
-#endif // NDEBUG
+#endif // !defined(DEBUG)
#endif // WIN32
Main *maggie = bfd->main;
Scene *scene = bfd->curscene;
@@ -821,8 +821,8 @@ int main(int argc, char** argv)
app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */
BLI_strncpy(pathname, maggie->name, sizeof(pathname));
- BLI_strncpy(G.sce, maggie->name, sizeof(G.sce));
- setGamePythonPath(G.sce);
+ BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name));
+ setGamePythonPath(G.main->name);
if (firstTimeRunning)
{
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp
index 5d40ba7d75c..e708775b184 100644
--- a/source/gameengine/Ketsji/BL_Texture.cpp
+++ b/source/gameengine/Ketsji/BL_Texture.cpp
@@ -634,7 +634,7 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf)
}
else {
for(part=0; part<6; part++) {
- env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect, 0);
+ env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect);
}
IMB_rectcpy(env->cube[0], ibuf,
0, 0, 0, 0, dx, dx);
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index eaead261b2c..b128f33c6e4 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -51,13 +51,11 @@ SET(INC
../../../source/gameengine/Network
../../../source/gameengine/SceneGraph
../../../source/gameengine/Physics/common
- ../../../source/gameengine/Physics/Bullet
../../../source/gameengine/Network/LoopBackNetwork
../../../intern/audaspace/intern
../../../source/blender/misc
../../../source/blender/blenloader
../../../source/blender/gpu
- ../../../extern/bullet2/src
../../../extern/glew/include
)
@@ -79,4 +77,10 @@ IF(WITH_FFMPEG)
ADD_DEFINITIONS(-DWITH_FFMPEG)
ENDIF(WITH_FFMPEG)
+IF(WITH_BULLET)
+ ADD_DEFINITIONS(-DUSE_BULLET)
+ LIST(APPEND INC ../../../extern/bullet2/src)
+ LIST(APPEND INC ../../../source/gameengine/Physics/Bullet )
+ENDIF(WITH_BULLET)
+
BLENDERLIB(bf_ketsji "${SRC}" "${INC}")
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
index 1b2ceae6560..c2fb21bf31a 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
@@ -521,4 +521,4 @@ bool KX_BulletPhysicsController::Update(double time)
// return false;
}
-#endif //#ifdef USE_BULLET
+#endif // USE_BULLET
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
index 48a3c98ff81..a3e8fafec1d 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
@@ -3,7 +3,9 @@
#include "KX_IPhysicsController.h"
+#ifdef USE_BULLET
#include "CcdPhysicsController.h"
+#endif
class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController
{
@@ -18,9 +20,10 @@ private:
btCollisionShape* m_bulletChildShape;
public:
+#ifdef USE_BULLET
KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound);
virtual ~KX_BulletPhysicsController ();
-
+#endif
///////////////////////////////////
// KX_IPhysicsController interface
////////////////////////////////////
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
index ca20aa6b618..2bb3534bde7 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
@@ -29,19 +29,6 @@
#ifndef KX_CONVERTPHYSICSOBJECTS
#define KX_CONVERTPHYSICSOBJECTS
-/* These are defined by the build system... */
-//but the build system is broken, because it doesn't allow for 2 or more defines at once.
-//Please leave Sumo _AND_ Bullet enabled
-#define USE_BULLET
-
-//on visual studio 7/8, always enable BULLET for now
-//you can have multiple physics engines running anyway, and
-//the scons build system doesn't really support this at the moment.
-//if you got troubles, just comment out USE_BULLET
-#if 1300 <= _MSC_VER
-#define USE_BULLET
-#endif
-
class RAS_MeshObject;
class KX_Scene;
struct DerivedMesh;
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
index 061220ce0c1..1888e7cf7b8 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
@@ -38,7 +38,6 @@
#include "RAS_MeshObject.h"
#include "KX_Scene.h"
#include "SYS_System.h"
-#include "BulletSoftBody/btSoftBody.h"
#include "PHY_Pro.h" //todo cleanup
#include "KX_ClientObjectInfo.h"
@@ -56,6 +55,7 @@ extern "C"{
}
#ifdef USE_BULLET
+#include "BulletSoftBody/btSoftBody.h"
#include "CcdPhysicsEnvironment.h"
#include "CcdPhysicsController.h"
@@ -561,4 +561,4 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro
spc->ReplaceControllerShape(bm);
return true;
}
-#endif
+#endif // USE_BULLET
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 764691c379f..bbb17cd1df9 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1496,6 +1496,7 @@ PyMethodDef KX_GameObject::Methods[] = {
PyAttributeDef KX_GameObject::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("name", KX_GameObject, pyattr_get_name),
KX_PYATTRIBUTE_RO_FUNCTION("parent", KX_GameObject, pyattr_get_parent),
+ KX_PYATTRIBUTE_RO_FUNCTION("life", KX_GameObject, pyattr_get_life),
KX_PYATTRIBUTE_RW_FUNCTION("mass", KX_GameObject, pyattr_get_mass, pyattr_set_mass),
KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMin", KX_GameObject, pyattr_get_lin_vel_min, pyattr_set_lin_vel_min),
KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMax", KX_GameObject, pyattr_get_lin_vel_max, pyattr_set_lin_vel_max),
@@ -1574,11 +1575,11 @@ PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args)
) {
return NULL;
}
-
+#ifdef USE_BULLET
/* gameobj and mesh can be NULL */
if(KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh))
Py_RETURN_TRUE;
-
+#endif
Py_RETURN_FALSE;
}
@@ -1787,6 +1788,19 @@ PyObject* KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DE
Py_RETURN_NONE;
}
+PyObject* KX_GameObject::pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+
+ CValue *life = self->GetProperty("::timebomb");
+ if (life)
+ // this convert the timebomb seconds to frames, hard coded 50.0 (assuming 50fps)
+ // value hardcoded in KX_Scene::AddReplicaObject()
+ return PyFloat_FromDouble(life->GetNumber() * 50.0);
+ else
+ Py_RETURN_NONE;
+}
+
PyObject* KX_GameObject::pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 524c061b4d5..14587d25c7f 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -856,6 +856,7 @@ public:
static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index e282d7ac375..fdd325c46a1 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -180,7 +180,7 @@ GPULamp *KX_LightObject::GetGPULamp()
if(m_glsl)
return GPU_lamp_from_blender(m_blenderscene, GetBlenderObject(), GetBlenderGroupObject());
else
- return false;
+ return NULL;
}
void KX_LightObject::Update()
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index a6b2453f0c5..56ec61f9f4c 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -136,12 +136,15 @@ static RAS_ICanvas* gp_Canvas = NULL;
static char gp_GamePythonPath[FILE_MAXDIR + FILE_MAXFILE] = "";
static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super happy about this, but we need to remember the first loaded file for the global/dict load save
+static SCA_PythonKeyboard* gp_PythonKeyboard = NULL;
+static SCA_PythonMouse* gp_PythonMouse = NULL;
#endif // DISABLE_PYTHON
static KX_Scene* gp_KetsjiScene = NULL;
static KX_KetsjiEngine* gp_KetsjiEngine = NULL;
static RAS_IRasterizer* gp_Rasterizer = NULL;
+
void KX_SetActiveScene(class KX_Scene* scene)
{
gp_KetsjiScene = scene;
@@ -1296,11 +1299,13 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
PyDict_SetItemString(d, "globalDict", item=PyDict_New()); Py_DECREF(item);
// Add keyboard and mouse attributes to this module
- SCA_PythonKeyboard* pykeyb = new SCA_PythonKeyboard(gp_KetsjiEngine->GetKeyboardDevice());
- PyDict_SetItemString(d, "keyboard", pykeyb->NewProxy(true));
+ MT_assert(!gp_PythonKeyboard);
+ gp_PythonKeyboard = new SCA_PythonKeyboard(gp_KetsjiEngine->GetKeyboardDevice());
+ PyDict_SetItemString(d, "keyboard", gp_PythonKeyboard->NewProxy(true));
- SCA_PythonMouse* pymouse = new SCA_PythonMouse(gp_KetsjiEngine->GetMouseDevice(), gp_Canvas);
- PyDict_SetItemString(d, "mouse", pymouse->NewProxy(true));
+ MT_assert(!gp_PythonMouse);
+ gp_PythonMouse = new SCA_PythonMouse(gp_KetsjiEngine->GetMouseDevice(), gp_Canvas);
+ PyDict_SetItemString(d, "mouse", gp_PythonMouse->NewProxy(true));
ErrorObject = PyUnicode_FromString("GameLogic.error");
PyDict_SetItemString(d, "error", ErrorObject);
@@ -1926,6 +1931,13 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
void exitGamePlayerPythonScripting()
{
+ /* Clean up the Python mouse and keyboard */
+ delete gp_PythonKeyboard;
+ gp_PythonKeyboard = NULL;
+
+ delete gp_PythonMouse;
+ gp_PythonMouse = NULL;
+
/* since python restarts we cant let the python backup of the sys.path hang around in a global pointer */
restorePySysObjects(); /* get back the original sys.path and clear the backup */
@@ -1962,6 +1974,13 @@ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLev
void exitGamePythonScripting()
{
+ /* Clean up the Python mouse and keyboard */
+ delete gp_PythonKeyboard;
+ gp_PythonKeyboard = NULL;
+
+ delete gp_PythonMouse;
+ gp_PythonMouse = NULL;
+
restorePySysObjects(); /* get back the original sys.path and clear the backup */
bpy_import_main_set(NULL);
PyObjectPlus::ClearDeprecationWarning();
@@ -2214,6 +2233,7 @@ PyObject* initGameKeys()
KX_MACRO_addTypesToDict(d, ESCKEY, SCA_IInputDevice::KX_ESCKEY);
KX_MACRO_addTypesToDict(d, TABKEY, SCA_IInputDevice::KX_TABKEY);
KX_MACRO_addTypesToDict(d, RETKEY, SCA_IInputDevice::KX_RETKEY);
+ KX_MACRO_addTypesToDict(d, ENTERKEY, SCA_IInputDevice::KX_RETKEY);
KX_MACRO_addTypesToDict(d, SPACEKEY, SCA_IInputDevice::KX_SPACEKEY);
KX_MACRO_addTypesToDict(d, LINEFEEDKEY, SCA_IInputDevice::KX_LINEFEEDKEY);
KX_MACRO_addTypesToDict(d, BACKSPACEKEY, SCA_IInputDevice::KX_BACKSPACEKEY);
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 863b73adc96..3d7fcb25f2b 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -82,12 +82,10 @@
#include "BL_ModifierDeformer.h"
#include "BL_ShapeDeformer.h"
#include "BL_DeformableGameObject.h"
-#include "KX_SoftBodyDeformer.h"
-
-// to get USE_BULLET!
-#include "KX_ConvertPhysicsObject.h"
#ifdef USE_BULLET
+#include "KX_SoftBodyDeformer.h"
+#include "KX_ConvertPhysicsObject.h"
#include "CcdPhysicsEnvironment.h"
#include "CcdPhysicsController.h"
#endif
@@ -814,6 +812,8 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject,
// add a timebomb to this object
// for now, convert between so called frames and realtime
m_tempObjectList->Add(replica->AddRef());
+ // this convert the life from frames to sort-of seconds, hard coded 0.02 that assumes we have 50 frames per second
+ // if you change this value, make sure you change it in KX_GameObject::pyattr_get_life property too
CValue *fval = new CFloatValue(lifespan*0.02);
replica->SetProperty("::timebomb",fval);
fval->Release();
@@ -1163,11 +1163,13 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
);
newobj->SetDeformer(meshdeformer);
}
+#ifdef USE_BULLET
else if (bHasSoftBody)
{
KX_SoftBodyDeformer *softdeformer = new KX_SoftBodyDeformer(mesh, newobj);
newobj->SetDeformer(softdeformer);
}
+#endif
// release parent reference if its not being used
if( releaseParent && parentobj)
@@ -1177,10 +1179,12 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
gameobj->AddMeshUser();
}
-
+
+#ifdef USE_BULLET
if(use_phys) { /* update the new assigned mesh with the physics mesh */
KX_ReInstanceBulletShapeFromMesh(gameobj, NULL, use_gfx?NULL:mesh);
}
+#endif
}
KX_Camera* KX_Scene::FindCamera(KX_Camera* cam)
@@ -1629,7 +1633,9 @@ double KX_Scene::getSuspendedDelta()
return m_suspendeddelta;
}
+#ifdef USE_BULLET
#include "KX_BulletPhysicsController.h"
+#endif
static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
{
@@ -1644,16 +1650,19 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
}
/* near sensors have physics controllers */
+#ifdef USE_BULLET
KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick);
if(touch_sensor) {
touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
}
+#endif
}
+#ifdef USE_BULLET
#include "CcdGraphicController.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
#include "CcdPhysicsEnvironment.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
#include "KX_BulletPhysicsController.h"
-
+#endif
static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene *from)
{
@@ -1713,7 +1722,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
if(sg->GetSGClientInfo() == from) {
sg->SetSGClientInfo(to);
}
-
+#ifdef USE_BULLET
SGControllerList::iterator contit;
SGControllerList& controllers = sg->GetSGControllerList();
for (contit = controllers.begin();contit!=controllers.end();++contit)
@@ -1722,6 +1731,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
if (phys_ctrl)
phys_ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
}
+#endif // USE_BULLET
}
/* If the object is a light, update it's scene */
if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT)
@@ -1737,6 +1747,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
bool KX_Scene::MergeScene(KX_Scene *other)
{
+#ifdef USE_BULLET
CcdPhysicsEnvironment *env= dynamic_cast<CcdPhysicsEnvironment *>(this->GetPhysicsEnvironment());
CcdPhysicsEnvironment *env_other= dynamic_cast<CcdPhysicsEnvironment *>(other->GetPhysicsEnvironment());
@@ -1746,6 +1757,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
printf("\tsource %d, terget %d\n", (int)(env!=NULL), (int)(env_other!=NULL));
return false;
}
+#endif // USE_BULLET
if(GetSceneConverter() != other->GetSceneConverter()) {
printf("KX_Scene::MergeScene: converters differ, aborting\n");
@@ -1788,9 +1800,11 @@ bool KX_Scene::MergeScene(KX_Scene *other)
GetLightList()->MergeList(other->GetLightList());
other->GetLightList()->ReleaseAndRemoveAll();
+#ifdef USE_BULLET
if(env) /* bullet scene? - dummy scenes dont need touching */
env->MergeEnvironment(env_other);
-
+#endif
+
/* merge logic */
{
SCA_LogicManager *logicmgr= GetLogicManager();
diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript
index 8d54452be0d..6f06d0ff19c 100644
--- a/source/gameengine/Ketsji/SConscript
+++ b/source/gameengine/Ketsji/SConscript
@@ -16,7 +16,7 @@ incs += ' #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork #source/
incs += ' #source/blender/blenkernel #source/blender #source/blender/editors/include'
incs += ' #source/blender/makesdna #source/blender/python #source/gameengine/Rasterizer'
incs += ' #source/gameengine/GameLogic #source/gameengine/Expressions #source/gameengine/Network'
-incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common #source/gameengine/Physics/Bullet'
+incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common'
incs += ' #source/gameengine/Physics/Dummy'
incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu'
@@ -40,4 +40,11 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
if env['BF_DEBUG']:
defs.append('_DEBUG') # for Python
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
+if env['WITH_BF_BULLET']:
+ defs.append('USE_BULLET')
+ incs += ' #source/gameengine/Physics/Bullet'
+
env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Network/SConscript b/source/gameengine/Network/SConscript
index 3883dc71c9c..3cf1747d013 100644
--- a/source/gameengine/Network/SConscript
+++ b/source/gameengine/Network/SConscript
@@ -5,4 +5,10 @@ sources = env.Glob('*.cpp') #'NG_NetworkMessage.cpp NG_NetworkObject.cpp NG_Netw
incs = '. #source/kernel/gen_system #intern/string #intern/moto/include'
-env.BlenderLib ( 'bf_ngnetwork', sources, Split(incs), [], libtype=['core','player'], priority=[400,130] )
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'bf_ngnetwork', sources, Split(incs), defs, libtype=['core','player'], priority=[400,130] )
diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt
index 95888967b78..ba6f3bef0db 100644
--- a/source/gameengine/Physics/Bullet/CMakeLists.txt
+++ b/source/gameengine/Physics/Bullet/CMakeLists.txt
@@ -46,4 +46,8 @@ SET(INC
${PYTHON_INC}
)
+IF(WITH_BULLET)
+ ADD_DEFINITIONS(-DUSE_BULLET)
+ENDIF(WITH_BULLET)
+
BLENDERLIB(bf_bullet "${SRC}" "${INC}")
diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript
index f58085ab354..6cebe0638b0 100644
--- a/source/gameengine/Physics/Bullet/SConscript
+++ b/source/gameengine/Physics/Bullet/SConscript
@@ -27,4 +27,10 @@ if env['WITH_BF_PYTHON']:
else:
defs.append('DISABLE_PYTHON')
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
+if env['WITH_BF_BULLET']:
+ defs.append('USE_BULLET')
+
env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Physics/Dummy/SConscript b/source/gameengine/Physics/Dummy/SConscript
index dc76e8046a0..496092133c3 100644
--- a/source/gameengine/Physics/Dummy/SConscript
+++ b/source/gameengine/Physics/Dummy/SConscript
@@ -5,4 +5,10 @@ sources = 'DummyPhysicsEnvironment.cpp'
incs = '. ../common'
-env.BlenderLib ( 'bf_dummy', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350,60] )
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'bf_dummy', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,60] )
diff --git a/source/gameengine/Physics/common/SConscript b/source/gameengine/Physics/common/SConscript
index 719c028ee8f..38bb7a11309 100644
--- a/source/gameengine/Physics/common/SConscript
+++ b/source/gameengine/Physics/common/SConscript
@@ -5,4 +5,10 @@ sources = 'PHY_IMotionState.cpp PHY_IController.cpp PHY_IPhysicsController.cpp P
incs = '. ../Dummy #intern/moto/include'
-env.BlenderLib ( 'bf_physics_common', Split(sources), Split(incs), [], libtype=['core','player'], priority=[360,55], cxx_compileflags=env['BGE_CXXFLAGS'])
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'bf_physics_common', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[360,55], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
index 4527850a8e9..0c16d6a29c2 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
@@ -431,6 +431,8 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
glViewport(0,0, texturewidth, textureheight);
glDisable(GL_DEPTH_TEST);
+ // if the last rendered face had alpha add it would messes with the color of the plane we apply 2DFilter to
+ glDisable(GL_BLEND);
glPushMatrix(); //GL_MODELVIEW
glLoadIdentity(); // GL_MODELVIEW
glMatrixMode(GL_TEXTURE);
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
index 12a255b4e4e..d793a2faf7b 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
@@ -13,7 +13,7 @@
#include "RAS_TexVert.h"
#include "MT_assert.h"
-//#ifndef NDEBUG
+//#if defined(DEBUG)
//#ifdef WIN32
//#define spit(x) std::cout << x << std::endl;
//#endif //WIN32
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
index 68e6789c05e..8ad6a8b28a2 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
@@ -10,4 +10,7 @@ incs += ' #source/blender/gpu #extern/glew/include ' + env['BF_OPENGL_INC']
incs += ' #source/blender/gameengine/Ketsji #source/gameengine/SceneGraph #source/blender/makesdna #source/blender/blenkernel'
incs += ' #intern/guardedalloc #source/blender/blenlib'
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
env.BlenderLib ( 'bf_oglrasterizer', Split(sources), Split(incs), defines = defs, libtype=['core','player'], priority=[350,75], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript
index a78a0289d98..dc189c54a40 100644
--- a/source/gameengine/Rasterizer/SConscript
+++ b/source/gameengine/Rasterizer/SConscript
@@ -13,4 +13,7 @@ if env['WITH_BF_PYTHON']:
else:
defs.append('DISABLE_PYTHON')
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), defs, libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/SConscript b/source/gameengine/SConscript
index e7c9328688f..aebbf4d9fcf 100644
--- a/source/gameengine/SConscript
+++ b/source/gameengine/SConscript
@@ -14,7 +14,6 @@ SConscript(['BlenderRoutines/SConscript',
'Rasterizer/SConscript',
'Rasterizer/RAS_OpenGLRasterizer/SConscript',
'SceneGraph/SConscript',
- 'Physics/Bullet/SConscript'
])
if env['WITH_BF_PYTHON']:
@@ -22,3 +21,6 @@ if env['WITH_BF_PYTHON']:
if env['WITH_BF_PLAYER']:
SConscript(['GamePlayer/SConscript'])
+
+if env['WITH_BF_BULLET']:
+ SConscript(['Physics/Bullet/SConscript'])
diff --git a/source/gameengine/SceneGraph/SConscript b/source/gameengine/SceneGraph/SConscript
index 2a33cd67b5e..992a10befa2 100644
--- a/source/gameengine/SceneGraph/SConscript
+++ b/source/gameengine/SceneGraph/SConscript
@@ -6,4 +6,10 @@ sources = env.Glob('*.cpp')
incs = '. #intern/moto/include'
-env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), [], libtype=['core','player'], priority=[325,85], cxx_compileflags=env['BGE_CXXFLAGS'])
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), defs, libtype=['core','player'], priority=[325,85], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp
index 926468c662e..b8a67ccfc40 100644
--- a/source/gameengine/VideoTexture/ImageBuff.cpp
+++ b/source/gameengine/VideoTexture/ImageBuff.cpp
@@ -147,10 +147,10 @@ void ImageBuff::plot (unsigned char * img, short width, short height, short x, s
if (!m_imbuf) {
// allocate most basic imbuf, we will assign the rect buffer on the fly
- m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0, 0);
+ m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0);
}
- tmpbuf = IMB_allocImBuf(width, height, 0, 0, 0);
+ tmpbuf = IMB_allocImBuf(width, height, 0, 0);
// assign temporarily our buffer to the ImBuf buffer, we use the same format
tmpbuf->rect = (unsigned int*)img;
@@ -169,11 +169,11 @@ void ImageBuff::plot (ImageBuff* img, short x, short y, short mode)
if (!m_imbuf) {
// allocate most basic imbuf, we will assign the rect buffer on the fly
- m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0, 0);
+ m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0);
}
if (!img->m_imbuf) {
// allocate most basic imbuf, we will assign the rect buffer on the fly
- img->m_imbuf = IMB_allocImBuf(img->m_size[0], img->m_size[1], 0, 0, 0);
+ img->m_imbuf = IMB_allocImBuf(img->m_size[0], img->m_size[1], 0, 0);
}
// assign temporarily our buffer to the ImBuf buffer, we use the same format
img->m_imbuf->rect = img->m_image;