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:
-rw-r--r--doc/python_api/rst/change_log.rst637
-rw-r--r--intern/audaspace/intern/AUD_SoftwareDevice.cpp4
-rw-r--r--intern/cycles/app/cycles_test.cpp4
-rw-r--r--intern/cycles/app/cycles_xml.cpp1
-rw-r--r--intern/cycles/blender/addon/ui.py22
-rw-r--r--intern/cycles/blender/blender_mesh.cpp6
-rw-r--r--intern/cycles/blender/blender_object.cpp26
-rw-r--r--intern/cycles/blender/blender_session.cpp75
-rw-r--r--intern/cycles/blender/blender_session.h2
-rw-r--r--intern/cycles/blender/blender_sync.cpp41
-rw-r--r--intern/cycles/blender/blender_sync.h13
-rw-r--r--intern/cycles/kernel/kernel_path.h7
-rw-r--r--intern/cycles/kernel/kernel_types.h13
-rw-r--r--intern/cycles/render/buffers.h6
-rw-r--r--intern/cycles/render/integrator.cpp8
-rw-r--r--intern/cycles/render/integrator.h2
-rw-r--r--intern/cycles/render/session.cpp24
-rw-r--r--intern/cycles/render/tile.cpp16
-rw-r--r--intern/cycles/render/tile.h6
-rw-r--r--intern/iksolver/intern/IK_Solver.cpp3
-rw-r--r--intern/mikktspace/mikktspace.c1
-rw-r--r--intern/opennl/intern/opennl.c2
-rw-r--r--intern/opennl/superlu/get_perm_c.c18
-rw-r--r--intern/opennl/superlu/scolumn_bmod.c1
-rw-r--r--intern/opennl/superlu/strsv.c13
-rw-r--r--intern/opennl/superlu/sutil.c4
-rw-r--r--intern/opennl/superlu/util.h3
-rw-r--r--release/scripts/modules/bpy_extras/io_utils.py20
-rw-r--r--release/scripts/startup/bl_operators/clip.py19
-rw-r--r--release/scripts/startup/bl_operators/sequencer.py8
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_smart_project.py2
-rw-r--r--release/scripts/startup/bl_operators/wm.py35
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py3
-rw-r--r--source/blender/blenfont/BLF_translation.h5
-rw-r--r--source/blender/blenfont/intern/blf_lang.c20
-rw-r--r--source/blender/blenfont/intern/blf_translation.c45
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c15
-rw-r--r--source/blender/blenkernel/intern/fcurve.c5
-rw-r--r--source/blender/blenkernel/intern/idprop.c6
-rw-r--r--source/blender/blenkernel/intern/ipo.c9
-rw-r--r--source/blender/blenkernel/intern/movieclip.c9
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c3
-rw-r--r--source/blender/blenkernel/intern/tracking.c4
-rw-r--r--source/blender/blenkernel/intern/unit.c10
-rw-r--r--source/blender/blenlib/BLI_md5.h45
-rw-r--r--source/blender/blenlib/CMakeLists.txt2
-rw-r--r--source/blender/blenlib/intern/md5.c (renamed from source/blender/imbuf/intern/md5.c)102
-rw-r--r--source/blender/blenlib/intern/path_util.c8
-rw-r--r--source/blender/blenloader/CMakeLists.txt1
-rw-r--r--source/blender/blenloader/SConscript2
-rw-r--r--source/blender/blenloader/intern/readfile.c33
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c2
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/editors/interface/interface_handlers.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c15
-rw-r--r--source/blender/editors/interface/interface_widgets.c8
-rw-r--r--source/blender/editors/object/object_edit.c48
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_modifier.c13
-rw-r--r--source/blender/editors/object/object_ops.c1
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c15
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c36
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c13
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c6
-rw-r--r--source/blender/editors/space_view3d/drawobject.c84
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c6
-rw-r--r--source/blender/editors/transform/transform_conversions.c34
-rw-r--r--source/blender/editors/transform/transform_snap.c7
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c20
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h3
-rw-r--r--source/blender/gpu/intern/gpu_draw.c2
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c17
-rw-r--r--source/blender/gpu/intern/gpu_material.c1
-rw-r--r--source/blender/imbuf/CMakeLists.txt2
-rw-r--r--source/blender/imbuf/intern/md5.h119
-rw-r--r--source/blender/imbuf/intern/thumbs.c9
-rw-r--r--source/blender/makesdna/DNA_genfile.h20
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h3
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c160
-rw-r--r--source/blender/makesdna/intern/makesdna.c22
-rw-r--r--source/blender/makesrna/RNA_define.h2
-rw-r--r--source/blender/makesrna/intern/makesrna.c1
-rw-r--r--source/blender/makesrna/intern/rna_access.c59
-rw-r--r--source/blender/makesrna/intern/rna_define.c5
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_material.c4
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c5
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c1
-rw-r--r--source/blender/makesrna/intern/rna_rna.c19
-rw-r--r--source/blender/makesrna/intern/rna_scene.c2
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c47
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c31
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c3
-rw-r--r--source/blender/python/generic/bgl.c1
-rw-r--r--source/blender/python/intern/bpy_rna_array.c69
-rw-r--r--source/blender/python/intern/gpu.c16
-rw-r--r--source/blender/python/mathutils/mathutils.c1
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c279
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c28
-rw-r--r--source/blender/render/intern/raytrace/rayobject_octree.cpp2
-rw-r--r--source/blender/render/intern/source/convertblender.c10
-rw-r--r--source/blender/render/intern/source/pixelshading.c1
-rw-r--r--source/blender/render/intern/source/rayshade.c2
-rw-r--r--source/blender/render/intern/source/renderdatabase.c6
-rw-r--r--source/blender/render/intern/source/shadeoutput.c2
-rw-r--r--source/blender/render/intern/source/strand.c1
-rw-r--r--source/blender/render/intern/source/volumetric.c4
-rw-r--r--source/creator/CMakeLists.txt2
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp2
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_IPO_SGController.cpp11
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h49
-rw-r--r--source/tests/bl_pyapi_mathutils.py74
116 files changed, 2067 insertions, 733 deletions
diff --git a/doc/python_api/rst/change_log.rst b/doc/python_api/rst/change_log.rst
index d332c4faff4..5de7bb49e1c 100644
--- a/doc/python_api/rst/change_log.rst
+++ b/doc/python_api/rst/change_log.rst
@@ -1480,3 +1480,640 @@ Added
* :class:`bpy.types.SceneGameData.restrict_animation_updates`
* :class:`bpy.types.SceneGameData.show_obstacle_simulation`
+
+2.60 to 2.61
+============
+
+bpy.types.BlendDataGroups
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataGroups.is_updated`
+
+bpy.types.BlendDataBrushes
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataBrushes.is_updated`
+
+bpy.types.Theme
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Theme.clip_editor`
+
+bpy.types.BlendData
+-------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendData.movieclips`
+
+bpy.types.BlendDataGreasePencils
+--------------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataGreasePencils.is_updated`
+
+bpy.types.BlendDataImages
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataImages.is_updated`
+
+bpy.types.CompositorNodes
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.CompositorNodes.clear`
+
+bpy.types.BlendDataScenes
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataScenes.is_updated`
+
+bpy.types.RenderEngine
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.RenderEngine.bl_use_shading_nodes`
+* :class:`bpy.types.RenderEngine.is_animation`
+* :class:`bpy.types.RenderEngine.is_preview`
+* :class:`bpy.types.RenderEngine.tag_redraw`
+* :class:`bpy.types.RenderEngine.tag_update`
+* :class:`bpy.types.RenderEngine.update`
+* :class:`bpy.types.RenderEngine.update_progress`
+* :class:`bpy.types.RenderEngine.view_draw`
+* :class:`bpy.types.RenderEngine.view_update`
+
+bpy.types.BackgroundImage
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BackgroundImage.clip`
+* :class:`bpy.types.BackgroundImage.clip_user`
+* :class:`bpy.types.BackgroundImage.show_background_image`
+* :class:`bpy.types.BackgroundImage.source`
+* :class:`bpy.types.BackgroundImage.use_camera_clip`
+
+bpy.types.BlendDataMetaBalls
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataMetaBalls.is_updated`
+
+bpy.types.SpaceTimeline
+-----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.SpaceTimeline.cache_dynamicpaint`
+
+bpy.types.BlendDataMeshes
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataMeshes.is_updated`
+
+bpy.types.BlendDataNodeTrees
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataNodeTrees.is_updated`
+
+bpy.types.RenderSettings
+------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.RenderSettings.image_settings`
+* :class:`bpy.types.RenderSettings.use_shading_nodes`
+
+Removed
+^^^^^^^
+
+* **cineon_black**
+* **cineon_gamma**
+* **cineon_white**
+* **color_mode**
+* **exr_codec**
+* **exr_preview**
+* **exr_zbuf**
+* **file_format**
+* **file_quality**
+* **jpeg2k_depth**
+* **jpeg2k_preset**
+* **jpeg2k_ycc**
+* **use_cineon_log**
+* **use_exr_half**
+* **use_tiff_16bit**
+
+bpy.types.Curve
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Curve.cycles`
+
+bpy.types.RegionView3D
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.RegionView3D.view_camera_offset`
+* :class:`bpy.types.RegionView3D.view_camera_zoom`
+
+bpy.types.Scene
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Scene.active_clip`
+* :class:`bpy.types.Scene.cycles`
+
+bpy.types.NodeLinks
+-------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.NodeLinks.clear`
+
+bpy.types.BlendDataLattices
+---------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataLattices.is_updated`
+
+bpy.types.BlendDataParticles
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataParticles.is_updated`
+
+bpy.types.BlendDataWorlds
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataWorlds.is_updated`
+
+bpy.types.ObjectConstraints
+---------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ObjectConstraints.clear`
+
+bpy.types.RenderLayers
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.RenderLayers.new`
+* :class:`bpy.types.RenderLayers.remove`
+
+bpy.types.Menu
+--------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Menu.bl_description`
+
+bpy.types.Lamp
+--------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Lamp.cycles`
+* :class:`bpy.types.Lamp.node_tree`
+* :class:`bpy.types.Lamp.use_nodes`
+
+bpy.types.CurveSplines
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.CurveSplines.clear`
+
+bpy.types.Screen
+----------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Screen.use_play_clip_editors`
+
+bpy.types.BlendDataActions
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataActions.is_updated`
+
+bpy.types.BlendDataSounds
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataSounds.is_updated`
+
+bpy.types.Object
+----------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Object.cycles_visibility`
+* :class:`bpy.types.Object.slow_parent_offset`
+
+Removed
+^^^^^^^
+
+* **time_offset**
+* **use_time_offset_add_parent**
+* **use_time_offset_edit**
+* **use_time_offset_parent**
+* **use_time_offset_particle**
+
+bpy.types.ObjectModifiers
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ObjectModifiers.clear`
+
+bpy.types.BlendDataMaterials
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataMaterials.is_updated`
+
+bpy.types.MetaBallElements
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.MetaBallElements.clear`
+
+bpy.types.NodeSocket
+--------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.NodeSocket.group_socket`
+* :class:`bpy.types.NodeSocket.show_expanded`
+
+bpy.types.Node
+--------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Node.show_texture`
+
+bpy.types.CompositorNodeOutputFile
+----------------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.CompositorNodeOutputFile.image_settings`
+
+Removed
+^^^^^^^
+
+* **exr_codec**
+* **image_type**
+* **quality**
+* **use_exr_half**
+
+bpy.types.BlendDataTexts
+------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataTexts.is_updated`
+
+bpy.types.ThemeView3D
+---------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ThemeView3D.bundle_solid`
+* :class:`bpy.types.ThemeView3D.camera_path`
+
+bpy.types.Event
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Event.unicode`
+
+bpy.types.VertexGroups
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.VertexGroups.clear`
+
+bpy.types.TexMapping
+--------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.TexMapping.mapping`
+* :class:`bpy.types.TexMapping.mapping_x`
+* :class:`bpy.types.TexMapping.mapping_y`
+* :class:`bpy.types.TexMapping.mapping_z`
+
+bpy.types.BlendDataObjects
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataObjects.is_updated`
+
+bpy.types.BlendDataCurves
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataCurves.is_updated`
+
+bpy.types.BlendDataLibraries
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataLibraries.is_updated`
+
+bpy.types.ThemeUserInterface
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ThemeUserInterface.icon_alpha`
+* :class:`bpy.types.ThemeUserInterface.panel`
+
+bpy.types.SpaceNodeEditor
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.SpaceNodeEditor.shader_type`
+
+bpy.types.SpaceView3D
+---------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.SpaceView3D.show_bundle_names`
+* :class:`bpy.types.SpaceView3D.show_camera_path`
+* :class:`bpy.types.SpaceView3D.show_reconstruction`
+* :class:`bpy.types.SpaceView3D.tracks_draw_size`
+* :class:`bpy.types.SpaceView3D.tracks_draw_type`
+
+bpy.types.BlendDataWindowManagers
+---------------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataWindowManagers.is_updated`
+
+bpy.types.BlendDataScreens
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataScreens.is_updated`
+
+bpy.types.BlendDataArmatures
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataArmatures.is_updated`
+
+bpy.types.UserPreferencesInput
+------------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.UserPreferencesInput.tweak_threshold`
+
+Removed
+^^^^^^^
+
+* **ndof_orbit_invert_axes**
+
+bpy.types.Mesh
+--------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Mesh.cycles`
+
+bpy.types.BlendDataCameras
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataCameras.is_updated`
+
+bpy.types.MetaBall
+------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.MetaBall.cycles`
+
+bpy.types.UILayout
+------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.UILayout.template_image_settings`
+* :class:`bpy.types.UILayout.template_marker`
+* :class:`bpy.types.UILayout.template_movieclip`
+* :class:`bpy.types.UILayout.template_node_link`
+* :class:`bpy.types.UILayout.template_node_view`
+* :class:`bpy.types.UILayout.template_texture_user`
+* :class:`bpy.types.UILayout.template_track`
+
+Function Arguments
+^^^^^^^^^^^^^^^^^^
+
+* :class:`bpy.types.UILayout.template_list` (data, property, active_data, active_property, prop_list, rows, maxrows, type), *was (data, property, active_data, active_property, rows, maxrows, type)*
+
+bpy.types.ID
+------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ID.is_updated`
+* :class:`bpy.types.ID.is_updated_data`
+
+bpy.types.World
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.World.cycles`
+* :class:`bpy.types.World.node_tree`
+* :class:`bpy.types.World.use_nodes`
+
+bpy.types.BlendDataTextures
+---------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataTextures.is_updated`
+
+bpy.types.ShaderNodes
+---------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ShaderNodes.clear`
+
+bpy.types.TimelineMarkers
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.TimelineMarkers.clear`
+
+bpy.types.SpaceFileBrowser
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.SpaceFileBrowser.active_operator`
+
+bpy.types.Material
+------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Material.cycles`
+
+bpy.types.BlendDataSpeakers
+---------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataSpeakers.is_updated`
+
+bpy.types.Camera
+----------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Camera.angle_x`
+* :class:`bpy.types.Camera.angle_y`
+* :class:`bpy.types.Camera.cycles`
+* :class:`bpy.types.Camera.sensor_fit`
+* :class:`bpy.types.Camera.sensor_height`
+* :class:`bpy.types.Camera.sensor_width`
+* :class:`bpy.types.Camera.show_sensor`
+
+bpy.types.BlendDataLamps
+------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataLamps.is_updated`
+
+bpy.types.TextureNodes
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.TextureNodes.clear`
+
+bpy.types.BlendDataFonts
+------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataFonts.is_updated`
diff --git a/intern/audaspace/intern/AUD_SoftwareDevice.cpp b/intern/audaspace/intern/AUD_SoftwareDevice.cpp
index b1e5d8ccd75..1d993abab73 100644
--- a/intern/audaspace/intern/AUD_SoftwareDevice.cpp
+++ b/intern/audaspace/intern/AUD_SoftwareDevice.cpp
@@ -121,7 +121,9 @@ void AUD_SoftwareDevice::AUD_SoftwareHandle::update()
if(flags & AUD_RENDER_DISTANCE)
{
- if(m_device->m_distance_model == AUD_DISTANCE_MODEL_INVERSE_CLAMPED || m_device->m_distance_model == AUD_DISTANCE_MODEL_LINEAR_CLAMPED || m_device->m_distance_model == AUD_DISTANCE_MODEL_EXPONENT_CLAMPED)
+ if(m_device->m_distance_model == AUD_DISTANCE_MODEL_INVERSE_CLAMPED ||
+ m_device->m_distance_model == AUD_DISTANCE_MODEL_LINEAR_CLAMPED ||
+ m_device->m_distance_model == AUD_DISTANCE_MODEL_EXPONENT_CLAMPED)
{
distance = AUD_MAX(AUD_MIN(m_distance_max, distance), m_distance_reference);
}
diff --git a/intern/cycles/app/cycles_test.cpp b/intern/cycles/app/cycles_test.cpp
index 83816727404..d162dbf12a9 100644
--- a/intern/cycles/app/cycles_test.cpp
+++ b/intern/cycles/app/cycles_test.cpp
@@ -82,9 +82,9 @@ static void session_print_status()
session_print(status);
}
-static BufferParams session_buffer_params()
+static BufferParams& session_buffer_params()
{
- BufferParams buffer_params;
+ static BufferParams buffer_params;
buffer_params.width = options.width;
buffer_params.height = options.height;
buffer_params.full_width = options.width;
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index f5cc01cd062..21b03b56b7a 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -258,7 +258,6 @@ static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node)
xml_read_int(&integrator->min_bounce, node, "min_bounce");
xml_read_int(&integrator->max_bounce, node, "max_bounce");
xml_read_bool(&integrator->no_caustics, node, "no_caustics");
- xml_read_float(&integrator->blur_caustics, node, "blur_caustics");
}
/* Camera */
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index d631158f5eb..6e73795666e 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -160,18 +160,17 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
scene = context.scene
rd = scene.render
- # row = layout.row()
- # row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
+ row = layout.row()
+ row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
- # col = row.column(align=True)
- # col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
- # col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
+ col = row.column(align=True)
+ 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
- rl = rd.layers[0]
+ rl = rd.layers.active
row.prop(rl, "name")
- #row.prop(rd, "use_single_layer", text="", icon_only=True)
+ row.prop(rd, "use_single_layer", text="", icon_only=True)
split = layout.split()
@@ -183,6 +182,7 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
layout.separator()
+ rl = rd.layers[0]
layout.prop(rl, "material_override", text="Material")
@@ -745,6 +745,12 @@ def get_panels():
bpy.types.RENDER_PT_encoding,
bpy.types.RENDER_PT_dimensions,
bpy.types.RENDER_PT_stamp,
+ bpy.types.SCENE_PT_scene,
+ bpy.types.SCENE_PT_audio,
+ bpy.types.SCENE_PT_unit,
+ bpy.types.SCENE_PT_keying_sets,
+ bpy.types.SCENE_PT_keying_set_paths,
+ bpy.types.SCENE_PT_physics,
bpy.types.WORLD_PT_context_world,
bpy.types.DATA_PT_context_mesh,
bpy.types.DATA_PT_context_camera,
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index bb4fef4a602..b3c9cccfb5d 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -232,8 +232,10 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
BL::Object::material_slots_iterator slot;
for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) {
- if(render_layer.material_override)
- find_shader(render_layer.material_override, used_shaders, scene->default_surface);
+ BL::Material material_override = render_layers.front().material_override;
+
+ if(material_override)
+ find_shader(material_override, used_shaders, scene->default_surface);
else
find_shader(slot->material(), used_shaders, scene->default_surface);
}
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index ec22d3db6f7..608c5fda5ac 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -154,7 +154,7 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob,
/* Object */
-void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint visibility)
+void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint layer_flag)
{
/* light is handled separately */
if(object_is_light(b_ob)) {
@@ -181,11 +181,19 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
if(object_updated || (object->mesh && object->mesh->need_update)) {
object->name = b_ob.name().c_str();
object->tfm = tfm;
-
- object->visibility = object_ray_visibility(b_ob) & visibility;
+
+ /* visibility flags for both parent */
+ object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL;
if(b_parent.ptr.data != b_ob.ptr.data)
object->visibility &= object_ray_visibility(b_parent);
+ /* camera flag is not actually used, instead is tested
+ against render layer flags */
+ if(object->visibility & PATH_RAY_CAMERA) {
+ object->visibility |= layer_flag << PATH_RAY_LAYER_SHIFT;
+ object->visibility &= ~PATH_RAY_CAMERA;
+ }
+
object->tag_update(scene);
}
}
@@ -195,8 +203,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
{
/* layer data */
- uint scene_layer = render_layer.scene_layer;
- uint layer = render_layer.layer;
+ uint scene_layer = render_layers.front().scene_layer;
/* prepare for sync */
light_map.pre_sync();
@@ -212,11 +219,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
uint ob_layer = get_layer(b_ob->layers());
if(!hide && (ob_layer & scene_layer)) {
- uint visibility = PATH_RAY_ALL;
-
- if(!(ob_layer & layer))
- visibility &= ~PATH_RAY_CAMERA;
-
if(b_ob->is_duplicator()) {
/* dupli objects */
object_create_duplilist(*b_ob, b_scene);
@@ -226,7 +228,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
Transform tfm = get_transform(b_dup->matrix());
- sync_object(*b_ob, b_index, b_dup->object(), tfm, visibility);
+ sync_object(*b_ob, b_index, b_dup->object(), tfm, ob_layer);
b_index++;
}
@@ -244,7 +246,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
if(!hide) {
/* object itself */
Transform tfm = get_transform(b_ob->matrix_world());
- sync_object(*b_ob, 0, *b_ob, tfm, visibility);
+ sync_object(*b_ob, 0, *b_ob, tfm, ob_layer);
}
}
}
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 1803dd36beb..d8c65c7a607 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -40,7 +40,8 @@
CCL_NAMESPACE_BEGIN
BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_, BL::Scene b_scene_)
-: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(PointerRNA_NULL), b_rv3d(PointerRNA_NULL)
+: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(PointerRNA_NULL), b_rv3d(PointerRNA_NULL),
+ b_rr(PointerRNA_NULL), b_rlay(PointerRNA_NULL)
{
/* offline render */
BL::RenderSettings r = b_scene.render();
@@ -55,7 +56,8 @@ BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_
BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_, BL::Scene b_scene_,
BL::SpaceView3D b_v3d_, BL::RegionView3D b_rv3d_, int width_, int height_)
-: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(b_v3d_), b_rv3d(b_rv3d_)
+: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(b_v3d_), b_rv3d(b_rv3d_),
+ b_rr(PointerRNA_NULL), b_rlay(PointerRNA_NULL)
{
/* 3d view render */
width = width_;
@@ -64,6 +66,7 @@ BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_
last_redraw_time = 0.0f;
create_session();
+ session->start();
}
BlenderSession::~BlenderSession()
@@ -99,11 +102,9 @@ void BlenderSession::create_session()
session->progress.set_cancel_callback(function_bind(&BlenderSession::test_cancel, this));
session->set_pause(BlenderSync::get_session_pause(b_scene, background));
- /* start rendering */
+ /* set buffer parameters */
BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
-
session->reset(buffer_params, session_params.samples);
- session->start();
}
void BlenderSession::free_session()
@@ -114,42 +115,67 @@ void BlenderSession::free_session()
void BlenderSession::render()
{
- session->wait();
+ /* get buffer parameters */
+ BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+ int w = buffer_params.width, h = buffer_params.height;
- if(session->progress.get_cancel())
- return;
+ /* create render result */
+ RenderResult *rrp = RE_engine_begin_result((RenderEngine*)b_engine.ptr.data, 0, 0, w, h);
+ PointerRNA rrptr;
+ RNA_pointer_create(NULL, &RNA_RenderResult, rrp, &rrptr);
+ b_rr = BL::RenderResult(rrptr);
+
+ BL::RenderSettings r = b_scene.render();
+ BL::RenderResult::layers_iterator b_iter;
+ BL::RenderLayers b_rr_layers(r.ptr);
+
+ int active = 0;
+
+ /* render each layer */
+ for(b_rr.layers.begin(b_iter); b_iter != b_rr.layers.end(); ++b_iter, ++active) {
+ /* single layer render */
+ if(r.use_single_layer())
+ active = b_rr_layers.active_index();
+
+ /* set layer */
+ b_rlay = *b_iter;
- /* write result */
- write_render_result();
+ /* update scene */
+ sync->sync_data(b_v3d, active);
+
+ /* render */
+ session->start();
+ session->wait();
+
+ if(session->progress.get_cancel())
+ break;
+
+ /* write result */
+ write_render_result();
+ }
+
+ /* delete render result */
+ RE_engine_end_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data);
}
void BlenderSession::write_render_result()
{
- /* get result */
+ /* get state */
RenderBuffers *buffers = session->buffers;
float exposure = scene->film->exposure;
double total_time, sample_time;
int sample;
session->progress.get_sample(sample, total_time, sample_time);
+ /* get pixels */
float4 *pixels = buffers->copy_from_device(exposure, sample);
if(!pixels)
return;
- BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
- int w = buffer_params.width, h = buffer_params.height;
-
- struct RenderResult *rrp = RE_engine_begin_result((RenderEngine*)b_engine.ptr.data, 0, 0, w, h);
- PointerRNA rrptr;
- RNA_pointer_create(NULL, &RNA_RenderResult, rrp, &rrptr);
- BL::RenderResult rr(rrptr);
-
- BL::RenderResult::layers_iterator layer;
- rr.layers.begin(layer);
- rna_RenderLayer_rect_set(&layer->ptr, (float*)pixels);
-
- RE_engine_end_result((RenderEngine*)b_engine.ptr.data, rrp);
+ /* write pixels */
+ rna_RenderLayer_rect_set(&b_rlay.ptr, (float*)pixels);
+ RE_engine_update_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data);
delete [] pixels;
}
@@ -164,6 +190,7 @@ void BlenderSession::synchronize()
scene->params.modified(scene_params)) {
free_session();
create_session();
+ session->start();
return;
}
diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h
index e30b60c3d63..26fffcf3aff 100644
--- a/intern/cycles/blender/blender_session.h
+++ b/intern/cycles/blender/blender_session.h
@@ -69,6 +69,8 @@ public:
BL::Scene b_scene;
BL::SpaceView3D b_v3d;
BL::RegionView3D b_rv3d;
+ BL::RenderResult b_rr;
+ BL::RenderLayer b_rlay;
string last_status;
float last_progress;
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 4c8fe350b88..3443f76b1ce 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -48,7 +48,8 @@ BlenderSync::BlenderSync(BL::BlendData b_data_, BL::Scene b_scene_, Scene *scene
light_map(&scene_->lights),
world_map(NULL),
world_recalc(false),
- experimental(false)
+ experimental(false),
+ active_layer(0)
{
scene = scene_;
preview = preview_;
@@ -120,18 +121,18 @@ bool BlenderSync::sync_recalc()
return recalc;
}
-void BlenderSync::sync_data(BL::SpaceView3D b_v3d)
+void BlenderSync::sync_data(BL::SpaceView3D b_v3d, int layer)
{
- sync_integrator();
+ sync_render_layers(b_v3d);
+ sync_integrator(layer);
sync_film();
- sync_render_layer(b_v3d);
sync_shaders();
sync_objects(b_v3d);
}
/* Integrator */
-void BlenderSync::sync_integrator()
+void BlenderSync::sync_integrator(int layer)
{
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
@@ -152,9 +153,8 @@ void BlenderSync::sync_integrator()
integrator->transparent_shadows = get_boolean(cscene, "use_transparent_shadows");
integrator->no_caustics = get_boolean(cscene, "no_caustics");
- integrator->blur_caustics = get_float(cscene, "blur_caustics");
-
integrator->seed = get_int(cscene, "seed");
+ integrator->layer_flag = render_layers[layer].layer;
if(integrator->modified(previntegrator))
integrator->tag_update(scene);
@@ -186,27 +186,32 @@ void BlenderSync::sync_film()
/* Render Layer */
-void BlenderSync::sync_render_layer(BL::SpaceView3D b_v3d)
+void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d)
{
+ render_layers.clear();
+
if(b_v3d) {
- render_layer.scene_layer = get_layer(b_v3d.layers());
- render_layer.layer = render_layer.scene_layer;
- render_layer.material_override = PointerRNA_NULL;
+ RenderLayerInfo rlay;
+
+ rlay.scene_layer = get_layer(b_v3d.layers());
+ rlay.layer = rlay.scene_layer;
+ rlay.material_override = PointerRNA_NULL;
+
+ render_layers.push_back(rlay);
}
else {
BL::RenderSettings r = b_scene.render();
BL::RenderSettings::layers_iterator b_rlay;
- bool first = true;
for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) {
/* single layer for now */
- if(first) {
- render_layer.scene_layer = get_layer(b_scene.layers());
- render_layer.layer = get_layer(b_rlay->layers());
- render_layer.material_override = b_rlay->material_override();
+ RenderLayerInfo rlay;
- first = false;
- }
+ rlay.scene_layer = get_layer(b_scene.layers());
+ rlay.layer = get_layer(b_rlay->layers());
+ rlay.material_override = b_rlay->material_override();
+
+ render_layers.push_back(rlay);
}
}
}
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index 824904cd81d..60fdd7c386b 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -54,7 +54,7 @@ public:
/* sync */
bool sync_recalc();
- void sync_data(BL::SpaceView3D b_v3d);
+ void sync_data(BL::SpaceView3D b_v3d, int layer = 0);
void sync_camera(int width, int height);
void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
@@ -70,15 +70,15 @@ private:
void sync_materials();
void sync_objects(BL::SpaceView3D b_v3d);
void sync_film();
- void sync_integrator();
+ void sync_integrator(int layer);
void sync_view();
void sync_world();
- void sync_render_layer(BL::SpaceView3D b_v3d);
+ void sync_render_layers(BL::SpaceView3D b_v3d);
void sync_shaders();
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
Mesh *sync_mesh(BL::Object b_ob, bool object_updated);
- void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint visibility);
+ void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint layer_flag);
void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm);
/* util */
@@ -112,7 +112,10 @@ private:
uint scene_layer;
uint layer;
BL::Material material_override;
- } render_layer;
+ };
+
+ vector<RenderLayerInfo> render_layers;
+ int active_layer;
};
CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 05707f31352..d27ad861c6a 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -130,13 +130,16 @@ __device_inline void path_state_next(KernelGlobals *kg, PathState *state, int la
}
}
-__device_inline uint path_state_ray_visibility(PathState *state)
+__device_inline uint path_state_ray_visibility(KernelGlobals *kg, PathState *state)
{
uint flag = state->flag;
/* for visibility, diffuse/glossy are for reflection only */
if(flag & PATH_RAY_TRANSMIT)
flag &= ~(PATH_RAY_DIFFUSE|PATH_RAY_GLOSSY);
+ /* for camera visibility, use render layer flags */
+ if(flag & PATH_RAY_CAMERA)
+ flag |= kernel_data.integrator.layer_flag;
return flag;
}
@@ -249,7 +252,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
for(;; rng_offset += PRNG_BOUNCE_NUM) {
/* intersect scene */
Intersection isect;
- uint visibility = path_state_ray_visibility(&state);
+ uint visibility = path_state_ray_visibility(kg, &state);
if(!scene_intersect(kg, &ray, visibility, &isect)) {
/* eval background shader if nothing hit */
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index ea73f87a8a5..56db4d2b78a 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -100,7 +100,10 @@ enum PathTraceDimension {
/* these flag values correspond exactly to OSL defaults, so be careful not to
* change this, or if you do, set the "raytypes" shading system attribute with
- * your own new ray types and bitflag values */
+ * your own new ray types and bitflag values.
+ *
+ * for ray visibility tests in BVH traversal, the upper 20 bits are used for
+ * layer visibility tests. */
enum PathRayFlag {
PATH_RAY_CAMERA = 1,
@@ -117,7 +120,9 @@ enum PathRayFlag {
PATH_RAY_MIS_SKIP = 512,
- PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512)
+ PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512),
+
+ PATH_RAY_LAYER_SHIFT = (32-20)
};
/* Closure Label */
@@ -383,10 +388,12 @@ typedef struct KernelIntegrator {
/* caustics */
int no_caustics;
- float blur_caustics;
/* seed */
int seed;
+
+ /* render layer */
+ int layer_flag;
} KernelIntegrator;
typedef struct KernelBVH {
diff --git a/intern/cycles/render/buffers.h b/intern/cycles/render/buffers.h
index 66bd03c8893..f4a9b37c09b 100644
--- a/intern/cycles/render/buffers.h
+++ b/intern/cycles/render/buffers.h
@@ -56,6 +56,12 @@ public:
full_height = 0;
}
+ void get_offset_stride(int& offset, int& stride)
+ {
+ offset = -(full_x + full_y*width);
+ stride = width;
+ }
+
bool modified(const BufferParams& params)
{
return !(full_x == params.full_x
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp
index 9d129d8e8db..47059a0a009 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -41,9 +41,8 @@ Integrator::Integrator()
transparent_shadows = false;
no_caustics = false;
- blur_caustics = 0.0f;
-
seed = 0;
+ layer_flag = ~0;
need_update = true;
}
@@ -81,9 +80,8 @@ void Integrator::device_update(Device *device, DeviceScene *dscene)
kintegrator->transparent_shadows = transparent_shadows;
kintegrator->no_caustics = no_caustics;
- kintegrator->blur_caustics = blur_caustics;
-
kintegrator->seed = hash_int(seed);
+ kintegrator->layer_flag = layer_flag << PATH_RAY_LAYER_SHIFT;
/* sobol directions table */
int dimensions = PRNG_BASE_NUM + (max_bounce + transparent_max_bounce + 2)*PRNG_BOUNCE_NUM;
@@ -115,7 +113,7 @@ bool Integrator::modified(const Integrator& integrator)
transparent_probalistic == integrator.transparent_probalistic &&
transparent_shadows == integrator.transparent_shadows &&
no_caustics == integrator.no_caustics &&
- blur_caustics == integrator.blur_caustics &&
+ layer_flag == integrator.layer_flag &&
seed == integrator.seed);
}
diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h
index 52032fa1a26..e610d670142 100644
--- a/intern/cycles/render/integrator.h
+++ b/intern/cycles/render/integrator.h
@@ -41,9 +41,9 @@ public:
bool transparent_shadows;
bool no_caustics;
- float blur_caustics;
int seed;
+ int layer_flag;
bool need_update;
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 26c4dbfbb7a..be2e493dc7f 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -515,10 +515,8 @@ void Session::update_scene()
knows nothing about progressive or cropped rendering, it just gets the
image dimensions passed in */
Camera *cam = scene->camera;
- float progressive_x = tile_manager.state.width/(float)tile_manager.params.width;
- float progressive_y = tile_manager.state.height/(float)tile_manager.params.height;
- int width = tile_manager.params.full_width*progressive_x;
- int height = tile_manager.params.full_height*progressive_y;
+ int width = tile_manager.state.buffer.full_width;
+ int height = tile_manager.state.buffer.full_height;
if(width != cam->width || height != cam->height) {
cam->width = width;
@@ -574,16 +572,15 @@ void Session::path_trace(Tile& tile)
/* add path trace task */
DeviceTask task(DeviceTask::PATH_TRACE);
- task.x = tile_manager.state.full_x + tile.x;
- task.y = tile_manager.state.full_y + tile.y;
+ task.x = tile_manager.state.buffer.full_x + tile.x;
+ task.y = tile_manager.state.buffer.full_y + tile.y;
task.w = tile.w;
task.h = tile.h;
task.buffer = buffers->buffer.device_pointer;
task.rng_state = buffers->rng_state.device_pointer;
task.sample = tile_manager.state.sample;
task.resolution = tile_manager.state.resolution;
- task.offset = -(tile_manager.state.full_x + tile_manager.state.full_y*tile_manager.state.width);
- task.stride = tile_manager.state.width;
+ tile_manager.state.buffer.get_offset_stride(task.offset, task.stride);
device->task_add(task);
}
@@ -593,16 +590,15 @@ void Session::tonemap()
/* add tonemap task */
DeviceTask task(DeviceTask::TONEMAP);
- task.x = tile_manager.state.full_x;
- task.y = tile_manager.state.full_y;
- task.w = tile_manager.state.width;
- task.h = tile_manager.state.height;
+ task.x = tile_manager.state.buffer.full_x;
+ task.y = tile_manager.state.buffer.full_y;
+ task.w = tile_manager.state.buffer.width;
+ task.h = tile_manager.state.buffer.height;
task.rgba = display->rgba.device_pointer;
task.buffer = buffers->buffer.device_pointer;
task.sample = tile_manager.state.sample;
task.resolution = tile_manager.state.resolution;
- task.offset = -(tile_manager.state.full_x + tile_manager.state.full_y*tile_manager.state.width);
- task.stride = tile_manager.state.width;
+ tile_manager.state.buffer.get_offset_stride(task.offset, task.stride);
if(task.w > 0 && task.h > 0) {
device->task_add(task);
diff --git a/intern/cycles/render/tile.cpp b/intern/cycles/render/tile.cpp
index b118a7ba478..40833e5b08b 100644
--- a/intern/cycles/render/tile.cpp
+++ b/intern/cycles/render/tile.cpp
@@ -55,10 +55,7 @@ void TileManager::reset(BufferParams& params_, int samples_)
samples = samples_;
- state.full_x = 0;
- state.full_y = 0;
- state.width = 0;
- state.height = 0;
+ state.buffer = BufferParams();
state.sample = -1;
state.resolution = start_resolution;
state.tiles.clear();
@@ -92,10 +89,13 @@ void TileManager::set_tiles()
}
}
- state.full_x = params.full_x/resolution;
- state.full_y = params.full_y/resolution;
- state.width = image_w;
- state.height = image_h;
+ state.buffer.width = image_w;
+ state.buffer.height = image_h;
+
+ state.buffer.full_x = params.full_x/resolution;
+ state.buffer.full_y = params.full_y/resolution;
+ state.buffer.full_width = max(1, params.full_width/resolution);
+ state.buffer.full_height = max(1, params.full_height/resolution);
}
bool TileManager::done()
diff --git a/intern/cycles/render/tile.h b/intern/cycles/render/tile.h
index 76863d23498..b6e610c8d90 100644
--- a/intern/cycles/render/tile.h
+++ b/intern/cycles/render/tile.h
@@ -41,11 +41,9 @@ public:
class TileManager {
public:
BufferParams params;
+
struct State {
- int full_x;
- int full_y;
- int width;
- int height;
+ BufferParams buffer;
int sample;
int resolution;
list<Tile> tiles;
diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp
index af49b07d064..3876f26362c 100644
--- a/intern/iksolver/intern/IK_Solver.cpp
+++ b/intern/iksolver/intern/IK_Solver.cpp
@@ -225,11 +225,12 @@ void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness)
void IK_GetBasisChange(IK_Segment *seg, float basis_change[][3])
{
IK_QSegment *qseg = (IK_QSegment*)seg;
- const MT_Matrix3x3& change = qseg->BasisChange();
if (qseg->Translational() && qseg->Composite())
qseg = qseg->Composite();
+ const MT_Matrix3x3& change = qseg->BasisChange();
+
// convert from moto row major to blender column major
basis_change[0][0] = (float)change[0][0];
basis_change[1][0] = (float)change[0][1];
diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c
index ff857e82d8f..2036e601bcb 100644
--- a/intern/mikktspace/mikktspace.c
+++ b/intern/mikktspace/mikktspace.c
@@ -1350,7 +1350,6 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
for(s=0; s<iUniqueSubGroups; s++)
free(pUniSubGroups[s].pTriMembers);
iUniqueTspaces += iUniqueSubGroups;
- iUniqueSubGroups = 0;
}
// clean up
diff --git a/intern/opennl/intern/opennl.c b/intern/opennl/intern/opennl.c
index c3fb7135fcb..20b4c0a6681 100644
--- a/intern/opennl/intern/opennl.c
+++ b/intern/opennl/intern/opennl.c
@@ -1137,7 +1137,7 @@ static NLboolean __nlInvert_SUPERLU(__NLContext *context) {
/* SuperLU variables */
SuperMatrix B;
- NLint info;
+ NLint info = 0;
for(j=0; j<context->nb_rhs; j++, b+=n, x+=n) {
/* Create superlu array for B */
diff --git a/intern/opennl/superlu/get_perm_c.c b/intern/opennl/superlu/get_perm_c.c
index 2eb0aea678e..320fe3471f4 100644
--- a/intern/opennl/superlu/get_perm_c.c
+++ b/intern/opennl/superlu/get_perm_c.c
@@ -368,7 +368,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
int m, n, bnz, *b_colptr, i;
int delta, maxint, nofsub, *invp;
int *b_rowind, *dhead, *qsize, *llist, *marker;
- double t, SuperLU_timer_();
+ /* double t, SuperLU_timer_(); */
/* make gcc happy */
b_rowind=NULL;
@@ -377,7 +377,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
m = A->nrow;
n = A->ncol;
- t = SuperLU_timer_();
+ /* t = SuperLU_timer_(); */
switch ( ispec ) {
case 0: /* Natural ordering */
for (i = 0; i < n; ++i) perm_c[i] = i;
@@ -391,8 +391,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
#if ( PRNTlevel>=1 )
printf("Use minimum degree ordering on A'*A.\n");
#endif
- t = SuperLU_timer_() - t;
- /*printf("Form A'*A time = %8.3f\n", t);*/
+ /*t = SuperLU_timer_() - t;
+ printf("Form A'*A time = %8.3f\n", t);*/
break;
case 2: /* Minimum degree ordering on A'+A */
if ( m != n ) ABORT("Matrix is not square");
@@ -401,8 +401,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
#if ( PRNTlevel>=1 )
printf("Use minimum degree ordering on A'+A.\n");
#endif
- t = SuperLU_timer_() - t;
- /*printf("Form A'+A time = %8.3f\n", t);*/
+ /*t = SuperLU_timer_() - t;
+ printf("Form A'+A time = %8.3f\n", t);*/
break;
case 3: /* Approximate minimum degree column ordering. */
get_colamd(m, n, Astore->nnz, Astore->colptr, Astore->rowind,
@@ -417,7 +417,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
}
if ( bnz != 0 ) {
- t = SuperLU_timer_();
+ /* t = SuperLU_timer_(); */
/* Initialize and allocate storage for GENMMD. */
delta = 1; /* DELTA is a parameter to allow the choice of nodes
@@ -452,8 +452,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
SUPERLU_FREE(llist);
SUPERLU_FREE(marker);
- t = SuperLU_timer_() - t;
- /* printf("call GENMMD time = %8.3f\n", t);*/
+ /* t = SuperLU_timer_() - t;
+ printf("call GENMMD time = %8.3f\n", t);*/
} else { /* Empty adjacency structure */
for (i = 0; i < n; ++i) perm_c[i] = i;
diff --git a/intern/opennl/superlu/scolumn_bmod.c b/intern/opennl/superlu/scolumn_bmod.c
index cb8d83686be..3d4f5968778 100644
--- a/intern/opennl/superlu/scolumn_bmod.c
+++ b/intern/opennl/superlu/scolumn_bmod.c
@@ -303,7 +303,6 @@ scolumn_bmod (
d_fsupc=0 if fsupc >= fpanelc. */
d_fsupc = fst_col - fsupc;
- lptr = xlsub[fsupc] + d_fsupc;
luptr = xlusup[fst_col] + d_fsupc;
nsupr = xlsub[fsupc+1] - xlsub[fsupc]; /* Leading dimension */
nsupc = jcol - fst_col; /* Excluding jcol */
diff --git a/intern/opennl/superlu/strsv.c b/intern/opennl/superlu/strsv.c
index a1d66ed7341..da904ba3e9d 100644
--- a/intern/opennl/superlu/strsv.c
+++ b/intern/opennl/superlu/strsv.c
@@ -9,9 +9,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
{
- /* System generated locals */
- int i__1, i__2;
-
/* Local variables */
static int info;
static float temp;
@@ -213,14 +210,12 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
} else {
if (*incx == 1) {
- i__1 = *n;
for (j = 1; j <= *n; ++j) {
if (X(j) != 0.f) {
if (nounit) {
X(j) /= A(j,j);
}
temp = X(j);
- i__2 = *n;
for (i = j + 1; i <= *n; ++i) {
X(i) -= temp * A(i,j);
/* L50: */
@@ -230,7 +225,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
} else {
jx = kx;
- i__1 = *n;
for (j = 1; j <= *n; ++j) {
if (X(jx) != 0.f) {
if (nounit) {
@@ -238,7 +232,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
temp = X(jx);
ix = jx;
- i__2 = *n;
for (i = j + 1; i <= *n; ++i) {
ix += *incx;
X(ix) -= temp * A(i,j);
@@ -256,10 +249,8 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
if (lsame_(uplo, "U")) {
if (*incx == 1) {
- i__1 = *n;
for (j = 1; j <= *n; ++j) {
temp = X(j);
- i__2 = j - 1;
for (i = 1; i <= j-1; ++i) {
temp -= A(i,j) * X(i);
/* L90: */
@@ -272,11 +263,9 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
} else {
jx = kx;
- i__1 = *n;
for (j = 1; j <= *n; ++j) {
temp = X(jx);
ix = kx;
- i__2 = j - 1;
for (i = 1; i <= j-1; ++i) {
temp -= A(i,j) * X(ix);
ix += *incx;
@@ -294,7 +283,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
if (*incx == 1) {
for (j = *n; j >= 1; --j) {
temp = X(j);
- i__1 = j + 1;
for (i = *n; i >= j+1; --i) {
temp -= A(i,j) * X(i);
/* L130: */
@@ -311,7 +299,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
for (j = *n; j >= 1; --j) {
temp = X(jx);
ix = kx;
- i__1 = j + 1;
for (i = *n; i >= j+1; --i) {
temp -= A(i,j) * X(ix);
ix -= *incx;
diff --git a/intern/opennl/superlu/sutil.c b/intern/opennl/superlu/sutil.c
index 510ade8233c..a77e87b9c65 100644
--- a/intern/opennl/superlu/sutil.c
+++ b/intern/opennl/superlu/sutil.c
@@ -370,8 +370,6 @@ void
sFillRHS(trans_t trans, int nrhs, float *x, int ldx,
SuperMatrix *A, SuperMatrix *B)
{
- NCformat *Astore;
- float *Aval;
DNformat *Bstore;
float *rhs;
float one = 1.0;
@@ -379,8 +377,6 @@ sFillRHS(trans_t trans, int nrhs, float *x, int ldx,
int ldc;
char transc[1];
- Astore = A->Store;
- Aval = (float *) Astore->nzval;
Bstore = B->Store;
rhs = Bstore->nzval;
ldc = Bstore->lda;
diff --git a/intern/opennl/superlu/util.h b/intern/opennl/superlu/util.h
index f13108b2256..c4c478cec2b 100644
--- a/intern/opennl/superlu/util.h
+++ b/intern/opennl/superlu/util.h
@@ -24,7 +24,8 @@
#define NUM_TEMPV(m,w,t,b) ( SUPERLU_MAX(m, (t + b)*w) )
#ifndef USER_ABORT
-#define USER_ABORT(msg) superlu_abort_and_exit(msg)
+#define USER_ABORT(msg) \
+ { fprintf(stderr, "%s", msg); exit (-1); }
#endif
#define ABORT(err_msg) \
diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py
index 90f0d3f1c1d..38fdb8f5fec 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -121,24 +121,24 @@ _axis_convert_matrix = (
((-1.0, 0.0, 0.0), (0.0, 0.0, 1.0), (0.0, 1.0, 0.0)),
((-1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, -1.0)),
((0.0, -1.0, 0.0), (-1.0, 0.0, 0.0), (0.0, 0.0, -1.0)),
- ((0.0, -1.0, 0.0), (0.0, 0.0, -1.0), (1.0, 0.0, 0.0)),
- ((0.0, -1.0, 0.0), (0.0, 0.0, 1.0), (-1.0, 0.0, 0.0)),
- ((0.0, -1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
+ ((0.0, 0.0, 1.0), (-1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
((0.0, 0.0, -1.0), (-1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
+ ((0.0, 1.0, 0.0), (-1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
+ ((0.0, -1.0, 0.0), (0.0, 0.0, 1.0), (-1.0, 0.0, 0.0)),
((0.0, 0.0, -1.0), (0.0, -1.0, 0.0), (-1.0, 0.0, 0.0)),
- ((0.0, 0.0, -1.0), (0.0, 1.0, 0.0), (1.0, 0.0, 0.0)),
- ((0.0, 0.0, -1.0), (1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
- ((0.0, 0.0, 1.0), (-1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
- ((0.0, 0.0, 1.0), (0.0, -1.0, 0.0), (1.0, 0.0, 0.0)),
((0.0, 0.0, 1.0), (0.0, 1.0, 0.0), (-1.0, 0.0, 0.0)),
- ((0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
- ((0.0, 1.0, 0.0), (-1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
((0.0, 1.0, 0.0), (0.0, 0.0, -1.0), (-1.0, 0.0, 0.0)),
+ ((0.0, -1.0, 0.0), (0.0, 0.0, -1.0), (1.0, 0.0, 0.0)),
+ ((0.0, 0.0, 1.0), (0.0, -1.0, 0.0), (1.0, 0.0, 0.0)),
+ ((0.0, 0.0, -1.0), (0.0, 1.0, 0.0), (1.0, 0.0, 0.0)),
((0.0, 1.0, 0.0), (0.0, 0.0, 1.0), (1.0, 0.0, 0.0)),
+ ((0.0, -1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
+ ((0.0, 0.0, -1.0), (1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
+ ((0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
((0.0, 1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, -1.0)),
((1.0, 0.0, 0.0), (0.0, -1.0, 0.0), (0.0, 0.0, -1.0)),
- ((1.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, 1.0, 0.0)),
((1.0, 0.0, 0.0), (0.0, 0.0, 1.0), (0.0, -1.0, 0.0)),
+ ((1.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, 1.0, 0.0)),
)
# store args as a single int
diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py
index 061c66dc1fa..cb21f17cff5 100644
--- a/release/scripts/startup/bl_operators/clip.py
+++ b/release/scripts/startup/bl_operators/clip.py
@@ -188,7 +188,7 @@ class CLIP_OT_delete_proxy(Operator):
proxydir = clip.proxy.directory
else:
clipdir = os.path.dirname(clip.filepath)
- proxydir = os.path.join(clipdir, 'BL_proxy')
+ proxydir = os.path.join(clipdir, "BL_proxy")
clipfile = os.path.basename(clip.filepath)
proxy = os.path.join(proxydir, clipfile)
@@ -196,15 +196,15 @@ class CLIP_OT_delete_proxy(Operator):
# proxy_<quality>[_undostorted]
for x in (25, 50, 75, 100):
- d = os.path.join(absproxy, 'proxy_' + str(x))
+ d = os.path.join(absproxy, "proxy_%d" % x)
self._rmproxy(d)
- self._rmproxy(d + '_undistorted')
- self._rmproxy(os.path.join(absproxy, 'proxy_' + str(x) + '.avi'))
+ self._rmproxy(d + "_undistorted")
+ self._rmproxy(os.path.join(absproxy, "proxy_%d.avi" % x))
- tc = ('free_run.blen_tc',
- 'interp_free_run.blen_tc',
- 'record_run.blen_tc')
+ tc = ("free_run.blen_tc",
+ "interp_free_run.blen_tc",
+ "record_run.blen_tc")
for x in tc:
self._rmproxy(os.path.join(absproxy, x))
@@ -269,7 +269,7 @@ object's movement caused by this constraint"""
# TODO: several camera solvers and track followers would fail,
# but can't think about eal workflow where it'll be useful
for x in ob.constraints:
- if x.type in ('CAMERA_SOLVER', 'FOLLOW_TRACK'):
+ if x.type in {'CAMERA_SOLVER', 'FOLLOW_TRACK'}:
con = x
if not con:
@@ -340,7 +340,8 @@ object's movement caused by this constraint"""
def execute(self, context):
scene = context.scene
-
+ # XXX, should probably use context.selected_editable_objects
+ # since selected objects can be from a lib or in hidden layer!
for ob in scene.objects:
if ob.select:
self._bake_object(scene, ob)
diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py
index 67b9be59f2a..39c73f20664 100644
--- a/release/scripts/startup/bl_operators/sequencer.py
+++ b/release/scripts/startup/bl_operators/sequencer.py
@@ -60,14 +60,14 @@ class SequencerCrossfadeSounds(Operator):
if seq1.frame_final_end > seq2.frame_final_start:
tempcfra = context.scene.frame_current
context.scene.frame_current = seq2.frame_final_start
- seq1.keyframe_insert('volume')
+ seq1.keyframe_insert("volume")
context.scene.frame_current = seq1.frame_final_end
seq1.volume = 0
- seq1.keyframe_insert('volume')
- seq2.keyframe_insert('volume')
+ seq1.keyframe_insert("volume")
+ seq2.keyframe_insert("volume")
context.scene.frame_current = seq2.frame_final_start
seq2.volume = 0
- seq2.keyframe_insert('volume')
+ seq2.keyframe_insert("volume")
context.scene.frame_current = tempcfra
return {'FINISHED'}
else:
diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
index 4a78d8fc9be..8fee21cdad5 100644
--- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py
+++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
@@ -756,7 +756,7 @@ def VectoQuat(vec):
class thickface(object):
- __slots__= ('v', 'uv', 'no', 'area', 'edge_keys')
+ __slost__= "v", "uv", "no", "area", "edge_keys"
def __init__(self, face, uv_layer, mesh_verts):
self.v = [mesh_verts[i] for i in face.vertices]
self.uv = [uv_layer[i].uv for i in face.loops]
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 58941e00914..4f498e72f4b 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -766,12 +766,12 @@ class WM_OT_path_open(Operator):
return {'CANCELLED'}
if sys.platform[:3] == "win":
- subprocess.Popen(['start', filepath], shell=True)
- elif sys.platform == 'darwin':
- subprocess.Popen(['open', filepath])
+ subprocess.Popen(["start", filepath], shell=True)
+ elif sys.platform == "darwin":
+ subprocess.Popen(["open", filepath])
else:
try:
- subprocess.Popen(['xdg-open', filepath])
+ subprocess.Popen(["xdg-open", filepath])
except OSError:
# xdg-open *should* be supported by recent Gnome, KDE, Xfce
pass
@@ -847,8 +847,8 @@ class WM_OT_doc_edit(Operator):
print("sending data:", data_dict)
import xmlrpc.client
- user = 'blenderuser'
- pwd = 'blender>user'
+ user = "blenderuser"
+ pwd = "blender>user"
docblog = xmlrpc.client.ServerProxy(self._url)
docblog.metaWeblog.newPost(1, user, pwd, data_dict, 1)
@@ -986,9 +986,8 @@ class WM_OT_properties_edit(Operator):
prop_ui = rna_idprop_ui_prop_get(item, prop)
if prop_type in {float, int}:
-
- prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.min)
- prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.max)
+ prop_ui["soft_min"] = prop_ui["min"] = prop_type(self.min)
+ prop_ui["soft_max"] = prop_ui["max"] = prop_type(self.max)
prop_ui['description'] = self.description
@@ -1035,7 +1034,7 @@ class WM_OT_properties_add(Operator):
item = eval("context.%s" % data_path)
def unique_name(names):
- prop = 'prop'
+ prop = "prop"
prop_new = prop
i = 1
while prop_new in names:
@@ -1163,10 +1162,10 @@ class WM_OT_copy_prev_settings(Operator):
# in 2.57 and earlier windows installers, system scripts were copied
# into the configuration directory, don't want to copy those
- system_script = os.path.join(path_dst, 'scripts/modules/bpy_types.py')
+ system_script = os.path.join(path_dst, "scripts/modules/bpy_types.py")
if os.path.isfile(system_script):
- shutil.rmtree(os.path.join(path_dst, 'scripts'))
- shutil.rmtree(os.path.join(path_dst, 'plugins'))
+ shutil.rmtree(os.path.join(path_dst, "scripts"))
+ shutil.rmtree(os.path.join(path_dst, "plugins"))
# don't loose users work if they open the splash later.
if bpy.data.is_saved is bpy.data.is_dirty is False:
@@ -1178,20 +1177,20 @@ class WM_OT_copy_prev_settings(Operator):
return {'CANCELLED'}
class WM_OT_blenderplayer_start(bpy.types.Operator):
- '''Launches the Blenderplayer with the current blendfile'''
+ '''Launch the Blenderplayer with the current blendfile'''
bl_idname = "wm.blenderplayer_start"
bl_label = "Start"
blender_bin_path = bpy.app.binary_path
blender_bin_dir = os.path.dirname(blender_bin_path)
ext = os.path.splitext(blender_bin_path)[-1]
- player_path = os.path.join(blender_bin_dir, 'blenderplayer' + ext)
+ player_path = os.path.join(blender_bin_dir, "blenderplayer" + ext)
def execute(self, context):
import sys
- if sys.platform == 'darwin':
- self.player_path = os.path.join(self.blender_bin_dir, '../../../blenderplayer.app/Contents/MacOS/blenderplayer')
+ if sys.platform == "darwin":
+ self.player_path = os.path.join(self.blender_bin_dir, "../../../blenderplayer.app/Contents/MacOS/blenderplayer")
filepath = bpy.app.tempdir + "game.blend"
bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True)
@@ -1451,7 +1450,7 @@ class WM_OT_operator_cheat_sheet(Operator):
for op_submodule_name in dir(op_module):
op = getattr(op_module, op_submodule_name)
text = repr(op)
- if text.split("\n")[-1].startswith('bpy.ops.'):
+ if text.split("\n")[-1].startswith("bpy.ops."):
op_strings.append(text)
tot += 1
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 85c4f222fe5..6801c2100ed 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -992,6 +992,7 @@ class VIEW3D_MT_object_game(Menu):
layout = self.layout
layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
+ layout.operator("object.game_physics_copy", text="Copy Physics Properties")
layout.separator()
@@ -2247,6 +2248,8 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
col.prop(mesh, "show_extra_edge_length")
col.prop(mesh, "show_extra_face_angle")
col.prop(mesh, "show_extra_face_area")
+ if bpy.app.debug:
+ col.prop(mesh, "show_extra_indices")
class VIEW3D_PT_view3d_curvedisplay(Panel):
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index ddbc9a6a760..ce53b76da01 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -33,6 +33,8 @@
#ifndef BLF_TRANSLATION_H
#define BLF_TRANSLATION_H
+#define TEXT_DOMAIN_NAME "blender"
+
/* blf_translation.c */
#ifdef WITH_INTERNATIONAL
@@ -40,7 +42,8 @@ unsigned char *BLF_get_unifont(int *unifont_size);
void BLF_free_unifont(void);
#endif
-const char* BLF_gettext(const char *msgid);
+const char *BLF_gettext(const char *msgid);
+const char *BLF_pgettext(const char *context, const char *message);
/* blf_lang.c */
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 2ba23e501b4..71e4fba94f6 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -58,7 +58,6 @@
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
-#define DOMAIN_NAME "blender"
#define SYSTEM_ENCODING_DEFAULT "UTF-8"
#define FONT_SIZE_DEFAULT 12
@@ -86,7 +85,7 @@ static const char *locales[] = {
"Chinese (Traditional)_China.1252", "zh_TW",
"russian", "ru_RU",
"croatian", "hr_HR",
- "serbian", "sr_RS",
+ "serbian", "sr",
"ukrainian", "uk_UA",
"polish", "pl_PL",
"romanian", "ro_RO",
@@ -96,7 +95,8 @@ static const char *locales[] = {
"korean", "ko_KR",
"nepali", "ne_NP",
"persian", "fa_PE",
- "indonesian", "id_ID"
+ "indonesian", "id_ID",
+ "serbian (latin)", "sr@latin",
};
void BLF_lang_init(void)
@@ -189,6 +189,12 @@ void BLF_lang_set(const char *str)
if (locreturn == NULL) {
printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
+
+ /* fallback to default settings */
+ locreturn= setlocale(LC_ALL, "");
+ BLI_setenv("LANG", default_locale);
+ BLI_setenv("LANGUAGE", default_locale);
+
ok= 0;
}
@@ -204,15 +210,15 @@ void BLF_lang_set(const char *str)
setlocale(LC_NUMERIC, "C");
- textdomain(DOMAIN_NAME);
- bindtextdomain(DOMAIN_NAME, global_messagepath);
- bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name);
+ textdomain(TEXT_DOMAIN_NAME);
+ bindtextdomain(TEXT_DOMAIN_NAME, global_messagepath);
+ bind_textdomain_codeset(TEXT_DOMAIN_NAME, global_encoding_name);
}
void BLF_lang_encoding(const char *str)
{
BLI_strncpy(global_encoding_name, str, sizeof(global_encoding_name));
- /* bind_textdomain_codeset(DOMAIN_NAME, encoding_name); */
+ /* bind_textdomain_codeset(TEXT_DOMAIN_NAME, encoding_name); */
}
#else /* ! WITH_INTERNATIONAL */
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index fe14f5d4d1c..1d82abcf32d 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -29,9 +29,19 @@
*/
#include <stdlib.h>
+#include <string.h>
#ifdef WITH_INTERNATIONAL
#include <libintl.h>
+#include <locale.h>
+
+#define GETTEXT_CONTEXT_GLUE "\004"
+
+/* needed for windows version of gettext */
+#ifndef LC_MESSAGES
+# define LC_MESSAGES 1729
+#endif
+
#endif
#include "MEM_guardedalloc.h"
@@ -91,6 +101,40 @@ const char* BLF_gettext(const char *msgid)
#endif
}
+const char *BLF_pgettext(const char *context, const char *message)
+{
+#ifdef WITH_INTERNATIONAL
+ char static_msg_ctxt_id[1024];
+ char *dynamic_msg_ctxt_id = NULL;
+ char *msg_ctxt_id;
+ const char *translation;
+
+ size_t overall_length = strlen(context) + strlen(message) + sizeof(GETTEXT_CONTEXT_GLUE) + 1;
+
+ if (overall_length > sizeof(static_msg_ctxt_id)) {
+ dynamic_msg_ctxt_id = malloc(overall_length);
+ msg_ctxt_id = dynamic_msg_ctxt_id;
+ }
+ else {
+ msg_ctxt_id = static_msg_ctxt_id;
+ }
+
+ sprintf(msg_ctxt_id, "%s%s%s", context, GETTEXT_CONTEXT_GLUE, message);
+
+ translation = (char*)dcgettext(TEXT_DOMAIN_NAME, msg_ctxt_id, LC_MESSAGES);
+
+ if (dynamic_msg_ctxt_id)
+ free(dynamic_msg_ctxt_id);
+
+ if (translation == msg_ctxt_id)
+ translation = message;
+
+ return translation;
+#else
+ return message;
+#endif
+}
+
int BLF_translate_iface(void)
{
#ifdef WITH_INTERNATIONAL
@@ -132,4 +176,3 @@ const char *BLF_translate_do_tooltip(const char *msgid)
return msgid;
#endif
}
-
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 4eaf49dc679..e17566b7d55 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -1704,7 +1704,7 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
/* sort the base list on dependency order */
void DAG_scene_sort(Main *bmain, Scene *sce)
{
- DagNode *node;
+ DagNode *node, *rootnode;
DagNodeQueue *nqueue;
DagAdjList *itA;
int time;
@@ -1726,11 +1726,10 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
time = 1;
- node = sce->theDag->DagNode.first;
-
- node->color = DAG_GRAY;
+ rootnode = sce->theDag->DagNode.first;
+ rootnode->color = DAG_GRAY;
time++;
- push_stack(nqueue,node);
+ push_stack(nqueue,rootnode);
while(nqueue->count) {
@@ -2848,10 +2847,8 @@ void DAG_pose_sort(Object *ob)
for(node = dag->DagNode.first; node; node= node->next)
node->color = DAG_WHITE;
- node = dag->DagNode.first;
-
- node->color = DAG_GRAY;
- push_stack(nqueue, node);
+ rootnode->color = DAG_GRAY;
+ push_stack(nqueue, rootnode);
while(nqueue->count) {
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index b9947c506d1..318165af804 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1414,10 +1414,7 @@ void driver_free_variable (ChannelDriver *driver, DriverVar *dvar)
DRIVER_TARGETS_LOOPER_END
/* remove the variable from the driver */
- if (driver)
- BLI_freelinkN(&driver->variables, dvar);
- else
- MEM_freeN(dvar);
+ BLI_freelinkN(&driver->variables, dvar);
#ifdef WITH_PYTHON
/* since driver variables are cached, the expression needs re-compiling too */
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index a44957ddc01..d9fe0138784 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -692,7 +692,11 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n
case IDP_ARRAY:
{
/*for now, we only support float and int and double arrays*/
- if (val->array.type == IDP_FLOAT || val->array.type == IDP_INT || val->array.type == IDP_DOUBLE || val->array.type == IDP_GROUP) {
+ if ( (val->array.type == IDP_FLOAT) ||
+ (val->array.type == IDP_INT) ||
+ (val->array.type == IDP_DOUBLE) ||
+ (val->array.type == IDP_GROUP) )
+ {
prop = MEM_callocN(sizeof(IDProperty), "IDProperty array");
prop->subtype = val->array.type;
if (val->array.len)
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 622ec093a3f..9890a2629fc 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -909,8 +909,10 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
if (array_index)
*array_index= dummy_index;
}
-
+
+ /* 'buf' _must_ be initialized in this block */
/* append preceding bits to path */
+ /* note, strings are not escapted and they should be! */
if ((actname && actname[0]) && (constname && constname[0])) {
/* Constraint in Pose-Channel */
sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
@@ -918,6 +920,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
else if (actname && actname[0]) {
if ((blocktype == ID_OB) && strcmp(actname, "Object")==0) {
/* Actionified "Object" IPO's... no extra path stuff needed */
+ buf[0]= '\0'; /* empty string */
}
else if ((blocktype == ID_KE) && strcmp(actname, "Shape")==0) {
/* Actionified "Shape" IPO's - these are forced onto object level via the action container there... */
@@ -936,8 +939,10 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
/* Sequence names in Scene */
sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
}
- else
+ else {
buf[0]= '\0'; /* empty string */
+ }
+
BLI_dynstr_append(path, buf);
/* need to add dot before property if there was anything precceding this */
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 75d8ec584e8..7b2cfd46d33 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -372,7 +372,10 @@ static MovieClip *movieclip_alloc(const char *name)
BKE_tracking_init_settings(&clip->tracking);
clip->proxy.build_size_flag= IMB_PROXY_25;
- clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN|IMB_TC_FREE_RUN|IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
+ clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN |
+ IMB_TC_FREE_RUN |
+ IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN |
+ IMB_TC_RECORD_RUN_NO_GAPS;
clip->proxy.quality= 90;
return clip;
@@ -985,9 +988,9 @@ void unlink_movieclip(Main *bmain, MovieClip *clip)
}
for(ob= bmain->object.first; ob; ob= ob->id.next) {
- bConstraint *con= ob->constraints.first;
+ bConstraint *con;
- for (con= ob->constraints.first; con; con= con->next) {
+ for(con= ob->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 421764f7191..4b2195cda9f 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2652,6 +2652,9 @@ static int cgdm_adjacent_grid(CCGSubSurf *ss, int *gridOffset, CCGFace *f, int S
break;
}
}
+
+ if(numEdges == 0)
+ return -1;
fIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, adjf));
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 83adfa12236..04e8c3df077 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1288,8 +1288,8 @@ int BKE_tracking_next(MovieTrackingContext *context)
MEM_freeN(image_new);
}
- coords_correct= !isnan(x2) && !isnan(y2) && finite(x2) && finite(y2);
- if(coords_correct && !onbound && (tracked || !context->disable_failed)) {
+ coords_correct= !onbound && !isnan(x2) && !isnan(y2) && finite(x2) && finite(y2);
+ if(coords_correct && (tracked || !context->disable_failed)) {
if(context->first_time) {
#pragma omp critical
{
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index aa914998a72..81c526e45a6 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -299,7 +299,8 @@ static bUnitDef *unit_best_fit(double value, bUnitCollection *usys, bUnitDef *un
if(suppress && (unit->flag & B_UNIT_DEF_SUPPRESS))
continue;
- if (value_abs >= unit->scalar*(1.0-EPS)) /* scale down scalar so 1cm doesnt convert to 10mm because of float error */
+ /* scale down scalar so 1cm doesnt convert to 10mm because of float error */
+ if (value_abs >= unit->scalar*(1.0-EPS))
return unit;
}
@@ -481,11 +482,14 @@ static int ch_is_op(char op)
}
}
-static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit, const char *replace_str)
+static int unit_scale_str(char *str, int len_max, char *str_tmp,
+ double scale_pref, bUnitDef *unit, const char *replace_str)
{
char *str_found;
- if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) { /* XXX - investigate, does not respect len_max properly */
+ if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) {
+ /* XXX - investigate, does not respect len_max properly */
+
int len, len_num, len_name, len_move, found_ofs;
found_ofs = (int)(str_found-str);
diff --git a/source/blender/blenlib/BLI_md5.h b/source/blender/blenlib/BLI_md5.h
new file mode 100644
index 00000000000..afcc3cdfa3e
--- /dev/null
+++ b/source/blender/blenlib/BLI_md5.h
@@ -0,0 +1,45 @@
+/*
+ * ***** 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 *****
+ */
+
+#ifndef BLI_MD5_H
+#define BLI_MD5_H
+
+/** \file BLI_md5.h
+ * \ingroup bli
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
+ result is always in little endian byte order, so that a byte-wise
+ output yields to the wanted ASCII representation of the message
+ digest. */
+
+void *md5_buffer(const char *buffer, size_t len, void *resblock);
+
+/* Compute MD5 message digest for bytes read from STREAM. The
+ resulting message digest number will be written into the 16 bytes
+ beginning at RESBLOCK. */
+
+int md5_stream(FILE *stream, void *resblock);
+
+#endif
+
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index da7801e350a..a439f4eeeca 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -72,6 +72,7 @@ set(SRC
intern/math_rotation.c
intern/math_vector.c
intern/math_vector_inline.c
+ intern/md5.c
intern/noise.c
intern/path_util.c
intern/pbvh.c
@@ -123,6 +124,7 @@ set(SRC
BLI_math_matrix.h
BLI_math_rotation.h
BLI_math_vector.h
+ BLI_md5.h
BLI_memarena.h
BLI_mempool.h
BLI_noise.h
diff --git a/source/blender/imbuf/intern/md5.c b/source/blender/blenlib/intern/md5.c
index 2192fa32f19..25582a5f750 100644
--- a/source/blender/imbuf/intern/md5.c
+++ b/source/blender/blenlib/intern/md5.c
@@ -21,12 +21,82 @@
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>. */
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
#include <sys/types.h>
-# include <stdlib.h>
-# include <string.h>
+#if defined HAVE_LIMITS_H || defined _LIBC
+# include <limits.h>
+#endif
+
+/* The following contortions are an attempt to use the C preprocessor
+ to determine an unsigned integral type that is 32 bits wide. An
+ alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
+ doing that would require that the configure script compile and *run*
+ the resulting executable. Locally running cross-compiled executables
+ is usually not possible. */
+
+#if defined __STDC__ && __STDC__
+# define UINT_MAX_32_BITS 4294967295U
+#else
+# define UINT_MAX_32_BITS 0xFFFFFFFF
+#endif
+
+/* If UINT_MAX isn't defined, assume it's a 32-bit type.
+ This should be valid for all systems GNU cares about because
+ that doesn't include 16-bit systems, and only modern systems
+ (that certainly have <limits.h>) have 64+-bit integral types. */
+
+#ifndef UINT_MAX
+# define UINT_MAX UINT_MAX_32_BITS
+#endif
+
+#if UINT_MAX == UINT_MAX_32_BITS
+ typedef unsigned int md5_uint32;
+#else
+# if USHRT_MAX == UINT_MAX_32_BITS
+ typedef unsigned short md5_uint32;
+# else
+# if ULONG_MAX == UINT_MAX_32_BITS
+ typedef unsigned long md5_uint32;
+# else
+ /* The following line is intended to evoke an error.
+ Using #error is not portable enough. */
+ "Cannot determine unsigned 32-bit data type."
+# endif
+# endif
+#endif
+
+/* Structure to save state of computation between the single steps. */
+struct md5_ctx
+{
+ md5_uint32 A;
+ md5_uint32 B;
+ md5_uint32 C;
+ md5_uint32 D;
+};
+
+/*
+ * The following three functions are build up the low level used in
+ * the functions `md5_stream' and `md5_buffer'.
+ */
+
+/* Initialize structure containing state of computation.
+ (RFC 1321, 3.3: Step 3) */
+static void md5_init_ctx(struct md5_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+ initialzation function update the context for the next LEN bytes
+ starting at BUFFER.
+ It is necessary that LEN is a multiple of 64!!! */
+static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx);
+
+/* Put result from CTX in first 16 bytes following RESBUF. The result is
+ always in little endian byte order, so that a byte-wise output yields
+ to the wanted ASCII representation of the message digest. */
+static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf);
-#include "md5.h"
#ifdef __BIG_ENDIAN__
# define SWAP(n) \
@@ -43,9 +113,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
-void
-md5_init_ctx (ctx)
- struct md5_ctx *ctx;
+static void md5_init_ctx(struct md5_ctx *ctx)
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
@@ -55,10 +123,7 @@ md5_init_ctx (ctx)
/* Put result from CTX in first 16 bytes following RESBUF. The result must
be in little endian byte order. */
-void *
-md5_read_ctx (ctx, resbuf)
- const struct md5_ctx *ctx;
- void *resbuf;
+static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
{
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -71,10 +136,7 @@ md5_read_ctx (ctx, resbuf)
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
-int
-md5_stream (stream, resblock)
- FILE *stream;
- void *resblock;
+int md5_stream(FILE *stream, void *resblock)
{
/* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096
@@ -154,11 +216,7 @@ md5_stream (stream, resblock)
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
-void *
-md5_buffer (buffer, len, resblock)
- const char *buffer;
- size_t len;
- void *resblock;
+void *md5_buffer(const char *buffer, size_t len, void *resblock)
{
struct md5_ctx ctx;
char restbuf[64 + 72];
@@ -207,11 +265,7 @@ md5_buffer (buffer, len, resblock)
/* Process LEN bytes of BUFFER, accumulating context into CTX.
It is assumed that LEN % 64 == 0. */
-void
-md5_process_block (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct md5_ctx *ctx;
+void md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
{
md5_uint32 correct_words[16];
const md5_uint32 *words = buffer;
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index e79d850caa5..9adb39f09ef 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -317,7 +317,7 @@ void BLI_uniquename(ListBase *list, void *vlink, const char defname[], char deli
void BLI_cleanup_path(const char *relabase, char *dir)
{
- short a;
+ ptrdiff_t a;
char *start, *eind;
if (relabase) {
BLI_path_abs(dir, relabase);
@@ -1416,7 +1416,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
{
size_t path_len= strlen(path);
size_t ext_len= strlen(ext);
- size_t a;
+ ssize_t a;
for(a= path_len - 1; a >= 0; a--) {
if (ELEM3(path[a], '.', '/', '\\')) {
@@ -1424,7 +1424,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
}
}
- if (path[a] != '.') {
+ if ((a < 0) || (path[a] != '.')) {
a= path_len;
}
@@ -1440,7 +1440,7 @@ int BLI_ensure_extension(char *path, size_t maxlen, const char *ext)
{
size_t path_len= strlen(path);
size_t ext_len= strlen(ext);
- size_t a;
+ ssize_t a;
/* first check the extension is alread there */
if ( (ext_len <= path_len) &&
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index 9cf721738a7..35271f7b873 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -32,6 +32,7 @@ set(INC
../nodes
../render/extern/include
../../../intern/guardedalloc
+ ../imbuf
)
set(INC_SYS
diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript
index 57075ac3bcf..20b560744b3 100644
--- a/source/blender/blenloader/SConscript
+++ b/source/blender/blenloader/SConscript
@@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c')
incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
incs += ' ../makesdna ../editors/include'
-incs += ' ../render/extern/include ../makesrna ../nodes ../bmesh'
+incs += ' ../render/extern/include ../makesrna ../nodes ../bmesh ../imbuf'
incs += ' ' + env['BF_ZLIB_INC']
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1c554cdcf9a..9695b90593b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -141,6 +141,8 @@
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
#include "BKE_sound.h"
+#include "IMB_imbuf.h" // for proxy / timecode versioning stuff
+
#include "NOD_socket.h"
//XXX #include "BIF_butspace.h" // badlevel, for do_versions, patching event codes
@@ -10771,8 +10773,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
void *olddata = ob->data;
ob->data = me;
- if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) /* XXX - library meshes crash on loading most yoFrankie levels, the multires pointer gets invalid - Campbell */
+ /* XXX - library meshes crash on loading most yoFrankie levels,
+ * the multires pointer gets invalid - Campbell */
+ if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) {
multires_load_old(ob, me);
+ }
ob->data = olddata;
}
@@ -12670,10 +12675,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
clip->aspy= 1.0f;
}
- /* XXX: a bit hacky, probably include imbuf and use real constants are nicer */
- clip->proxy.build_tc_flag= 7;
+ clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN |
+ IMB_TC_FREE_RUN |
+ IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
+
if(clip->proxy.build_size_flag==0)
- clip->proxy.build_size_flag= 1;
+ clip->proxy.build_size_flag= IMB_PROXY_25;
if(clip->proxy.quality==0)
clip->proxy.quality= 90;
@@ -12813,6 +12820,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
scene->gm.exitkey = 218; // Blender key code for ESC
}
}
+ {
+ MovieClip *clip;
+ for(clip= main->movieclip.first; clip; clip= clip->id.next) {
+ clip->proxy.build_tc_flag|= IMB_TC_RECORD_RUN_NO_GAPS;
+ }
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
@@ -14343,7 +14356,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
expand_main(fd, mainptr);
- /* dang FileData... now new libraries need to be appended to original filedata, it is not a good replacement for the old global (ton) */
+ /* dang FileData... now new libraries need to be appended to original filedata,
+ * it is not a good replacement for the old global (ton) */
while( fd->mainlist.first ) {
Main *mp= fd->mainlist.first;
BLI_remlink(&fd->mainlist, mp);
@@ -14365,8 +14379,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
ID *idn= id->next;
if(id->flag & LIB_READ) {
BLI_remlink(lbarray[a], id);
- BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
- if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+ BKE_reportf(basefd->reports, RPT_ERROR,
+ "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n",
+ BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+ if (!G.background && basefd->reports) {
+ printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n",
+ BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+ }
change_idid_adr(mainlist, basefd, id, NULL);
MEM_freeN(id);
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 8c699c840dc..a21c394a81e 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -496,7 +496,7 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
break;
/* store this level as the 'old' level now */
- prevLevel= level; // XXX: prevLevel is unused
+ // prevLevel= level; // XXX: prevLevel is unused
}
}
}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index fe6aed77462..45b715c406a 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2205,12 +2205,12 @@ size_t ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_m
/* only filter data if there's somewhere to put it */
if (data && anim_data) {
- Object *obact= (ac) ? ac->obact : NULL;
/* firstly filter the data */
switch (datatype) {
case ANIMCONT_ACTION: /* 'Action Editor' */
{
+ Object *obact= ac->obact;
SpaceAction *saction = (SpaceAction *)ac->sl;
bDopeSheet *ads = (saction)? &saction->ads : NULL;
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 1bad61be324..4948073f9c6 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -904,7 +904,9 @@ void uiEndBlock(const bContext *C, uiBlock *block)
/* handle pending stuff */
if(block->layouts.first) uiBlockLayoutResolve(block, NULL, NULL);
ui_block_do_align(block);
- if((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
+ if((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
+ ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
+ }
if(block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
/* after keymaps! */
@@ -1901,7 +1903,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
if(softmin < (double)but->hardmin)
softmin= (double)but->hardmin;
}
- else if(value_max-1e-10 > softmax) {
+ if(value_max-1e-10 > softmax) {
if(value_max < 0.0)
softmax= -soft_range_round_down(-value_max, -softmax);
else
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 6ebfddff5c1..900cbbd5cbf 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -5247,7 +5247,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
highlight when not in a popup menu, we remove because data used in
button below popup might have been removed by action of popup. Needs
a more reliable solution... */
- if(state != BUTTON_STATE_HIGHLIGHT || but->block->handle)
+ if(state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
ui_check_but(but);
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index b6c1606ec6b..63f6309163e 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -681,7 +681,7 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
static int modifier_can_delete(ModifierData *md)
{
- // fluid particle modifier can't be deleted here
+ /* fluid particle modifier can't be deleted here */
if(md->type == eModifierType_ParticleSystem)
if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
return 0;
@@ -689,14 +689,16 @@ static int modifier_can_delete(ModifierData *md)
return 1;
}
-// Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab
+/* Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab */
static int modifier_is_simulation(ModifierData *md)
{
- // Physic Tab
- if(ELEM7(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint)) {
+ /* Physic Tab */
+ if (ELEM7(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke,
+ eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint))
+ {
return 1;
}
- // Particle Tab
+ /* Particle Tab */
else if (md->type == eModifierType_ParticleSystem) {
return 2;
}
@@ -705,7 +707,8 @@ static int modifier_is_simulation(ModifierData *md)
}
}
-static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, ModifierData *md, int index, int cageIndex, int lastCageIndex)
+static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
+ ModifierData *md, int index, int cageIndex, int lastCageIndex)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
PointerRNA ptr;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 0da4d3895e0..d8a34262e81 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1795,7 +1795,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
{
/* gouraud triangle fan */
float radstep, ang= 0.0f;
- float centx, centy, radius;
+ float centx, centy, radius, cursor_radius;
float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
int a, tot= 32;
int color_profile = but->block->color_profile;
@@ -1864,12 +1864,12 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
if(but->flag & UI_BUT_COLOR_CUBIC)
- radius= (1.0f - powf(1.0f - hsvo[1], 3.0f)) *radius;
+ cursor_radius = (1.0f - powf(1.0f - hsvo[1], 3.0f));
else
- radius= hsvo[1] * radius;
+ cursor_radius = hsvo[1];
+ radius= CLAMPIS(cursor_radius, 0.0f, 1.0f) * radius;
ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius);
-
}
/* ************ custom buttons, old stuff ************** */
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 0a41b473390..e4b27f58e05 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -2179,3 +2179,51 @@ void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+
+static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Object *ob=ED_object_active_context(C);
+
+ CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ if(ob != ob_iter) {
+ ob_iter->gameflag = ob->gameflag;
+ ob_iter->gameflag2 = ob->gameflag2;
+ ob_iter->inertia = ob->inertia;
+ ob_iter->formfactor = ob->formfactor;;
+ ob_iter->damping = ob->damping;
+ ob_iter->rdamping = ob->rdamping;
+ ob_iter->min_vel = ob->min_vel;
+ ob_iter->max_vel = ob->max_vel;
+ ob_iter->obstacleRad = ob->obstacleRad;
+ ob_iter->mass = ob->mass;
+ ob_iter->anisotropicFriction[0] = ob->anisotropicFriction[0];
+ ob_iter->anisotropicFriction[1] = ob->anisotropicFriction[1];
+ ob_iter->anisotropicFriction[2] = ob->anisotropicFriction[2];
+ ob_iter->collision_boundtype = ob->collision_boundtype;
+ ob_iter->margin = ob->margin;
+ ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft);
+ if(ob->restrictflag & OB_RESTRICT_RENDER)
+ ob_iter->restrictflag |= OB_RESTRICT_RENDER;
+ else
+ ob_iter->restrictflag &= ~OB_RESTRICT_RENDER;
+ }
+ }
+ CTX_DATA_END;
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy Game Physics Properties to Selected";
+ ot->description = "Copy game physics properties to other selected objects";
+ ot->idname= "OBJECT_OT_game_physics_copy";
+
+ /* api callbacks */
+ ot->exec= game_physics_copy_exec;
+ ot->poll= ED_operator_object_active_editable;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 035d2dfcff8..29c6350452c 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -92,6 +92,7 @@ void OBJECT_OT_game_property_remove(struct wmOperatorType *ot);
void OBJECT_OT_game_property_copy(struct wmOperatorType *ot);
void OBJECT_OT_game_property_clear(struct wmOperatorType *ot);
void OBJECT_OT_logic_bricks_copy(struct wmOperatorType *ot);
+void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot);
/* object_select.c */
void OBJECT_OT_select_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index a140888a602..c5de274c464 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -655,7 +655,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op)
static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
Object *ob= ED_object_active_context(C);
- EnumPropertyItem *item= NULL, *md_item;
+ EnumPropertyItem *item= NULL, *md_item, *group_item= NULL;
ModifierTypeInfo *mti;
int totitem= 0, a;
@@ -675,6 +675,17 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr)
(ob->type==OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh))))
continue;
}
+ else {
+ group_item= md_item;
+ md_item= NULL;
+
+ continue;
+ }
+
+ if(group_item) {
+ RNA_enum_item_add(&item, &totitem, group_item);
+ group_item= NULL;
+ }
RNA_enum_item_add(&item, &totitem, md_item);
}
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 8fd852278d3..f6b4656af7e 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -189,6 +189,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_game_property_copy);
WM_operatortype_append(OBJECT_OT_game_property_clear);
WM_operatortype_append(OBJECT_OT_logic_bricks_copy);
+ WM_operatortype_append(OBJECT_OT_game_physics_copy);
WM_operatortype_append(OBJECT_OT_shape_key_add);
WM_operatortype_append(OBJECT_OT_shape_key_remove);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index d1791ba6ee9..59181aba6e4 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1816,7 +1816,9 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
return 1;
*/
- if((bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) || (bucket_bounds->ymin <= cent[1] && bucket_bounds->ymax >= cent[1]) ) {
+ if ( (bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) ||
+ (bucket_bounds->ymin <= cent[1] && bucket_bounds->ymax >= cent[1]) )
+ {
return 1;
}
@@ -2816,7 +2818,11 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
p4[0] = bucket_bounds.xmax; p4[1] = bucket_bounds.ymin;
if (mf->v4) {
- if( isect_point_quad_v2(p1, v1, v2, v3, v4) || isect_point_quad_v2(p2, v1, v2, v3, v4) || isect_point_quad_v2(p3, v1, v2, v3, v4) || isect_point_quad_v2(p4, v1, v2, v3, v4) ||
+ if ( isect_point_quad_v2(p1, v1, v2, v3, v4) ||
+ isect_point_quad_v2(p2, v1, v2, v3, v4) ||
+ isect_point_quad_v2(p3, v1, v2, v3, v4) ||
+ isect_point_quad_v2(p4, v1, v2, v3, v4) ||
+
/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
(isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3) || isect_line_line_v2(p1, p2, v3, v4)) ||
(isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3) || isect_line_line_v2(p2, p3, v3, v4)) ||
@@ -2827,7 +2833,10 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
}
}
else {
- if( isect_point_tri_v2(p1, v1, v2, v3) || isect_point_tri_v2(p2, v1, v2, v3) || isect_point_tri_v2(p3, v1, v2, v3) || isect_point_tri_v2(p4, v1, v2, v3) ||
+ if ( isect_point_tri_v2(p1, v1, v2, v3) ||
+ isect_point_tri_v2(p2, v1, v2, v3) ||
+ isect_point_tri_v2(p3, v1, v2, v3) ||
+ isect_point_tri_v2(p4, v1, v2, v3) ||
/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
(isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3)) ||
(isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3)) ||
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 9fdf59b0349..cdfb1f971ac 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -592,7 +592,12 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
float pen_flip = cache->pen_flip ? -1 : 1;
float invert = cache->invert ? -1 : 1;
float accum = integrate_overlap(brush);
- float overlap = (brush->flag & BRUSH_SPACE_ATTEN && brush->flag & BRUSH_SPACE && !(brush->flag & BRUSH_ANCHORED)) && (brush->spacing < 100) ? 1.0f/accum : 1; // spacing is integer percentage of radius, divide by 50 to get normalized diameter
+ /* spacing is integer percentage of radius, divide by 50 to get
+ normalized diameter */
+ float overlap = (brush->flag & BRUSH_SPACE_ATTEN &&
+ brush->flag & BRUSH_SPACE &&
+ !(brush->flag & BRUSH_ANCHORED) &&
+ (brush->spacing < 100)) ? 1.0f/accum : 1;
float flip = dir * invert * pen_flip;
switch(brush->sculpt_tool){
@@ -1716,7 +1721,9 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
/* this calculates flatten center and area normal together,
amortizing the memory bandwidth and loop overhead to calculate both at the same time */
-static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float an[3], float fc[3])
+static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
+ PBVHNode **nodes, int totnode,
+ float an[3], float fc[3])
{
SculptSession *ss = ob->sculpt;
int n;
@@ -2588,7 +2595,9 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
/* Flip all the editdata across the axis/axes specified by symm. Used to
calculate multiple modifications to the mesh when symmetry is enabled. */
-static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float UNUSED(feather))
+static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
+ const char axis, const float angle,
+ const float UNUSED(feather))
{
(void)sd; /* unused */
@@ -2620,7 +2629,9 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
mul_m4_v3(cache->symm_rot_mat, cache->grab_delta_symmetry);
}
-static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush, const char symm, const int axis, const float feather)
+static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush,
+ const char symm, const int axis,
+ const float feather)
{
SculptSession *ss = ob->sculpt;
int i;
@@ -2954,7 +2965,10 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
cache->original = 1;
}
- if(ELEM8(brush->sculpt_tool, SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB, SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_ROTATE))
+ if(ELEM8(brush->sculpt_tool,
+ SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB,
+ SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
+ SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_ROTATE))
if(!(brush->flag & BRUSH_ACCUMULATE))
cache->original = 1;
@@ -3038,7 +3052,9 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
}
/* Initialize the stroke cache variants from operator properties */
-static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, struct PaintStroke *stroke, PointerRNA *ptr)
+static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
+ struct PaintStroke *stroke,
+ PointerRNA *ptr)
{
SculptSession *ss = ob->sculpt;
StrokeCache *cache = ss->cache;
@@ -3095,7 +3111,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st
cache->radius_squared = cache->radius*cache->radius;
- if(!(brush->flag & BRUSH_ANCHORED || ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
+ if(!(brush->flag & BRUSH_ANCHORED ||
+ ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK,
+ SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
copy_v2_v2(cache->tex_mouse, cache->mouse);
if ( (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) &&
@@ -3137,7 +3155,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st
if (!hit)
copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
- cache->radius= paint_calc_object_space_radius(paint_stroke_view_context(stroke), cache->true_location, cache->pixel_radius);
+ cache->radius= paint_calc_object_space_radius(paint_stroke_view_context(stroke),
+ cache->true_location,
+ cache->pixel_radius);
cache->radius_squared = cache->radius*cache->radius;
copy_v3_v3(sd->anchored_location, cache->true_location);
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 30a7abd3c0b..9b1bd1d7b31 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -221,12 +221,17 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
{
/* can't rename rna datablocks entries */
- if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
- ;
- else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
+ if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+ /* do nothing */;
+ }
+ else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
+ TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
+ {
BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
- else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP))
+ }
+ else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
+ }
else if(tselem->id->lib) {
// XXX error_libdata();
}
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index e728267f45f..bf570c929cc 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -823,8 +823,12 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
- if(!ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) && !(soops->flag & SO_HIDE_RESTRICTCOLS) && fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX)
+ if ( !ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) &&
+ !(soops->flag & SO_HIDE_RESTRICTCOLS) &&
+ (fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX))
+ {
return OPERATOR_CANCELLED;
+ }
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 851d6c1174a..ea3fe09ff69 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2685,8 +2685,7 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
}
}
-static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
- Object *ob, BMEditMesh *em, UnitSettings *unit)
+static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitSettings *unit)
{
Mesh *me= ob->data;
float v1[3], v2[3], v3[3], vmid[3], fvec[3];
@@ -2709,11 +2708,6 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
else if (grid < 1.0f) conv_float= "%.4g";
else if (grid < 10.0f) conv_float= "%.3g";
else conv_float= "%.2g";
-
- if(v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT)==0)
- glDisable(GL_DEPTH_TEST);
-
- if(v3d->zbuf) bglPolygonOffset(rv3d->dist, 5.0f);
if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
BMEdge *eed;
@@ -2836,43 +2830,52 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
}
}
}
+}
- /* useful for debugging index vs shape key index */
-#if 0
- {
- BMIter iter;
- BMVert *eve;
- int j=0;
+static void draw_em_indices(BMEditMesh *em)
+{
+ BMEdge *e;
+ BMFace *f;
+ BMVert *v;
+ int i;
+ char val[32];
+ float pos[3];
+ unsigned char col[4];
- UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
+ BMIter iter;
+ BMesh *bm= em->bm;
- if(CustomData_has_layer(&em->bm->vdata, CD_SHAPE_KEYINDEX)) {
- int *keyi;
- BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- keyi = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
- if(keyi && *keyi != ORIGINDEX_NONE) {
- sprintf(val, "%d:%d", j, *keyi);
- }
- else {
- sprintf(val, "%d", j);
- }
- view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
- i++;
- }
+ /* For now, reuse appropriate theme colors from stats text colors */
+ i= 0;
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
+ BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
+ if (BM_TestHFlag(v, BM_SELECT)) {
+ sprintf(val, "%d", i);
+ view3d_cached_text_draw_add(v->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
- else {
- BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- sprintf(val, "%d", j);
- view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
- j++;
- }
+ i++;
+ }
+
+ i= 0;
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
+ BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
+ if (BM_TestHFlag(e, BM_SELECT)) {
+ sprintf(val, "%d", i);
+ mid_v3_v3v3(pos, e->v1->co, e->v2->co);
+ view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
+ i++;
}
-#endif
- if(v3d->zbuf) {
- glEnable(GL_DEPTH_TEST);
- bglPolygonOffset(rv3d->dist, 0.0f);
+ i= 0;
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
+ BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
+ if (BM_TestHFlag(f, BM_SELECT)) {
+ BM_Compute_Face_CenterMean(bm, f, pos);
+ sprintf(val, "%d", i);
+ view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
+ }
+ i++;
}
}
@@ -3050,7 +3053,12 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if ( (me->drawflag & (ME_DRAWEXTRA_EDGELEN|ME_DRAWEXTRA_FACEAREA|ME_DRAWEXTRA_FACEANG)) &&
!(v3d->flag2 & V3D_RENDER_OVERRIDE))
{
- draw_em_measure_stats(v3d, rv3d, ob, em, &scene->unit);
+ draw_em_measure_stats(v3d, ob, em, &scene->unit);
+ }
+
+ if ((G.f & G_DEBUG) && (me->drawflag & ME_DRAWEXTRA_INDICES) &&
+ !(v3d->flag2 & V3D_RENDER_OVERRIDE)) {
+ draw_em_indices(em);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 739e7f186fe..597adcf4193 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -277,7 +277,7 @@ static int modeselect_addmode(char *str, const char *title, int id, int icon)
static char *view3d_modeselect_pup(Scene *scene)
{
Object *ob= OBACT;
- static char string[256];
+ static char string[512];
const char *title= IFACE_("Mode: %t");
char *str = string;
@@ -317,7 +317,10 @@ static char *view3d_modeselect_pup(Scene *scene)
str += modeselect_addmode(str, N_("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
}
- if (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)) {
+ if ( ob->particlesystem.first ||
+ modifiers_findByType(ob, eModifierType_Cloth) ||
+ modifiers_findByType(ob, eModifierType_Softbody))
+ {
str += modeselect_addmode(str, N_("Particle Mode"), OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
}
(void)str;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index c9aa727d365..56f4874fe30 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1725,7 +1725,11 @@ static int game_engine_exec(bContext *C, wmOperator *op)
game_set_commmandline_options(&startscene->gm);
- if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */
+ if((rv3d->persp == RV3D_CAMOB) &&
+ (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) &&
+ (startscene->gm.stereoflag != STEREO_DOME))
+ {
+ /* Letterbox */
rctf cam_framef;
ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, FALSE);
cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 4a7793b9e4a..e916ae3486d 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1556,8 +1556,10 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
* but for now just dont change handle types */
- if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0)
- testhandlesNurb(nu); /* sets the handles based on their selection, do this after the data is copied to the TransData */
+ if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) {
+ /* sets the handles based on their selection, do this after the data is copied to the TransData */
+ testhandlesNurb(nu);
+ }
}
else {
TransData *head, *tail;
@@ -3504,7 +3506,10 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
* then check if we're using auto-handles.
* - If so, change them auto-handles to aligned handles so that handles get affected too
*/
- if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
+ if ( ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) &&
+ ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) &&
+ ELEM(t->mode, TFM_ROTATION, TFM_RESIZE))
+ {
if (hdata && (sel1) && (sel3)) {
bezt->h1= HD_ALIGN;
bezt->h2= HD_ALIGN;
@@ -4200,7 +4205,10 @@ static void createTransSeqData(bContext *C, TransInfo *t)
int i;
for(i=0; i<3; i++) {
seq_user= *((&seq->seq1) + i);
- if (seq_user && (seq_user->flag & SELECT) && !(seq_user->flag & SEQ_LOCK) && !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL))) {
+ if ( seq_user && (seq_user->flag & SELECT) &&
+ !(seq_user->flag & SEQ_LOCK) &&
+ !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)))
+ {
seq->flag |= SELECT;
}
}
@@ -4499,7 +4507,8 @@ static int count_proportional_objects(TransInfo *t)
/* mark all children */
for (base= scene->base.first; base; base= base->next) {
/* all base not already selected or marked that is editable */
- if ((base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
+ if ( (base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
+ (BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
mark_children(base->object);
}
@@ -4510,7 +4519,8 @@ static int count_proportional_objects(TransInfo *t)
Object *ob= base->object;
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
- if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
+ if ( (ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
+ (BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
/* used for flush, depgraph will change recalcs if needed :) */
@@ -4586,7 +4596,9 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
if (adt && adt->action) {
for (fcu= adt->action->curves.first; fcu; fcu= fcu->next) {
fcu->flag &= ~FCURVE_SELECTED;
- insert_keyframe(reports, id, adt->action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
+ insert_keyframe(reports, id, adt->action,
+ (fcu->grp ? fcu->grp->name : NULL),
+ fcu->rna_path, fcu->array_index, cfra, flag);
}
}
}
@@ -5104,8 +5116,12 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
- else if(t->scene->basact && (ob = t->scene->basact->object) && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, ob)) {
- ;
+ else if ( (t->scene->basact) &&
+ (ob = t->scene->basact->object) &&
+ (ob->mode & OB_MODE_PARTICLE_EDIT) &&
+ PE_get_current(t->scene, ob))
+ {
+ /* do nothing */ ;
}
else { /* Objects */
int i, recalcObPaths=0;
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index e108262758a..9ce4779616e 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1637,7 +1637,12 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
}
for ( base = FIRSTBASE; base != NULL; base = base->next ) {
- 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)) ) {
+ 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)
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 33796b7c215..d623697921c 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -241,7 +241,12 @@ GPUFunction *GPU_lookup_function(const char *name)
return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name);
}
-void GPU_extensions_exit(void)
+void GPU_codegen_init(void)
+{
+ GPU_code_generate_glsl_lib();
+}
+
+void GPU_codegen_exit(void)
{
extern Material defmaterial; // render module abuse...
@@ -253,8 +258,11 @@ void GPU_extensions_exit(void)
FUNCTION_HASH = NULL;
}
- if(glsl_material_library)
+ if(glsl_material_library) {
MEM_freeN(glsl_material_library);
+ glsl_material_library = NULL;
+ }
+
/*if(FUNCTION_PROTOTYPES) {
MEM_freeN(FUNCTION_PROTOTYPES);
FUNCTION_PROTOTYPES = NULL;
@@ -538,12 +546,8 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
BLI_dynstr_appendf(ds, ", gl_TexCoord[%d].st", input->texid);
}
else if (input->source == GPU_SOURCE_TEX_PIXEL) {
- if (input->link && input->link->output)
- codegen_convert_datatype(ds, input->link->output->type, input->type,
- "tmp", input->link->output->id);
- else
- codegen_convert_datatype(ds, input->link->output->type, input->type,
- "tex", input->texid);
+ codegen_convert_datatype(ds, input->link->output->type, input->type,
+ "tmp", input->link->output->id);
}
else if(input->source == GPU_SOURCE_BUILTIN)
BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin));
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index f52b5bb627e..85bf65232c1 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -178,6 +178,9 @@ void GPU_pass_unbind(GPUPass *pass);
void GPU_pass_free(GPUPass *pass);
+void GPU_codegen_init(void);
+void GPU_codegen_exit(void);
+
/* Material calls */
const char *GPU_builtin_name(GPUBuiltin builtin);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 2dcce996065..5d36ba169f3 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1069,7 +1069,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
/* setting do_alpha_after = 1 indicates this object needs to be
* drawn in a second alpha pass for improved blending */
- if(GMS.use_alpha_pass && !GMS.is_alpha_pass)
+ if(do_alpha_after && !GMS.is_alpha_pass)
if(ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT))
*do_alpha_after= 1;
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index eaa661a9dcf..c4ed88635b7 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -45,6 +45,7 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "gpu_codegen.h"
#include <stdlib.h>
#include <stdio.h>
@@ -85,6 +86,8 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
/* GPU Extensions */
+static int gpu_extensions_init = 0;
+
void GPU_extensions_disable(void)
{
GG.extdisabled = 1;
@@ -96,11 +99,11 @@ void GPU_extensions_init(void)
const char *vendor, *renderer;
/* can't avoid calling this multiple times, see wm_window_add_ghostwindow */
- static char init= 0;
- if(init) return;
- init= 1;
+ if(gpu_extensions_init) return;
+ gpu_extensions_init= 1;
glewInit();
+ GPU_codegen_init();
/* glewIsSupported("GL_VERSION_2_0") */
@@ -112,8 +115,6 @@ void GPU_extensions_init(void)
if (!GLEW_ARB_vertex_shader) GG.glslsupport = 0;
if (!GLEW_ARB_fragment_shader) GG.glslsupport = 0;
- GPU_code_generate_glsl_lib();
-
glGetIntegerv(GL_RED_BITS, &r);
glGetIntegerv(GL_GREEN_BITS, &g);
glGetIntegerv(GL_BLUE_BITS, &b);
@@ -188,6 +189,12 @@ void GPU_extensions_init(void)
#endif
}
+void GPU_extensions_exit(void)
+{
+ gpu_extensions_init = 0;
+ GPU_codegen_exit();
+}
+
int GPU_glsl_support(void)
{
return !GG.extdisabled && GG.glslsupport;
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 250ea51f8c8..fb1d10b5491 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -972,7 +972,6 @@ static void do_material_tex(GPUShadeInput *shi)
GPU_link(mat, "mtex_mapping_ofs", texco, GPU_uniform(ofs), &texco);
talpha = 0;
- rgbnor = 0;
if(tex && tex->type == TEX_IMAGE && tex->ima) {
GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser), &tin, &trgb);
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index a03d6ce280d..4c8a79e6372 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -53,7 +53,6 @@ set(SRC
intern/indexer_dv.c
intern/iris.c
intern/jpeg.c
- intern/md5.c
intern/metadata.c
intern/module.c
intern/moviecache.c
@@ -96,7 +95,6 @@ set(SRC
intern/dds/Stream.h
intern/dds/dds_api.h
intern/imbuf.h
- intern/md5.h
intern/openexr/openexr_api.h
intern/openexr/openexr_multi.h
diff --git a/source/blender/imbuf/intern/md5.h b/source/blender/imbuf/intern/md5.h
deleted file mode 100644
index 79c480d8152..00000000000
--- a/source/blender/imbuf/intern/md5.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/** \file blender/imbuf/intern/md5.h
- * \ingroup imbuf
- */
-/* md5.h - Declaration of functions and data types used for MD5 sum
- computing library functions.
- Copyright (C) 1995 Free Software Foundation, Inc.
-
-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, 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. */
-
-#ifndef _MD5_H
-#define _MD5_H
-
-#include <stdio.h>
-
-#if defined HAVE_LIMITS_H || defined _LIBC
-# include <limits.h>
-#endif
-
-/* The following contortions are an attempt to use the C preprocessor
- to determine an unsigned integral type that is 32 bits wide. An
- alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
- doing that would require that the configure script compile and *run*
- the resulting executable. Locally running cross-compiled executables
- is usually not possible. */
-
-#if defined __STDC__ && __STDC__
-# define UINT_MAX_32_BITS 4294967295U
-#else
-# define UINT_MAX_32_BITS 0xFFFFFFFF
-#endif
-
-/* If UINT_MAX isn't defined, assume it's a 32-bit type.
- This should be valid for all systems GNU cares about because
- that doesn't include 16-bit systems, and only modern systems
- (that certainly have <limits.h>) have 64+-bit integral types. */
-
-#ifndef UINT_MAX
-# define UINT_MAX UINT_MAX_32_BITS
-#endif
-
-#if UINT_MAX == UINT_MAX_32_BITS
- typedef unsigned int md5_uint32;
-#else
-# if USHRT_MAX == UINT_MAX_32_BITS
- typedef unsigned short md5_uint32;
-# else
-# if ULONG_MAX == UINT_MAX_32_BITS
- typedef unsigned long md5_uint32;
-# else
- /* The following line is intended to evoke an error.
- Using #error is not portable enough. */
- "Cannot determine unsigned 32-bit data type."
-# endif
-# endif
-#endif
-
-#undef __P
-#if defined (__STDC__) && __STDC__
-#define __P(x) x
-#else
-#define __P(x) ()
-#endif
-
-/* Structure to save state of computation between the single steps. */
-struct md5_ctx
-{
- md5_uint32 A;
- md5_uint32 B;
- md5_uint32 C;
- md5_uint32 D;
-};
-
-/*
- * The following three functions are build up the low level used in
- * the functions `md5_stream' and `md5_buffer'.
- */
-
-/* Initialize structure containing state of computation.
- (RFC 1321, 3.3: Step 3) */
-void md5_init_ctx __P ((struct md5_ctx *ctx));
-
-/* Starting with the result of former calls of this function (or the
- initialzation function update the context for the next LEN bytes
- starting at BUFFER.
- It is necessary that LEN is a multiple of 64!!! */
-void md5_process_block __P ((const void *buffer, size_t len,
- struct md5_ctx *ctx));
-
-/* Put result from CTX in first 16 bytes following RESBUF. The result is
- always in little endian byte order, so that a byte-wise output yields
- to the wanted ASCII representation of the message digest. */
-void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
-
-
-/* Compute MD5 message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 16 bytes
- beginning at RESBLOCK. */
-int md5_stream __P ((FILE *stream, void *resblock));
-
-/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
- result is always in little endian byte order, so that a byte-wise
- output yields to the wanted ASCII representation of the message
- digest. */
-void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
-
-#endif
-
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 19eb917469d..808bcbed751 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -32,17 +32,18 @@
#include <stdio.h>
-#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
#include "MEM_guardedalloc.h"
+#include "BLI_blenlib.h"
+#include "BLI_md5.h"
+
+#include "BKE_utildefines.h"
+
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_thumbs.h"
#include "IMB_metadata.h"
-#include "md5.h"
-
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 4f8b2343a9f..83292d3d8f8 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -38,6 +38,23 @@ struct SDNA;
extern unsigned char DNAstr[]; /* DNA.c */
extern int DNAlen;
+typedef enum eSDNA_Type {
+ SDNA_TYPE_CHAR = 0,
+ SDNA_TYPE_UCHAR = 1,
+ SDNA_TYPE_SHORT = 2,
+ SDNA_TYPE_USHORT = 3,
+ SDNA_TYPE_INT = 4,
+ SDNA_TYPE_LONG = 5,
+ SDNA_TYPE_ULONG = 6,
+ SDNA_TYPE_FLOAT = 7,
+ SDNA_TYPE_DOUBLE = 8,
+ SDNA_TYPE_INT64 = 9
+ /* ,SDNA_TYPE_VOID = 10 */ /* nothing uses yet */
+} eSDNA_Type;
+
+/* define so switch statements don't complain */
+#define SDNA_TYPE_VOID 10
+
struct SDNA *DNA_sdna_from_data(void *data, int datalen, int do_endian_swap);
void DNA_sdna_free(struct SDNA *sdna);
@@ -49,6 +66,7 @@ void *DNA_struct_reconstruct(struct SDNA *newsdna, struct SDNA *oldsdna, char *c
int DNA_elem_array_size(const char *astr, int len);
int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name);
-#endif
+int DNA_elem_type_size(const eSDNA_Type elem_nr);
+#endif
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index eea76f9d386..20517000068 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -179,6 +179,9 @@ typedef struct TFace {
#define ME_DRAWEXTRA_FACEAREA (1 << 11)
#define ME_DRAWEXTRA_FACEANG (1 << 12)
+/* debug only option */
+#define ME_DRAWEXTRA_INDICES (1 << 13)
+
/* old global flags:
#define G_DRAWEDGES (1 << 18)
#define G_DRAWFACES (1 << 7)
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 4704ac189dc..432205b1b5d 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -492,7 +492,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
for(nr=0; nr<sdna->nr_structs; nr++) {
sp= sdna->structs[nr];
if(strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0)
- sp[10]= 9;
+ sp[10]= SDNA_TYPE_VOID;
}
}
@@ -656,92 +656,87 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
return compflags;
}
-static void cast_elem(char *ctype, char *otype, const char *name, char *curdata, char *olddata)
+static eSDNA_Type sdna_type_nr(const char *dna_type)
+{
+ if ((strcmp(dna_type, "char")==0) || (strcmp(dna_type, "const char")==0)) return SDNA_TYPE_CHAR;
+ else if((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0)) return SDNA_TYPE_UCHAR;
+ else if( strcmp(dna_type, "short")==0) return SDNA_TYPE_SHORT;
+ else if((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0)) return SDNA_TYPE_USHORT;
+ else if( strcmp(dna_type, "int")==0) return SDNA_TYPE_INT;
+ else if( strcmp(dna_type, "long")==0) return SDNA_TYPE_LONG;
+ else if((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0)) return SDNA_TYPE_ULONG;
+ else if( strcmp(dna_type, "float")==0) return SDNA_TYPE_FLOAT;
+ else if( strcmp(dna_type, "double")==0) return SDNA_TYPE_DOUBLE;
+ else if( strcmp(dna_type, "int64_t")==0) return SDNA_TYPE_INT64;
+ else return -1; /* invalid! */
+}
+
+static void cast_elem(const char *ctype, const char *otype, const char *name, char *curdata, char *olddata)
{
double val = 0.0;
- int arrlen, curlen=1, oldlen=1, ctypenr, otypenr;
-
+ int arrlen, curlen=1, oldlen=1;
+
+ eSDNA_Type ctypenr, otypenr;
+
arrlen= DNA_elem_array_size(name, strlen(name));
-
- /* define otypenr */
- if(strcmp(otype, "char")==0 || (strcmp(otype, "const char")==0)) otypenr= 0;
- else if((strcmp(otype, "uchar")==0) || (strcmp(otype, "unsigned char")==0)) otypenr= 1;
- else if(strcmp(otype, "short")==0) otypenr= 2;
- else if((strcmp(otype, "ushort")==0)||(strcmp(otype, "unsigned short")==0)) otypenr= 3;
- else if(strcmp(otype, "int")==0) otypenr= 4;
- else if(strcmp(otype, "long")==0) otypenr= 5;
- else if((strcmp(otype, "ulong")==0)||(strcmp(otype, "unsigned long")==0)) otypenr= 6;
- else if(strcmp(otype, "float")==0) otypenr= 7;
- else if(strcmp(otype, "double")==0) otypenr= 8;
- else return;
-
- /* define ctypenr */
- if(strcmp(ctype, "char")==0) ctypenr= 0;
- else if(strcmp(ctype, "const char")==0) ctypenr= 0;
- else if((strcmp(ctype, "uchar")==0)||(strcmp(ctype, "unsigned char")==0)) ctypenr= 1;
- else if(strcmp(ctype, "short")==0) ctypenr= 2;
- else if((strcmp(ctype, "ushort")==0)||(strcmp(ctype, "unsigned short")==0)) ctypenr= 3;
- else if(strcmp(ctype, "int")==0) ctypenr= 4;
- else if(strcmp(ctype, "long")==0) ctypenr= 5;
- else if((strcmp(ctype, "ulong")==0)||(strcmp(ctype, "unsigned long")==0)) ctypenr= 6;
- else if(strcmp(ctype, "float")==0) ctypenr= 7;
- else if(strcmp(ctype, "double")==0) ctypenr= 8;
- else return;
+
+ if ( (otypenr= sdna_type_nr(otype)) == -1 ||
+ (ctypenr= sdna_type_nr(ctype)) == -1 )
+ {
+ return;
+ }
/* define lengths */
- if(otypenr < 2) oldlen= 1;
- else if(otypenr < 4) oldlen= 2;
- else if(otypenr < 8) oldlen= 4;
- else oldlen= 8;
-
- if(ctypenr < 2) curlen= 1;
- else if(ctypenr < 4) curlen= 2;
- else if(ctypenr < 8) curlen= 4;
- else curlen= 8;
-
+ oldlen= DNA_elem_type_size(otypenr);
+ curlen= DNA_elem_type_size(ctypenr);
+
while(arrlen>0) {
switch(otypenr) {
- case 0:
+ case SDNA_TYPE_CHAR:
val= *olddata; break;
- case 1:
+ case SDNA_TYPE_UCHAR:
val= *( (unsigned char *)olddata); break;
- case 2:
+ case SDNA_TYPE_SHORT:
val= *( (short *)olddata); break;
- case 3:
+ case SDNA_TYPE_USHORT:
val= *( (unsigned short *)olddata); break;
- case 4:
+ case SDNA_TYPE_INT:
val= *( (int *)olddata); break;
- case 5:
+ case SDNA_TYPE_LONG:
val= *( (int *)olddata); break;
- case 6:
+ case SDNA_TYPE_ULONG:
val= *( (unsigned int *)olddata); break;
- case 7:
+ case SDNA_TYPE_FLOAT:
val= *( (float *)olddata); break;
- case 8:
+ case SDNA_TYPE_DOUBLE:
val= *( (double *)olddata); break;
+ case SDNA_TYPE_INT64:
+ val= *( (int64_t *)olddata); break;
}
switch(ctypenr) {
- case 0:
+ case SDNA_TYPE_CHAR:
*curdata= val; break;
- case 1:
+ case SDNA_TYPE_UCHAR:
*( (unsigned char *)curdata)= val; break;
- case 2:
+ case SDNA_TYPE_SHORT:
*( (short *)curdata)= val; break;
- case 3:
+ case SDNA_TYPE_USHORT:
*( (unsigned short *)curdata)= val; break;
- case 4:
+ case SDNA_TYPE_INT:
*( (int *)curdata)= val; break;
- case 5:
+ case SDNA_TYPE_LONG:
*( (int *)curdata)= val; break;
- case 6:
+ case SDNA_TYPE_ULONG:
*( (unsigned int *)curdata)= val; break;
- case 7:
+ case SDNA_TYPE_FLOAT:
if(otypenr<2) val/= 255;
*( (float *)curdata)= val; break;
- case 8:
+ case SDNA_TYPE_DOUBLE:
if(otypenr<2) val/= 255;
*( (double *)curdata)= val; break;
+ case SDNA_TYPE_INT64:
+ *( (int64_t *)curdata)= val; break;
}
olddata+= oldlen;
@@ -839,7 +834,8 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol
return NULL;
}
-static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const char *name, char *curdata, short *old, char *olddata)
+static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
+ char *type, const char *name, char *curdata, short *old, char *olddata)
{
/* rules: test for NAME:
- name equal:
@@ -913,7 +909,8 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const cha
}
}
-static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int oldSDNAnr, char *data, int curSDNAnr, char *cur)
+static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
+ char *compflags, int oldSDNAnr, char *data, int curSDNAnr, char *cur)
{
/* Recursive!
* Per element from cur_struct, read data from old_struct.
@@ -1055,7 +1052,9 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
}
else {
- if( spc[0]==2 || spc[0]==3 ) { /* short-ushort */
+ if ( spc[0]==SDNA_TYPE_SHORT ||
+ spc[0]==SDNA_TYPE_USHORT )
+ {
/* exception: variable called blocktype/ipowin: derived from ID_ */
skip= 0;
@@ -1077,7 +1076,11 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
}
}
}
- else if(spc[0]>3 && spc[0]<8) { /* int-long-ulong-float */
+ else if ( (spc[0]==SDNA_TYPE_INT ||
+ spc[0]==SDNA_TYPE_LONG ||
+ spc[0]==SDNA_TYPE_ULONG ||
+ spc[0]==SDNA_TYPE_FLOAT))
+ {
mul= DNA_elem_array_size(name, strlen(name));
cpo= cur;
@@ -1091,6 +1094,18 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
cpo+= 4;
}
}
+ else if ( (spc[0]==SDNA_TYPE_INT64)) {
+ mul= DNA_elem_array_size(name, strlen(name));
+ cpo= cur;
+ while(mul--) {
+ cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval;
+ cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval;
+ cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval;
+ cval= cpo[3]; cpo[3]= cpo[4]; cpo[4]= cval;
+
+ cpo+= 8;
+ }
+ }
}
}
cur+= elen;
@@ -1139,3 +1154,26 @@ int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const ch
return (int)((intptr_t)cp);
}
+int DNA_elem_type_size(const eSDNA_Type elem_nr)
+{
+ /* should containt all enum types */
+ switch (elem_nr) {
+ case SDNA_TYPE_CHAR:
+ case SDNA_TYPE_UCHAR:
+ return 1;
+ case SDNA_TYPE_SHORT:
+ case SDNA_TYPE_USHORT:
+ return 2;
+ case SDNA_TYPE_INT:
+ case SDNA_TYPE_LONG:
+ case SDNA_TYPE_ULONG:
+ case SDNA_TYPE_FLOAT:
+ return 4;
+ case SDNA_TYPE_DOUBLE:
+ case SDNA_TYPE_INT64:
+ return 8;
+ }
+
+ /* weak */
+ return 8;
+}
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 11ab9b1efcf..0c417e9f884 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -928,16 +928,18 @@ static int make_structDNA(char *baseDirectory, FILE *file)
/* insertion of all known types */
/* watch it: uint is not allowed! use in structs an unsigned int */
- add_type("char", 1); /* 0 */
- add_type("uchar", 1); /* 1 */
- add_type("short", 2); /* 2 */
- add_type("ushort", 2); /* 3 */
- add_type("int", 4); /* 4 */
- add_type("long", 4); /* 5 */ /* should it be 8 on 64 bits? */
- add_type("ulong", 4); /* 6 */
- add_type("float", 4); /* 7 */
- add_type("double", 8); /* 8 */
- add_type("void", 0); /* 9 */
+ /* watch it: sizes must match DNA_elem_type_size() */
+ add_type("char", 1); /* SDNA_TYPE_CHAR */
+ add_type("uchar", 1); /* SDNA_TYPE_UCHAR */
+ add_type("short", 2); /* SDNA_TYPE_SHORT */
+ add_type("ushort", 2); /* SDNA_TYPE_USHORT */
+ add_type("int", 4); /* SDNA_TYPE_INT */
+ add_type("long", 4); /* SDNA_TYPE_LONG */ /* should it be 8 on 64 bits? */
+ add_type("ulong", 4); /* SDNA_TYPE_ULONG */
+ add_type("float", 4); /* SDNA_TYPE_FLOAT */
+ add_type("double", 8); /* SDNA_TYPE_DOUBLE */
+ add_type("int64_t", 8); /* SDNA_TYPE_INT64 */
+ add_type("void", 0); /* SDNA_TYPE_VOID */
// the defines above shouldn't be output in the padding file...
firststruct = nr_types;
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index 8e8dd559fb1..4fb08227fb6 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -175,6 +175,8 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con
void RNA_def_property_srna(PropertyRNA *prop, const char *type);
void RNA_def_py_data(PropertyRNA *prop, void *py_data);
+void RNA_def_property_translation_context(PropertyRNA *prop, const char *context);
+
/* Function */
FunctionRNA *RNA_def_function(StructRNA *srna, const char *identifier, const char *call);
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index fbe9ed33063..90e68058d36 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -2229,6 +2229,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_print_c_string(f, prop->name); fprintf(f, ",\n\t");
rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
fprintf(f, "%d,\n", prop->icon);
+ rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n\t");
fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength);
fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable));
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 02b1fa300fb..c50e233c43f 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -486,8 +486,12 @@ static const char *rna_ensure_property_name(PropertyRNA *prop)
name= ((IDProperty*)prop)->name;
#ifdef WITH_INTERNATIONAL
- if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE))
- name= BLF_gettext(name);
+ if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) {
+ if(prop->translation_context)
+ name = BLF_pgettext(prop->translation_context, name);
+ else
+ name = BLF_gettext(name);
+ }
#endif
return name;
@@ -837,12 +841,17 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index)
PropertySubType subtype= rna_ensure_property(prop)->subtype;
/* get string to use for array index */
- if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE))
+ if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
return quatitem[index];
- else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
+ }
+ else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
+ PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
+ {
return vectoritem[index];
- else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA))
+ }
+ else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
return coloritem[index];
+ }
return '\0';
}
@@ -865,7 +874,9 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name)
return 3;
}
}
- else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION)) {
+ else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ,
+ PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
+ {
switch (name) {
case 'x':
return 0;
@@ -1187,8 +1198,12 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA
}
for(i=0; nitem[i].identifier; i++) {
- if( nitem[i].name )
- nitem[i].name = BLF_gettext(nitem[i].name);
+ if( nitem[i].name ) {
+ if(prop->translation_context)
+ nitem[i].name = BLF_pgettext(prop->translation_context, nitem[i].name);
+ else
+ nitem[i].name = BLF_gettext(nitem[i].name);
+ }
if( nitem[i].description )
nitem[i].description = BLF_gettext(nitem[i].description);
}
@@ -1519,7 +1534,8 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
/* find cache element for which key matches... */
for (uce = rna_updates_cache.first; uce; uce = uce->next) {
/* just match by id only for now, since most update calls that we'll encounter only really care about this */
- // TODO: later, the cache might need to have some nesting on L1 to cope better with these problems + some tagging to indicate we need this
+ /* TODO: later, the cache might need to have some nesting on L1 to cope better
+ * with these problems + some tagging to indicate we need this */
if (uce->ptr.id.data == ptr->id.data)
break;
}
@@ -4969,7 +4985,9 @@ static int rna_function_format_array_length(const char *format, int ofs, int fle
return 0;
}
-static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type, char ftype, int len, void *dest, void *src, StructRNA *srna, const char *tid, const char *fid, const char *pid)
+static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type,
+ char ftype, int len, void *dest, void *src, StructRNA *srna,
+ const char *tid, const char *fid, const char *pid)
{
/* ptr is always a function pointer, prop always a parameter */
@@ -5055,7 +5073,9 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
}
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, an object of type %s was expected, passed an object of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
+ fprintf(stderr, "%s.%s: wrong type for parameter %s, "
+ "an object of type %s was expected, passed an object of type %s\n",
+ tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
return -1;
}
@@ -5080,7 +5100,10 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
ptype= RNA_property_pointer_type(ptr, prop);
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, a collection of objects of type %s was expected, passed a collection of objects of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
+ fprintf(stderr, "%s.%s: wrong type for parameter %s, "
+ "a collection of objects of type %s was expected, "
+ "passed a collection of objects of type %s\n",
+ tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
return -1;
}
@@ -5159,7 +5182,10 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
if (len!=alen) {
err= -1;
- fprintf(stderr, "%s.%s: for parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen);
+ fprintf(stderr, "%s.%s: for parameter %s, "
+ "was expecting an array of %i elements, "
+ "passed %i elements instead\n",
+ tid, fid, pid, len, alen);
break;
}
@@ -5224,7 +5250,9 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
if (len!=alen) {
err= -1;
- fprintf(stderr, "%s.%s: for return parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen);
+ fprintf(stderr, "%s.%s: for return parameter %s, "
+ "was expecting an array of %i elements, passed %i elements instead\n",
+ tid, fid, pid, len, alen);
}
else {
switch (type) {
@@ -5278,7 +5306,8 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
return err;
}
-int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args)
+int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr,
+ const char *identifier, const char *format, va_list args)
{
FunctionRNA *func;
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index e55559c39dc..caf43793996 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1824,6 +1824,11 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
}
}
+void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
+{
+ prop->translation_context= context;
+}
+
/* Functions */
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index 960d3155fd5..40157d390bc 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -147,6 +147,8 @@ struct PropertyRNA {
const char *description;
/* icon ID */
int icon;
+ /* context for translation */
+ const char *translation_context;
/* property type as it appears to the outside */
PropertyType type;
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 40b6d5b96e4..8794914e727 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -415,8 +415,8 @@ static void rna_def_material_mtex(BlenderRNA *brna)
{MTEX_COMPAT_BUMP, "BUMP_COMPATIBLE", 0, "Compatible", ""},
{MTEX_3TAP_BUMP, "BUMP_LOW_QUALITY", 0, "Low Quality", "Use 3 tap filtering"},
{MTEX_5TAP_BUMP, "BUMP_MEDIUM_QUALITY", 0, "Medium Quality", "Use 5 tap filtering"},
- {MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", "Use bicubic filtering. Requires OpenGL 3.0+. "
- "It will fall back on medium setting for other systems"},
+ {MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", "Use bicubic filtering (requires OpenGL 3.0+, "
+ "it will fall back on medium setting for other systems)"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_bump_space_items[] = {
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 1330c57974d..846fb751d7a 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -2537,6 +2537,11 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ prop= RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_INDICES);
+ RNA_def_property_ui_text(prop, "Indices", "Displays the index numbers of selected vertices, edges, and faces");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
/* editflag */
prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index 3b1ac8f22c3..fbc6a0155f2 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -78,6 +78,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
{IMB_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run", "Use images in the order they are recorded"},
{IMB_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", "Use global timestamp written by recording device"},
{IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)", "Interpolate a global timestamp using the record date and time written by recording device"},
+ {IMB_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps", "Record run, but ignore timecode, changes in framerate or dropouts"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "MovieClipProxy", NULL);
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 9a141dde3db..676d5f2c44f 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -465,6 +465,20 @@ static int rna_Property_description_length(PointerRNA *ptr)
return prop->description ? strlen(prop->description) : 0;
}
+static void rna_Property_translation_context_get(PointerRNA *ptr, char *value)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ strcpy(value, prop->translation_context ? prop->translation_context:"");
+}
+
+static int rna_Property_translation_context_length(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return prop->translation_context ? strlen(prop->translation_context) : 0;
+}
+
static int rna_Property_type_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -1047,6 +1061,11 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, "rna_Property_description_get", "rna_Property_description_length", NULL);
RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips");
+ prop= RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Property_translation_context_get", "rna_Property_translation_context_length", NULL);
+ RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the property");
+
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, property_type_items);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index a193f5d0f33..51239cd55b1 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2117,7 +2117,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "exitkey");
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL);
- RNA_def_property_ui_text(prop, "Exit Key", "Sets the key that exits the Game Engine");
+ RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine");
RNA_def_property_update(prop, NC_SCENE, NULL);
// Do we need it here ? (since we already have it in World
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index f9b20d3ac78..c0a644f5758 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2607,40 +2607,43 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* hardcoded here, could become dynamic somehow */
/* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */
/* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */
+ /* Note: As this list is in alphabetical order, and not defined order,
+ * here is the highest define currently in use: 28 (serbian latin). */
static EnumPropertyItem language_items[] = {
- {0, "", 0, "Nearly done", ""},
- {0, "DEFAULT", 0, "Default (Default)", ""},
- {1, "ENGLISH", 0, "English (English)", "en_US"},
- {8, "FRENCH", 0, "French (Français)", "fr_FR"},
- {4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"},
+ { 0, "", 0, "Nearly done", ""},
+ { 0, "DEFAULT", 0, "Default (Default)", ""},
+ { 1, "ENGLISH", 0, "English (English)", "en_US"},
+ { 8, "FRENCH", 0, "French (Français)", "fr_FR"},
+ { 4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"},
{15, "RUSSIAN", 0, "Russian (Русский)", "ru_RU"},
{13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"},
- {9, "SPANISH", 0, "Spanish (Español)", "es"},
+ { 9, "SPANISH", 0, "Spanish (Español)", "es"},
{14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"},
- {0, "", 0, "In progress", ""},
- {2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"},
- {3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},
- {5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
- {6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},
- {7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"},
- {10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
- {11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
- {12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"},
- {16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
- {17, "SERBIAN", 0, "Serbian (Српском језику)", "sr_RS"},
- {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
- {19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
- {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},
+ { 0, "", 0, "In progress", ""},
/* using the utf8 flipped form of Arabic (العربية) */
{21, "ARABIC", 0, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"},
+ {12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"},
{22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"},
+ {10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
+ {16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
+ {11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
+ { 3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},
+ { 6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},
+ { 5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
{23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"},
+ {27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
+ { 2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"},
{24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"},
{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},
/* using the utf8 flipped form of Persian (فارسی) */
{26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_PE"},
- {27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
- {0, NULL, 0, NULL, NULL}};
+ {19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
+ {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},
+ {17, "SERBIAN", 0, "Serbian (Српски)", "sr"},
+ {28, "SERBIAN_LATIN", 0, "Serbian latin (Srpski latinica)", "sr@latin"},
+ { 7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"},
+ {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
+ { 0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
RNA_def_struct_sdna(srna, "UserDef");
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 2a4b700ce1d..732a46cb8b6 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -399,29 +399,37 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(tdw);
return dm;
}
- indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices");
- memcpy(indices, tidx, sizeof(int) * numIdx);
- org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w");
+ if(numIdx != numVerts) {
+ indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices");
+ memcpy(indices, tidx, sizeof(int) * numIdx);
+ org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w");
+ memcpy(org_w, tw, sizeof(float) * numIdx);
+ dw = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGProximity Modifier, dw");
+ memcpy(dw, tdw, sizeof(MDeformWeight*) * numIdx);
+ MEM_freeN(tw);
+ MEM_freeN(tdw);
+ }
+ else {
+ org_w = tw;
+ dw = tdw;
+ }
new_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, new_w");
- memcpy(org_w, tw, sizeof(float) * numIdx);
- dw = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGProximity Modifier, dw");
- memcpy(dw, tdw, sizeof(MDeformWeight*) * numIdx);
MEM_freeN(tidx);
- MEM_freeN(tw);
- MEM_freeN(tdw);
/* Get our vertex coordinates. */
- {
+ v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos");
+ if(numIdx != numVerts) {
/* XXX In some situations, this code can be up to about 50 times more performant
* than simply using getVertCo for each affected vertex...
*/
float (*tv_cos)[3] = MEM_mallocN(sizeof(float[3]) * numVerts, "WeightVGProximity Modifier, tv_cos");
- v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos");
dm->getVertCos(dm, tv_cos);
for (i = 0; i < numIdx; i++)
copy_v3_v3(v_cos[i], tv_cos[indices[i]]);
MEM_freeN(tv_cos);
}
+ else
+ dm->getVertCos(dm, v_cos);
/* Compute wanted distances. */
if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) {
@@ -497,7 +505,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(org_w);
MEM_freeN(new_w);
MEM_freeN(dw);
- MEM_freeN(indices);
+ if(indices)
+ MEM_freeN(indices);
MEM_freeN(v_cos);
#if DO_PROFILE
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index cad85d33a66..3a783f0f32d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -47,7 +47,8 @@ static bNodeSocketTemplate cmp_node_alphaover_out[]= {
static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
{
- if(over[3]<=0.0f) {
+ /* Zero alpha values should still permit an add of RGB data */
+ if(over[3]<0.0f) {
copy_v4_v4(out, src);
}
else if(fac[0]==1.0f && over[3]>=1.0f) {
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index c2fd6036414..e32444976dd 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -1304,6 +1304,7 @@ PyObject *BPyInit_bgl(void)
PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
+ Py_INCREF((PyObject *)&BGL_bufferType);
#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item=PyLong_FromLong((int)x)); Py_DECREF(item)
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 1d1cab1c66d..2a4c004d84c 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -36,6 +36,12 @@
#include "RNA_access.h"
+#define USE_MATHUTILS
+
+#ifdef USE_MATHUTILS
+# include "../mathutils/mathutils.h" /* so we can have mathutils callbacks */
+#endif
+
#define MAX_ARRAY_DIMENSION 10
typedef void (*ItemConvertFunc)(PyObject *, char *);
@@ -259,10 +265,47 @@ static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop,
/* validate type first because length validation may modify property array length */
- if (validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1)
- return -1;
- return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix);
+#ifdef USE_MATHUTILS
+ if (lvalue_dim == 0) { /* only valid for first level array */
+ if (MatrixObject_Check(rvalue)) {
+ MatrixObject *pymat= (MatrixObject *)rvalue;
+
+ if (BaseMath_ReadCallback(pymat) == -1)
+ return -1;
+
+ if (RNA_property_type(prop) != PROP_FLOAT) {
+ PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign to non float array",
+ error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
+ return -1;
+ }
+ else if (totdim != 2) {
+ PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign array with %d dimensions",
+ error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), totdim);
+ return -1;
+ }
+ else if (pymat->num_col != dimsize[0] || pymat->num_row != dimsize[1]) {
+ PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign dimension size mismatch, "
+ "is %dx%d, expected be %dx%d",
+ error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop),
+ pymat->num_col, pymat->num_row, dimsize[0], dimsize[1]);
+ return -1;
+ }
+ else {
+ *totitem= dimsize[0] * dimsize[1];
+ return 0;
+ }
+ }
+ }
+#endif /* USE_MATHUTILS */
+
+
+ {
+ if (validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1)
+ return -1;
+
+ return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix);
+ }
}
static char *copy_value_single(PyObject *item, PointerRNA *ptr, PropertyRNA *prop,
@@ -305,6 +348,26 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop,
return NULL;
}
+
+#ifdef USE_MATHUTILS
+ if (dim == 0) {
+ if (MatrixObject_Check(seq)) {
+ MatrixObject *pymat= (MatrixObject *)seq;
+ size_t allocsize= pymat->num_col * pymat->num_row * sizeof(float);
+
+ /* read callback already done by validate */
+ /* since this is the first iteration we can assume data is allocated */
+ memcpy(data, pymat->matrix, allocsize);
+
+ /* not really needed but do for completeness */
+ data += allocsize;
+
+ return data;
+ }
+ }
+#endif /* USE_MATHUTILS */
+
+
for (i= 0; i < seq_size; i++) {
PyObject *item= PySequence_GetItem(seq, i);
if (item) {
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index a155a7ec3d9..66e8ff510ef 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -145,6 +145,14 @@ PyInit_gpu(void)
PyObject_SetAttrString(d, #f, val); \
Py_DECREF(val)
+PyDoc_STRVAR(GPU_export_shader_doc,
+"export_shader(scene, material)\n"
+"\n"
+" Returns the GLSL shader that produces the visual effect of material in scene.\n"
+"\n"
+" :return: Dictionary defining the shader, uniforms and attributes.\n"
+" :rtype: Dict"
+);
static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds)
{
PyObject* pyscene;
@@ -279,11 +287,9 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
return result;
}
-static PyMethodDef meth_export_shader[] = {{ "export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS,
- "export_shader(scene,material)\n\n"
- "Returns the GLSL shader that produces the visual effect of material in scene.\n\n"
- ":return: Dictionary defining the shader, uniforms and attributes.\n"
- ":rtype: Dict"}};
+static PyMethodDef meth_export_shader[] = {
+ {"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc}
+};
PyObject* GPU_initPython(void)
{
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 1dfd7c574dd..1147930ff65 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -456,6 +456,7 @@ PyMODINIT_FUNC PyInit_mathutils(void)
Py_INCREF(item);
mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);
+ mathutils_matrix_column_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_column_cb);
return submodule;
}
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 59aad37f746..de098ce8bd8 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -42,7 +42,7 @@ static PyObject *Matrix_copy(MatrixObject *self);
static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value);
static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self);
-/* matrix vector callbacks */
+/* matrix row callbacks */
int mathutils_matrix_vector_cb_index= -1;
static int mathutils_matrix_vector_check(BaseMathObject *bmo)
@@ -51,56 +51,56 @@ static int mathutils_matrix_vector_check(BaseMathObject *bmo)
return BaseMath_ReadCallback(self);
}
-static int mathutils_matrix_vector_get(BaseMathObject *bmo, int col)
+static int mathutils_matrix_vector_get(BaseMathObject *bmo, int row)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
- int row;
+ int col;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- for (row=0; row < self->num_row; row++) {
- bmo->data[row] = MATRIX_ITEM(self, row, col);
+ for (col=0; col < self->num_col; col++) {
+ bmo->data[col] = MATRIX_ITEM(self, row, col);
}
return 0;
}
-static int mathutils_matrix_vector_set(BaseMathObject *bmo, int col)
+static int mathutils_matrix_vector_set(BaseMathObject *bmo, int row)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
- int row;
+ int col;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- for (row=0; row < self->num_row; row++) {
- MATRIX_ITEM(self, row, col) = bmo->data[row];
+ for (col=0; col < self->num_col; col++) {
+ MATRIX_ITEM(self, row, col) = bmo->data[col];
}
(void)BaseMath_WriteCallback(self);
return 0;
}
-static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int col, int row)
+static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int row, int col)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- bmo->data[row]= MATRIX_ITEM(self, row, col);
+ bmo->data[col]= MATRIX_ITEM(self, row, col);
return 0;
}
-static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int col, int row)
+static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int row, int col)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- MATRIX_ITEM(self, row, col) = bmo->data[row];
+ MATRIX_ITEM(self, row, col) = bmo->data[col];
(void)BaseMath_WriteCallback(self);
return 0;
@@ -115,6 +115,87 @@ Mathutils_Callback mathutils_matrix_vector_cb = {
};
/* matrix vector callbacks, this is so you can do matrix[i][j] = val */
+/* matrix row callbacks */
+int mathutils_matrix_column_cb_index= -1;
+
+static int mathutils_matrix_column_check(BaseMathObject *bmo)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+ return BaseMath_ReadCallback(self);
+}
+
+static int mathutils_matrix_column_get(BaseMathObject *bmo, int col)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+ int num_row;
+ int row;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ /* for 'translation' size will always be '3' even on 4x4 vec */
+ num_row = MIN2(self->num_row, ((VectorObject *)bmo)->size);
+
+ for (row = 0; row < num_row; row++) {
+ bmo->data[row] = MATRIX_ITEM(self, row, col);
+ }
+
+ return 0;
+}
+
+static int mathutils_matrix_column_set(BaseMathObject *bmo, int col)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+ int num_row;
+ int row;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ /* for 'translation' size will always be '3' even on 4x4 vec */
+ num_row = MIN2(self->num_row, ((VectorObject *)bmo)->size);
+
+ for (row = 0; row < num_row; row++) {
+ MATRIX_ITEM(self, row, col) = bmo->data[row];
+ }
+
+ (void)BaseMath_WriteCallback(self);
+ return 0;
+}
+
+static int mathutils_matrix_column_get_index(BaseMathObject *bmo, int col, int row)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ bmo->data[row]= MATRIX_ITEM(self, row, col);
+ return 0;
+}
+
+static int mathutils_matrix_column_set_index(BaseMathObject *bmo, int col, int row)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ MATRIX_ITEM(self, row, col) = bmo->data[row];
+
+ (void)BaseMath_WriteCallback(self);
+ return 0;
+}
+
+Mathutils_Callback mathutils_matrix_column_cb = {
+ mathutils_matrix_column_check,
+ mathutils_matrix_column_get,
+ mathutils_matrix_column_set,
+ mathutils_matrix_column_get_index,
+ mathutils_matrix_column_set_index
+};
+/* matrix column callbacks, this is so you can do matrix.translation = Vector() */
+
//----------------------------------mathutils.Matrix() -----------------
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
//create a new matrix type
@@ -134,15 +215,19 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *arg= PyTuple_GET_ITEM(args, 0);
+ /* Input is now as a sequence of rows so length of sequence
+ * is the number of rows */
/* -1 is an error, size checks will accunt for this */
- const unsigned short num_col= PySequence_Size(arg);
+ const unsigned short num_row= PySequence_Size(arg);
- if (num_col >= 2 && num_col <= 4) {
+ if (num_row >= 2 && num_row <= 4) {
PyObject *item= PySequence_GetItem(arg, 0);
- const unsigned short num_row= PySequence_Size(item);
+ /* Since each item is a row, number of items is the
+ * same as the number of columns */
+ const unsigned short num_col= PySequence_Size(item);
Py_XDECREF(item);
- if (num_row >= 2 && num_row <= 4) {
+ if (num_col >= 2 && num_col <= 4) {
/* sane row & col size, new matrix and assign as slice */
PyObject *matrix= Matrix_CreatePyObject(NULL, num_col, num_row, Py_NEW, type);
if (Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) {
@@ -761,7 +846,8 @@ PyDoc_STRVAR(Matrix_resize_4x4_doc,
);
static PyObject *Matrix_resize_4x4(MatrixObject *self)
{
- int x, first_row_elem, curr_pos, new_pos, blank_columns, blank_rows, index;
+ float mat[16];
+ int col;
if (self->wrapped==Py_WRAP) {
PyErr_SetString(PyExc_TypeError,
@@ -784,30 +870,14 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
return NULL;
}
- /*move data to new spot in array + clean*/
- for (blank_rows = (4 - self->num_col); blank_rows > 0; blank_rows--) {
- for (x = 0; x < 4; x++) {
- index = (4 * (self->num_col + (blank_rows - 1))) + x;
- if (index == 10 || index == 15) {
- self->matrix[index] = 1.0f;
- }
- else {
- self->matrix[index] = 0.0f;
- }
- }
- }
- for (x = 1; x <= self->num_col; x++) {
- first_row_elem = (self->num_row * (self->num_col - x));
- curr_pos = (first_row_elem + (self->num_row -1));
- new_pos = (4 * (self->num_col - x)) + (curr_pos - first_row_elem);
- for (blank_columns = (4 - self->num_row); blank_columns > 0; blank_columns--) {
- self->matrix[new_pos + blank_columns] = 0.0f;
- }
- for ( ; curr_pos >= first_row_elem; curr_pos--) {
- self->matrix[new_pos] = self->matrix[curr_pos];
- new_pos--;
- }
+ unit_m4((float (*)[4])mat);
+
+ for (col = 0; col < self->num_col; col++) {
+ memcpy(mat + (4 * col), MATRIX_COL_PTR(self, col), self->num_row * sizeof(float));
}
+
+ copy_m4_m4((float (*)[4])self->matrix, (float (*)[4])mat);
+
self->num_col = 4;
self->num_row = 4;
@@ -1298,13 +1368,13 @@ static PyObject *Matrix_repr(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- for (col = 0; col < self->num_col; col++) {
- rows[col]= PyTuple_New(self->num_row);
- for (row = 0; row < self->num_row; row++) {
- PyTuple_SET_ITEM(rows[col], row, PyFloat_FromDouble(MATRIX_ITEM(self, row, col)));
+ for (row = 0; row < self->num_row; row++) {
+ rows[row]= PyTuple_New(self->num_col);
+ for (col = 0; col < self->num_col; col++) {
+ PyTuple_SET_ITEM(rows[row], col, PyFloat_FromDouble(MATRIX_ITEM(self, row, col)));
}
}
- switch (self->num_col) {
+ switch (self->num_row) {
case 2: return PyUnicode_FromFormat("Matrix((%R,\n"
" %R))", rows[0], rows[1]);
@@ -1402,44 +1472,48 @@ static PyObject* Matrix_richcmpr(PyObject *a, PyObject *b, int op)
sequence length*/
static int Matrix_len(MatrixObject *self)
{
- return (self->num_col);
+ return (self->num_row);
}
/*----------------------------object[]---------------------------
sequence accessor (get)
the wrapped vector gives direct access to the matrix data*/
-static PyObject *Matrix_item(MatrixObject *self, int i)
+static PyObject *Matrix_item(MatrixObject *self, int row)
{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (i < 0 || i >= self->num_col) {
+ if (row < 0 || row >= self->num_row) {
PyErr_SetString(PyExc_IndexError,
"matrix[attribute]: "
"array index out of range");
return NULL;
}
- return Vector_CreatePyObject_cb((PyObject *)self, self->num_row, mathutils_matrix_vector_cb_index, i);
+ return Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_vector_cb_index, row);
}
/*----------------------------object[]-------------------------
sequence accessor (set) */
-static int Matrix_ass_item(MatrixObject *self, int i, PyObject *value)
+static int Matrix_ass_item(MatrixObject *self, int row, PyObject *value)
{
+ int col;
float vec[4];
if (BaseMath_ReadCallback(self) == -1)
return -1;
- if (i >= self->num_col || i < 0) {
+ if (row >= self->num_row || row < 0) {
PyErr_SetString(PyExc_IndexError,
- "matrix[attribute] = x: bad column");
+ "matrix[attribute] = x: bad row");
return -1;
}
- if (mathutils_array_parse(vec, self->num_row, self->num_row, value, "matrix[i] = value assignment") < 0) {
+ if (mathutils_array_parse(vec, self->num_col, self->num_col, value, "matrix[i] = value assignment") < 0) {
return -1;
}
- memcpy(MATRIX_COL_PTR(self, i), vec, self->num_row * sizeof(float));
+ /* Since we are assigning a row we cannot memcpy */
+ for (col = 0; col < self->num_col; col++) {
+ MATRIX_ITEM(self, row, col) = vec[col];
+ }
(void)BaseMath_WriteCallback(self);
return 0;
@@ -1456,14 +1530,14 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- CLAMP(begin, 0, self->num_col);
- CLAMP(end, 0, self->num_col);
+ CLAMP(begin, 0, self->num_row);
+ CLAMP(end, 0, self->num_row);
begin= MIN2(begin, end);
tuple= PyTuple_New(end - begin);
for (count= begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin,
- Vector_CreatePyObject_cb((PyObject *)self, self->num_row, mathutils_matrix_vector_cb_index, count));
+ Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_vector_cb_index, count));
}
@@ -1478,8 +1552,8 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
if (BaseMath_ReadCallback(self) == -1)
return -1;
- CLAMP(begin, 0, self->num_col);
- CLAMP(end, 0, self->num_col);
+ CLAMP(begin, 0, self->num_row);
+ CLAMP(end, 0, self->num_row);
begin = MIN2(begin, end);
/* non list/tuple cases */
@@ -1489,8 +1563,9 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
}
else {
const int size= end - begin;
- int i;
+ int row, col;
float mat[16];
+ float vec[4];
if (PySequence_Fast_GET_SIZE(value_fast) != size) {
Py_DECREF(value_fast);
@@ -1500,22 +1575,25 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
return -1;
}
+ memcpy(mat, self->matrix, self->num_col * self->num_row * sizeof(float));
+
/*parse sub items*/
- for (i = 0; i < size; i++) {
+ for (row = begin; row < end; row++) {
/*parse each sub sequence*/
- PyObject *item= PySequence_Fast_GET_ITEM(value_fast, i);
+ PyObject *item= PySequence_Fast_GET_ITEM(value_fast, row - begin);
- if (mathutils_array_parse(&mat[i * self->num_row], self->num_row, self->num_row, item,
- "matrix[begin:end] = value assignment") < 0)
- {
+ if (mathutils_array_parse(vec, self->num_col, self->num_col, item, "matrix[begin:end] = value assignment") < 0)
return -1;
+
+ for (col = 0; col < self->num_col; col++) {
+ mat[col * self->num_row + row] = vec[col];
}
}
Py_DECREF(value_fast);
/*parsed well - now set in matrix*/
- memcpy(self->matrix + (begin * self->num_row), mat, sizeof(float) * (size * self->num_row));
+ memcpy(self->matrix, mat, self->num_col * self->num_row * sizeof(float));
(void)BaseMath_WriteCallback(self);
return 0;
@@ -1598,6 +1676,7 @@ static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar)
static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
{
float scalar;
+ int vec_size;
MatrixObject *mat1 = NULL, *mat2 = NULL;
@@ -1621,12 +1700,19 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
double dot = 0.0f;
int col, row, item;
+ if (mat1->num_col != mat2->num_row) {
+ PyErr_SetString(PyExc_ValueError,
+ "matrix1 * matrix2: matrix1 number of columns "
+ "and the matrix2 number of rows must be the same");
+ return NULL;
+ }
+
for (col = 0; col < mat2->num_col; col++) {
for (row = 0; row < mat1->num_row; row++) {
for (item = 0; item < mat1->num_col; item++) {
dot += MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col);
}
- mat[((col * mat1->num_row) + row)] = (float)dot;
+ mat[(col * mat1->num_row) + row] = (float)dot;
dot = 0.0f;
}
}
@@ -1640,7 +1726,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
}
}
else if (mat1) {
- /*VEC * MATRIX */
+ /* MATRIX * VECTOR */
if (VectorObject_Check(m2)) {
VectorObject *vec2= (VectorObject *)m2;
float tvec[4];
@@ -1650,7 +1736,14 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
return NULL;
}
- return Vector_CreatePyObject(tvec, vec2->size, Py_NEW, Py_TYPE(m2));
+ if (mat1->num_col == 4 && vec2->size == 3) {
+ vec_size = 3;
+ }
+ else {
+ vec_size = mat1->num_row;
+ }
+
+ return Vector_CreatePyObject(tvec, vec_size, Py_NEW, Py_TYPE(m2));
}
/*FLOAT/INT * MATRIX */
else if (((scalar= PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred())==0) {
@@ -1813,6 +1906,51 @@ static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure))
return PyLong_FromLong((long) self->num_row);
}
+static PyObject *Matrix_translation_get(MatrixObject *self, void *UNUSED(closure))
+{
+ PyObject *ret;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ /*must be 4x4 square matrix*/
+ if (self->num_row != 4 || self->num_col != 4) {
+ PyErr_SetString(PyExc_AttributeError,
+ "Matrix.translation: "
+ "inappropriate matrix size, must be 4x4");
+ return NULL;
+ }
+
+ ret = (PyObject *)Vector_CreatePyObject_cb((PyObject *)self, 3, mathutils_matrix_column_cb_index, 3);
+
+ return ret;
+}
+
+static int Matrix_translation_set(MatrixObject *self, PyObject *value, void *UNUSED(closure))
+{
+ float tvec[3];
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ /*must be 4x4 square matrix*/
+ if (self->num_row != 4 || self->num_col != 4) {
+ PyErr_SetString(PyExc_AttributeError,
+ "Matrix.translation: "
+ "inappropriate matrix size, must be 4x4");
+ return -1;
+ }
+
+ if ((mathutils_array_parse(tvec, 3, 3, value, "Matrix.translation")) == -1)
+ return -1;
+
+ copy_v3_v3(((float (*)[4])self->matrix)[3], tvec);
+
+ (void)BaseMath_WriteCallback(self);
+
+ return 0;
+}
+
static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closure))
{
float mat[3][3];
@@ -1876,6 +2014,7 @@ static PyGetSetDef Matrix_getseters[] = {
{(char *)"row_size", (getter)Matrix_getRowSize, (setter)NULL, (char *)"The row size of the matrix (readonly).\n\n:type: int", NULL},
{(char *)"col_size", (getter)Matrix_getColSize, (setter)NULL, (char *)"The column size of the matrix (readonly).\n\n:type: int", NULL},
{(char *)"median_scale", (getter)Matrix_median_scale_get, (setter)NULL, (char *)"The average scale applied to each axis (readonly).\n\n:type: float", NULL},
+ {(char *)"translation", (getter)Matrix_translation_get, (setter)Matrix_translation_set, (char *)"The translation component of the matrix.\n\n:type: Vector", NULL},
{(char *)"is_negative", (getter)Matrix_is_negative_get, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"is_orthogonal", (getter)Matrix_is_orthogonal_get, (setter)NULL, (char *)"True if this matrix is orthogonal, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},
diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h
index 91a276b648e..e7bfc06b98b 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.h
+++ b/source/blender/python/mathutils/mathutils_Matrix.h
@@ -71,7 +71,9 @@ PyObject *Matrix_CreatePyObject(float *mat,
PyObject *Matrix_CreatePyObject_cb(PyObject *user, int num_col, int num_row, int cb_type, int cb_subtype);
extern int mathutils_matrix_vector_cb_index;
+extern int mathutils_matrix_column_cb_index;
extern struct Mathutils_Callback mathutils_matrix_vector_cb;
+extern struct Mathutils_Callback mathutils_matrix_column_cb;
void matrix_as_3x3(float mat[3][3], MatrixObject *self);
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index bd121b6177f..c31835cf7b5 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1540,6 +1540,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
float scalar;
+ int vec_size;
if VectorObject_Check(v1) {
vec1= (VectorObject *)v1;
@@ -1576,7 +1577,14 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
return NULL;
}
- return Vector_CreatePyObject(tvec, vec1->size, Py_NEW, Py_TYPE(vec1));
+ if (((MatrixObject *)v2)->num_row == 4 && vec1->size == 3) {
+ vec_size = 3;
+ }
+ else {
+ vec_size = ((MatrixObject *)v2)->num_col;
+ }
+
+ return Vector_CreatePyObject(tvec, vec_size, Py_NEW, Py_TYPE(vec1));
}
else if (QuaternionObject_Check(v2)) {
/* VEC * QUAT */
@@ -2603,7 +2611,7 @@ if len(unique) != len(items):
*/
/* ROW VECTOR Multiplication - Vector X Matrix
- * [x][y][z] * [1][4][7]
+ * [x][y][z] * [1][4][7]
* [2][5][8]
* [3][6][9]
* vector/matrix multiplication IS NOT COMMUTATIVE!!!! */
@@ -2611,18 +2619,18 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
{
float vec_cpy[MAX_DIMENSIONS];
double dot = 0.0f;
- int x, y, z= 0, vec_size= vec->size;
+ int row, col, z= 0, vec_size= vec->size;
if (mat->num_row != vec_size) {
- if (mat->num_row == 4 && vec_size != 3) {
+ if (mat->num_row == 4 && vec_size == 3) {
+ vec_cpy[3] = 1.0f;
+ }
+ else {
PyErr_SetString(PyExc_ValueError,
"vector * matrix: matrix column size "
"and the vector size must be the same");
return -1;
}
- else {
- vec_cpy[3] = 1.0f;
- }
}
if (BaseMath_ReadCallback(vec) == -1 || BaseMath_ReadCallback(mat) == -1)
@@ -2632,9 +2640,9 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
rvec[3] = 1.0f;
//muliplication
- for (x = 0; x < mat->num_col; x++) {
- for (y = 0; y < mat->num_row; y++) {
- dot += MATRIX_ITEM(mat, y, x) * vec_cpy[y];
+ for (col = 0; col < mat->num_col; col++) {
+ for (row = 0; row < mat->num_row; row++) {
+ dot += MATRIX_ITEM(mat, row, col) * vec_cpy[row];
}
rvec[z++] = (float)dot;
dot = 0.0f;
diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp
index 20202319d44..14b4a7bcf9f 100644
--- a/source/blender/render/intern/raytrace/rayobject_octree.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp
@@ -978,7 +978,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
}
xo=ocx1; yo=ocy1; zo=ocz1;
- labdao= ddalabda= MIN3(labdax,labday,labdaz);
+ ddalabda= MIN3(labdax,labday,labdaz);
vec2[0]= ox1;
vec2[1]= oy1;
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 146245aa191..c5033c55d55 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -592,7 +592,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
{
MemArena *arena= NULL;
VertexTangent **vtangents= NULL;
- int a, iCalcNewMethod;
+ int a;
if(do_nmap_tangent) {
arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "nmap tangent arena");
@@ -680,8 +680,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
}
}
- iCalcNewMethod = 1;
- if(iCalcNewMethod!=0 && do_nmap_tangent!=0)
+ if(do_nmap_tangent!=0)
{
SRenderMeshToTangent mesh2tangent;
SMikkTSpaceContext sContext;
@@ -701,11 +700,9 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
sInterface.m_getNormal = GetNormal;
sInterface.m_setTSpaceBasic = SetTSpace;
- // 0 if failed
- iCalcNewMethod = genTangSpaceDefault(&sContext);
+ genTangSpaceDefault(&sContext);
}
-
if(arena)
BLI_memarena_free(arena);
if(vtangents)
@@ -1068,7 +1065,6 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
mul_v3_fl(cross, width);
}
- else width= 1.0f;
if(ma->mode & MA_TANGENT_STR)
flag= R_SMOOTH|R_TANGENT;
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index b62484a6995..f261ec41746 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -176,7 +176,6 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
if(inpr<t) continue;
else {
t= inpr-t;
- i= 1.0;
soft= 1.0;
if(t<lar->spotbl && lar->spotbl!=0.0f) {
/* soft area */
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index b8c4b05de50..41bfcb55068 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -2010,7 +2010,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
samples++;
- if (qsa->type == SAMP_TYPE_HALTON) {
+ if (qsa && qsa->type == SAMP_TYPE_HALTON) {
/* adaptive sampling - consider samples below threshold as in shadow (or vice versa) and exit early */
if (adapt_thresh > 0.0f && (samples > max_samples/2) ) {
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 25575fa965f..43761be9d71 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -1026,7 +1026,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0);
yn= tin*mtex->colfac;
- zn= tin*mtex->alphafac;
+ //zn= tin*mtex->alphafac;
if(mtex->mapto & MAP_COL) {
zn= 1.0f-yn;
@@ -1112,10 +1112,8 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
if(ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
if(ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
- if((ma->mode & MA_HALOTEX) && ma->mtex[0]){
+ if((ma->mode & MA_HALOTEX) && ma->mtex[0])
har->tex= 1;
- i=1;
- }
for(i=0; i<MAX_MTEX; i++)
if(ma->mtex[i] && (ma->septex & (1<<i))==0) {
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 4d654beb287..b99bab04b10 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -269,14 +269,12 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
if(p1[2]<-ladist) t1= t3;
}
else {
- ok1= 1;
t1= t3;
}
if(ok2) {
if(p2[2]<-ladist) t2= t3;
}
else {
- ok2= 1;
t2= t3;
}
}
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index 775e338db5b..cdc185160d5 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -833,7 +833,6 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "strand sort arena");
firstseg= NULL;
- sortseg= sortsegments;
totsegment= 0;
/* for all object instances */
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index a46ef3888d8..3637c2de1fb 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -746,7 +746,6 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct
float tr[3] = {1.0,1.0,1.0};
Isect is= {{0}};
float *startco, *endco;
- int intersect_type = VOL_BOUNDS_DEPTH;
memset(shr, 0, sizeof(ShadeResult));
@@ -755,12 +754,11 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct
if (shi->flippednor) {
startco = last_is->start;
endco = shi->co;
- intersect_type = VOL_BOUNDS_SS;
}
/* trace to find a backface, the other side bounds of the volume */
/* (ray intersect ignores front faces here) */
- else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, intersect_type)) {
+ else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, VOL_BOUNDS_DEPTH)) {
startco = shi->co;
endco = hitco;
}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 9ef86b3cac5..9bd9719ad83 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -776,11 +776,11 @@ endif()
bf_nodes
bf_gpu
bf_blenloader
+ bf_imbuf
bf_blenlib
bf_intern_ghost
bf_intern_string
bf_blenpluginapi
- bf_imbuf
bf_avi
bf_imbuf_cineon
bf_imbuf_openexr
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 821cb746b65..30d7c153748 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -3032,4 +3032,4 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
SCA_IInputDevice::KX_EnumInputs ConvertKeyCode(int key_code)
{
return gReverseKeyTranslateTable[key_code];
-} \ No newline at end of file
+}
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index f9403c9725a..f249510ecc7 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -789,6 +789,10 @@ void GPG_Application::stopEngine()
void GPG_Application::exitEngine()
{
+ // We only want to kill the engine if it has been initialized
+ if (!m_engineInitialized)
+ return;
+
sound_exit();
if (m_ketsjiengine)
{
diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
index 70bb2dbb5a2..728d0fb8561 100644
--- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp
+++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
@@ -145,7 +145,8 @@ bool KX_IpoSGController::Update(double currentTime)
}
//modifies position?
- if (m_ipo_channels_active[OB_LOC_X] || m_ipo_channels_active[OB_LOC_Y] || m_ipo_channels_active[OB_LOC_Z] || m_ipo_channels_active[OB_DLOC_X] || m_ipo_channels_active[OB_DLOC_Y] || m_ipo_channels_active[OB_DLOC_Z])
+ if (m_ipo_channels_active[OB_LOC_X] || m_ipo_channels_active[OB_LOC_Y] || m_ipo_channels_active[OB_LOC_Z] ||
+ m_ipo_channels_active[OB_DLOC_X] || m_ipo_channels_active[OB_DLOC_Y] || m_ipo_channels_active[OB_DLOC_Z])
{
if (m_ipo_as_force == true)
{
@@ -198,7 +199,9 @@ bool KX_IpoSGController::Update(double currentTime)
}
}
//modifies orientation?
- if (m_ipo_channels_active[OB_ROT_X] || m_ipo_channels_active[OB_ROT_Y] || m_ipo_channels_active[OB_ROT_Z] || m_ipo_channels_active[OB_DROT_X] || m_ipo_channels_active[OB_DROT_Y] || m_ipo_channels_active[OB_DROT_Z]) {
+ if (m_ipo_channels_active[OB_ROT_X] || m_ipo_channels_active[OB_ROT_Y] || m_ipo_channels_active[OB_ROT_Z] ||
+ m_ipo_channels_active[OB_DROT_X] || m_ipo_channels_active[OB_DROT_Y] || m_ipo_channels_active[OB_DROT_Z])
+ {
if (m_ipo_as_force) {
if (m_game_object && ob) {
@@ -293,7 +296,9 @@ bool KX_IpoSGController::Update(double currentTime)
}
}
//modifies scale?
- if (m_ipo_channels_active[OB_SIZE_X] || m_ipo_channels_active[OB_SIZE_Y] || m_ipo_channels_active[OB_SIZE_Z] || m_ipo_channels_active[OB_DSIZE_X] || m_ipo_channels_active[OB_DSIZE_Y] || m_ipo_channels_active[OB_DSIZE_Z]) {
+ if (m_ipo_channels_active[OB_SIZE_X] || m_ipo_channels_active[OB_SIZE_Y] || m_ipo_channels_active[OB_SIZE_Z] ||
+ m_ipo_channels_active[OB_DSIZE_X] || m_ipo_channels_active[OB_DSIZE_Y] || m_ipo_channels_active[OB_DSIZE_Z])
+ {
//default is no scale change
MT_Vector3 newScale(1.0,1.0,1.0);
if (!m_ipo_add)
diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h
index b9ff3759452..392a6633067 100644
--- a/source/gameengine/Ketsji/KX_PyMath.h
+++ b/source/gameengine/Ketsji/KX_PyMath.h
@@ -65,32 +65,59 @@ bool PyMatTo(PyObject* pymat, T& mat)
{
bool noerror = true;
mat.setIdentity();
+
+
+#ifdef USE_MATHUTILS
+
+ if (MatrixObject_Check(pymat))
+ {
+ MatrixObject *pymatrix = (MatrixObject *)pymat;
+
+ if (BaseMath_ReadCallback(pymatrix) == -1)
+ return false;
+
+ if (pymatrix->num_col != Size(mat) || pymatrix->num_row != Size(mat))
+ return false;
+
+ for (unsigned int row = 0; row < Size(mat); row++)
+ {
+ for (unsigned int col = 0; col < Size(mat); col++)
+ {
+ mat[row][col] = *(pymatrix->matrix + col * pymatrix->num_row + row);
+ }
+ }
+ }
+ else
+
+#endif /* USE_MATHUTILS */
+
+
if (PySequence_Check(pymat))
{
- unsigned int cols = PySequence_Size(pymat);
- if (cols != Size(mat))
+ unsigned int rows = PySequence_Size(pymat);
+ if (rows != Size(mat))
return false;
- for (unsigned int x = 0; noerror && x < cols; x++)
+ for (unsigned int row = 0; noerror && row < rows; row++)
{
- PyObject *pycol = PySequence_GetItem(pymat, x); /* new ref */
- if (!PyErr_Occurred() && PySequence_Check(pycol))
+ PyObject *pyrow = PySequence_GetItem(pymat, row); /* new ref */
+ if (!PyErr_Occurred() && PySequence_Check(pyrow))
{
- unsigned int rows = PySequence_Size(pycol);
- if (rows != Size(mat))
+ unsigned int cols = PySequence_Size(pyrow);
+ if (cols != Size(mat))
noerror = false;
else
{
- for( unsigned int y = 0; y < rows; y++)
+ for( unsigned int col = 0; col < cols; col++)
{
- PyObject *item = PySequence_GetItem(pycol, y); /* new ref */
- mat[y][x] = PyFloat_AsDouble(item);
+ PyObject *item = PySequence_GetItem(pyrow, col); /* new ref */
+ mat[row][col] = PyFloat_AsDouble(item);
Py_DECREF(item);
}
}
} else
noerror = false;
- Py_DECREF(pycol);
+ Py_DECREF(pyrow);
}
} else
noerror = false;
diff --git a/source/tests/bl_pyapi_mathutils.py b/source/tests/bl_pyapi_mathutils.py
index f1d6d96c68b..b2e9f27d9ec 100644
--- a/source/tests/bl_pyapi_mathutils.py
+++ b/source/tests/bl_pyapi_mathutils.py
@@ -27,9 +27,9 @@ class MatrixTesting(unittest.TestCase):
mat = Matrix(args)
- for i in range(4):
- for j in range(4):
- self.assertEqual(mat[i][j], args[i][j])
+ for row in range(4):
+ for col in range(4):
+ self.assertEqual(mat[row][col], args[row][col])
self.assertEqual(mat[0][2], 0)
self.assertEqual(mat[3][1], 9)
@@ -41,13 +41,13 @@ class MatrixTesting(unittest.TestCase):
mat = Matrix() - Matrix()
indices = (0, 0), (1, 3), (2, 0), (3, 2), (3, 1)
checked_indices = []
- for col, row in indices:
- mat[col][row] = 1
+ for row, col in indices:
+ mat[row][col] = 1
- for col in range(4):
- for row in range(4):
- if mat[col][row]:
- checked_indices.append((col, row))
+ for row in range(4):
+ for col in range(4):
+ if mat[row][col]:
+ checked_indices.append((row, col))
for item in checked_indices:
self.assertIn(item, indices)
@@ -64,9 +64,63 @@ class MatrixTesting(unittest.TestCase):
def test_matrix_to_translation(self):
mat = Matrix()
- mat[3] = (1, 2, 3, 4)
+ mat[0][3] = 1
+ mat[1][3] = 2
+ mat[2][3] = 3
self.assertEqual(mat.to_translation(), Vector((1, 2, 3)))
+ def test_matrix_translation(self):
+ mat = Matrix()
+ mat.translation = Vector((1, 2, 3))
+ self.assertEqual(mat[0][3], 1)
+ self.assertEqual(mat[1][3], 2)
+ self.assertEqual(mat[2][3], 3)
+
+ def test_non_square_mult(self):
+ mat1 = Matrix(((1, 2, 3),
+ (4, 5, 6)))
+ mat2 = Matrix(((1, 2),
+ (3, 4),
+ (5, 6)))
+
+ prod_mat1 = Matrix(((22, 28),
+ (49, 64)))
+ prod_mat2 = Matrix(((9, 12, 15),
+ (19, 26, 33),
+ (29, 40, 51)))
+
+ self.assertEqual(mat1*mat2, prod_mat1)
+ self.assertEqual(mat2 * mat1, prod_mat2)
+
+ def test_mat4x4_vec3D_mult(self):
+ mat = Matrix(((1, 0, 2, 0),
+ (0, 6, 0, 0),
+ (0, 0, 1, 1),
+ (0, 0, 0, 1)))
+
+ vec = Vector((1, 2, 3))
+
+ prod_mat_vec = Vector((7, 12, 4))
+ prod_vec_mat = Vector((1, 12, 5))
+
+ self.assertEqual(mat * vec, prod_mat_vec)
+ self.assertEqual(vec * mat, prod_vec_mat)
+
+ def test_mat_vec_mult(self):
+ mat1 = Matrix()
+
+ vec = Vector((1, 2))
+
+ self.assertRaises(TypeError, mat1.__mul__, vec)
+ self.assertRaises(ValueError, vec.__mul__, mat1) # Why are these different?!
+
+ mat2 = Matrix(((1, 2),
+ (-2, 3)))
+
+ prod = Vector((5, 4))
+
+ self.assertEqual(mat2 * vec, prod)
+
def test_matrix_inverse(self):
mat = Matrix(((1, 4, 0, -1),
(2, -1, 2, -2),