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:
authorDaniel Genrich <daniel.genrich@gmx.net>2012-07-22 03:23:56 +0400
committerDaniel Genrich <daniel.genrich@gmx.net>2012-07-22 03:23:56 +0400
commitd0608872b7f8f02bf0066fc2da90e9d90ded34fa (patch)
treed6897d7e97f46af1e909f83ff0a0eeb4d39a675e
parent7f28ddfa8a2d77ee4941ab677f16a2dfcd24566a (diff)
parent9b515033071b40e982ef647ee225e8afc377e0c9 (diff)
Merge from trunk r48769-r49109
-rw-r--r--build_files/cmake/config/blender_lite.cmake1
-rw-r--r--build_files/cmake/macros.cmake19
-rw-r--r--doc/manpage/blender.154
-rw-r--r--intern/boolop/intern/BOP_CarveInterface.cpp78
-rw-r--r--intern/bsp/intern/BSP_CSGMesh.cpp2
-rw-r--r--intern/cycles/kernel/kernel_differential.h2
-rw-r--r--intern/cycles/render/graph.cpp5
-rw-r--r--intern/cycles/subd/subd_build.cpp4
-rw-r--r--intern/cycles/util/util_cache.cpp4
-rw-r--r--intern/cycles/util/util_path.cpp4
-rw-r--r--intern/decimation/intern/LOD_QuadricEditor.cpp4
-rw-r--r--intern/dualcon/intern/octree.cpp2
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerX11.cpp28
-rw-r--r--intern/ghost/intern/GHOST_DropTargetX11.cpp18
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsX11.cpp8
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp307
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h4
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm6
-rw-r--r--intern/ghost/intern/GHOST_WindowNULL.h4
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp130
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h2
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h54
-rw-r--r--intern/guardedalloc/intern/mallocn.c11
-rw-r--r--intern/itasc/Scene.cpp2
-rw-r--r--intern/memutil/MEM_CacheLimiter.h155
-rw-r--r--intern/memutil/MEM_CacheLimiterC-Api.h97
-rw-r--r--intern/memutil/intern/MEM_CacheLimiterC-Api.cpp91
-rw-r--r--intern/raskter/CMakeLists.txt3
-rw-r--r--intern/raskter/raskter.c2722
-rw-r--r--intern/raskter/raskter.h61
-rw-r--r--intern/raskter/raskter_kdtree.c836
-rw-r--r--intern/raskter/raskter_kdtree.h129
-rw-r--r--intern/raskter/raskter_mt.c290
-rwxr-xr-xrelease/scripts/modules/bl_i18n_utils/merge_po.py5
-rw-r--r--release/scripts/modules/bpy/path.py4
-rw-r--r--release/scripts/startup/bl_operators/wm.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_data_mesh.py1
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py40
-rw-r--r--release/scripts/startup/bl_ui/space_info.py2
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py11
-rw-r--r--release/text/readme.html10
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h2
-rw-r--r--source/blender/blenkernel/BKE_mask.h37
-rw-r--r--source/blender/blenkernel/BKE_mesh.h3
-rw-r--r--source/blender/blenkernel/BKE_node.h1
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/CMakeLists.txt1
-rw-r--r--source/blender/blenkernel/intern/action.c4
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c8
-rw-r--r--source/blender/blenkernel/intern/collision.c12
-rw-r--r--source/blender/blenkernel/intern/colortools.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c10
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c10
-rw-r--r--source/blender/blenkernel/intern/displist.c10
-rw-r--r--source/blender/blenkernel/intern/effect.c3
-rw-r--r--source/blender/blenkernel/intern/fcurve.c4
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c2
-rw-r--r--source/blender/blenkernel/intern/group.c2
-rw-r--r--source/blender/blenkernel/intern/implicit.c4
-rw-r--r--source/blender/blenkernel/intern/lattice.c3
-rw-r--r--source/blender/blenkernel/intern/mask.c471
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c1289
-rw-r--r--source/blender/blenkernel/intern/mball.c2
-rw-r--r--source/blender/blenkernel/intern/mesh.c17
-rw-r--r--source/blender/blenkernel/intern/movieclip.c44
-rw-r--r--source/blender/blenkernel/intern/multires.c49
-rw-r--r--source/blender/blenkernel/intern/node.c14
-rw-r--r--source/blender/blenkernel/intern/object.c42
-rw-r--r--source/blender/blenkernel/intern/particle.c6
-rw-r--r--source/blender/blenkernel/intern/particle_system.c42
-rw-r--r--source/blender/blenkernel/intern/pointcache.c5
-rw-r--r--source/blender/blenkernel/intern/scene.c2
-rw-r--r--source/blender/blenkernel/intern/seqcache.c6
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c4
-rw-r--r--source/blender/blenkernel/intern/sequencer.c2
-rw-r--r--source/blender/blenkernel/intern/softbody.c11
-rw-r--r--source/blender/blenkernel/intern/writeframeserver.c2
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h2
-rw-r--r--source/blender/blenlib/BLI_math_geom.h12
-rw-r--r--source/blender/blenlib/BLI_memarena.h39
-rw-r--r--source/blender/blenlib/BLI_mempool.h64
-rw-r--r--source/blender/blenlib/BLI_rect.h55
-rw-r--r--source/blender/blenlib/BLI_scanfill.h8
-rw-r--r--source/blender/blenlib/BLI_string.h2
-rw-r--r--source/blender/blenlib/BLI_threads.h9
-rw-r--r--source/blender/blenlib/BLI_utildefines.h4
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c12
-rw-r--r--source/blender/blenlib/intern/DLRB_tree.c2
-rw-r--r--source/blender/blenlib/intern/freetypefont.c3
-rw-r--r--source/blender/blenlib/intern/lasso.c2
-rw-r--r--source/blender/blenlib/intern/math_geom.c225
-rw-r--r--source/blender/blenlib/intern/math_matrix.c2
-rw-r--r--source/blender/blenlib/intern/math_rotation.c50
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c2
-rw-r--r--source/blender/blenlib/intern/noise.c8
-rw-r--r--source/blender/blenlib/intern/path_util.c2
-rw-r--r--source/blender/blenlib/intern/rct.c109
-rw-r--r--source/blender/blenlib/intern/string.c4
-rw-r--r--source/blender/blenlib/intern/threads.c10
-rw-r--r--source/blender/blenlib/intern/voronoi.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c81
-rw-r--r--source/blender/bmesh/bmesh_class.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.c13
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.h1
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c62
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h36
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c34
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c10
-rw-r--r--source/blender/bmesh/intern/bmesh_structure.h2
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c8
-rw-r--r--source/blender/bmesh/operators/bmo_create.c6
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c8
-rw-r--r--source/blender/bmesh/operators/bmo_dupe.c18
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c15
-rw-r--r--source/blender/bmesh/operators/bmo_hull.c2
-rw-r--r--source/blender/bmesh/operators/bmo_inset.c2
-rw-r--r--source/blender/bmesh/operators/bmo_mesh_conv.c4
-rw-r--r--source/blender/bmesh/operators/bmo_mirror.c10
-rw-r--r--source/blender/bmesh/operators/bmo_primitive.c22
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c16
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c2
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c2
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c12
-rw-r--r--source/blender/bmesh/tools/BME_bevel.c2
-rw-r--r--source/blender/collada/AnimationImporter.cpp2
-rw-r--r--source/blender/collada/GeometryExporter.cpp2
-rw-r--r--source/blender/collada/ImageExporter.cpp10
-rw-r--r--source/blender/compositor/CMakeLists.txt5
-rw-r--r--source/blender/compositor/COM_compositor.h43
-rw-r--r--source/blender/compositor/SConscript2
-rw-r--r--source/blender/compositor/intern/COM_CPUDevice.cpp5
-rw-r--r--source/blender/compositor/intern/COM_Converter.cpp4
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cpp23
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.h4
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp7
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.h4
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp63
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.h78
-rw-r--r--source/blender/compositor/intern/COM_MemoryProxy.h2
-rw-r--r--source/blender/compositor/intern/COM_Node.h2
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.cpp2
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h4
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.cpp9
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.h6
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp8
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedNodeOperation.h6
-rw-r--r--source/blender/compositor/intern/COM_SocketReader.h24
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp50
-rw-r--r--source/blender/compositor/nodes/COM_BlurNode.cpp40
-rw-r--r--source/blender/compositor/nodes/COM_BokehBlurNode.cpp46
-rw-r--r--source/blender/compositor/nodes/COM_DefocusNode.cpp4
-rw-r--r--source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_KeyingNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_KeyingNode.h3
-rw-r--r--source/blender/compositor/nodes/COM_MathNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_MixNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_MovieClipNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_TrackPositionNode.cpp68
-rw-r--r--source/blender/compositor/nodes/COM_TrackPositionNode.h36
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverKeyOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverMixedOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_AntiAliasOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_AntiAliasOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_BilateralBlurOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_BilateralBlurOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.cpp68
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_BokehImageOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_BokehImageOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_BoxMaskOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_BoxMaskOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_BrightnessOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_BrightnessOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_CalculateMeanOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_CalculateMeanOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_ChangeHSVOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ChangeHSVOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ChannelMatteOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ChannelMatteOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ChromaMatteOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ChromaMatteOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorCorrectionOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ColorCurveOperation.cpp16
-rw-r--r--source/blender/compositor/operations/COM_ColorCurveOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_ColorMatteOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorMatteOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ColorRampOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ColorRampOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ColorSpillOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorSpillOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_CombineChannelsOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_CombineChannelsOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorProfileOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorToBWOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorToValueProg.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertValueToColorProg.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp22
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp22
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionFilterOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_DifferenceMatteOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.cpp26
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.h16
-rw-r--r--source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp37
-rw-r--r--source/blender/compositor/operations/COM_DirectionalBlurOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_DisplaceOperation.cpp16
-rw-r--r--source/blender/compositor/operations/COM_DisplaceOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_DisplaceSimpleOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_DistanceMatteOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_DistanceMatteOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_DotproductOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_DotproductOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp16
-rw-r--r--source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_EllipseMaskOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_EllipseMaskOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_FlipOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_FlipOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_GammaCorrectOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_GammaCorrectOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_GammaOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GammaOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp174
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h34
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp36
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp35
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GlareBaseOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_GlareBaseOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_GlareThresholdOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_GlareThresholdOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_IDMaskOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_IDMaskOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ImageOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ImageOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_InvertOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_InvertOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_KeyingBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_KeyingBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_KeyingClipOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_KeyingClipOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_KeyingDespillOperation.cpp19
-rw-r--r--source/blender/compositor/operations/COM_KeyingDespillOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_KeyingOperation.cpp17
-rw-r--r--source/blender/compositor/operations/COM_KeyingOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_KeyingScreenOperation.cpp45
-rw-r--r--source/blender/compositor/operations/COM_KeyingScreenOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_LuminanceMatteOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.cpp22
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MapValueOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_MapValueOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.cpp72
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.h24
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp143
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.h42
-rw-r--r--source/blender/compositor/operations/COM_MixAddOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixAddOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixBaseOperation.cpp13
-rw-r--r--source/blender/compositor/operations/COM_MixBaseOperation.h15
-rw-r--r--source/blender/compositor/operations/COM_MixBlendOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixBlendOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixBurnOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixBurnOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixColorOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixColorOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixDarkenOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixDarkenOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixDifferenceOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixDifferenceOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixDivideOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixDivideOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixDodgeOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixDodgeOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixGlareOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixGlareOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixHueOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixHueOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixLightenOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixLightenOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixLinearLightOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixLinearLightOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixMultiplyOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixMultiplyOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixOverlayOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixOverlayOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixSaturationOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixSaturationOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixScreenOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixScreenOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixSoftLightOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_MixSoftLightOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixSubtractOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixSubtractOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MixValueOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixValueOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_MovieClipAttributeOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MovieClipOperation.cpp13
-rw-r--r--source/blender/compositor/operations/COM_MovieClipOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_MovieDistortionOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MovieDistortionOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_MultilayerImageOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MultilayerImageOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_NormalizeOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_NormalizeOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_OpenCLKernels.cl94
-rw-r--r--source/blender/compositor/operations/COM_OpenCLKernels.cl.h90
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.cpp42
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersAlphaProg.h2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersBaseProg.h2
-rw-r--r--source/blender/compositor/operations/COM_RotateOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_RotateOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.cpp30
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SeparateChannelOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_SeparateChannelOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_SetAlphaOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_SetAlphaOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_SetColorOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_SetColorOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_SetSamplerOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_SetSamplerOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_SetValueOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_SetValueOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_SetVectorOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_SetVectorOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_SplitViewerOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_SplitViewerOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_TonemapOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_TonemapOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_TrackPositionOperation.cpp100
-rw-r--r--source/blender/compositor/operations/COM_TrackPositionOperation.h69
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp174
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h23
-rw-r--r--source/blender/compositor/operations/COM_VectorBlurOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_VectorBlurOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_VectorCurveOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_VectorCurveOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ViewerBaseOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.cpp15
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_ZCombineOperation.cpp24
-rw-r--r--source/blender/compositor/operations/COM_ZCombineOperation.h4
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c54
-rw-r--r--source/blender/editors/animation/anim_deps.c6
-rw-r--r--source/blender/editors/animation/anim_filter.c59
-rw-r--r--source/blender/editors/animation/anim_intern.h1
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c4
-rw-r--r--source/blender/editors/animation/anim_markers.c8
-rw-r--r--source/blender/editors/animation/anim_ops.c1
-rw-r--r--source/blender/editors/animation/keyframes_draw.c21
-rw-r--r--source/blender/editors/animation/keyframes_edit.c2
-rw-r--r--source/blender/editors/animation/keyframing.c157
-rw-r--r--source/blender/editors/armature/editarmature.c2
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c8
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c10
-rw-r--r--source/blender/editors/armature/poseobject.c2
-rw-r--r--source/blender/editors/armature/reeb.c13
-rw-r--r--source/blender/editors/curve/editcurve.c2
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c2
-rw-r--r--source/blender/editors/include/ED_mesh.h4
-rw-r--r--source/blender/editors/include/ED_numinput.h1
-rw-r--r--source/blender/editors/include/ED_object.h3
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/include/UI_view2d.h4
-rw-r--r--source/blender/editors/interface/interface.c43
-rw-r--r--source/blender/editors/interface/interface_anim.c7
-rw-r--r--source/blender/editors/interface/interface_draw.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c118
-rw-r--r--source/blender/editors/interface/interface_icons.c9
-rw-r--r--source/blender/editors/interface/interface_intern.h1
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c4
-rw-r--r--source/blender/editors/interface/resources.c6
-rw-r--r--source/blender/editors/interface/view2d.c2
-rw-r--r--source/blender/editors/interface/view2d_ops.c16
-rw-r--r--source/blender/editors/mask/mask_draw.c3
-rw-r--r--source/blender/editors/mask/mask_edit.c3
-rw-r--r--source/blender/editors/mask/mask_intern.h2
-rw-r--r--source/blender/editors/mask/mask_ops.c79
-rw-r--r--source/blender/editors/mask/mask_select.c2
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c6
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c1
-rw-r--r--source/blender/editors/mesh/editmesh_select.c17
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c433
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c18
-rw-r--r--source/blender/editors/mesh/meshtools.c4
-rw-r--r--source/blender/editors/object/object_add.c7
-rw-r--r--source/blender/editors/object/object_group.c160
-rw-r--r--source/blender/editors/object/object_lattice.c4
-rw-r--r--source/blender/editors/object/object_relations.c139
-rw-r--r--source/blender/editors/object/object_vgroup.c8
-rw-r--r--source/blender/editors/physics/physics_fluid.c2
-rw-r--r--source/blender/editors/screen/area.c30
-rw-r--r--source/blender/editors/screen/screen_edit.c8
-rw-r--r--source/blender/editors/screen/screen_intern.h2
-rw-r--r--source/blender/editors/screen/screen_ops.c12
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c42
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c21
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/space_clip/clip_ops.c26
-rw-r--r--source/blender/editors/space_clip/space_clip.c20
-rw-r--r--source/blender/editors/space_clip/tracking_select.c2
-rw-r--r--source/blender/editors/space_file/file_ops.c6
-rw-r--r--source/blender/editors/space_image/image_buttons.c30
-rw-r--r--source/blender/editors/space_image/image_draw.c17
-rw-r--r--source/blender/editors/space_node/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_node/SConscript5
-rw-r--r--source/blender/editors/space_node/drawnode.c206
-rw-r--r--source/blender/editors/space_node/node_draw.c52
-rw-r--r--source/blender/editors/space_node/node_edit.c58
-rw-r--r--source/blender/editors/space_node/node_intern.h2
-rw-r--r--source/blender/editors/space_node/node_select.c2
-rw-r--r--source/blender/editors/space_node/node_state.c2
-rw-r--r--source/blender/editors/space_node/space_node.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c2
-rw-r--r--source/blender/editors/space_text/text_ops.c7
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c19
-rw-r--r--source/blender/editors/space_view3d/drawobject.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c90
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c2
-rw-r--r--source/blender/editors/transform/transform.c170
-rw-r--r--source/blender/editors/transform/transform_constraints.c8
-rw-r--r--source/blender/editors/transform/transform_conversions.c2
-rw-r--r--source/blender/editors/transform/transform_generics.c15
-rw-r--r--source/blender/editors/transform/transform_manipulator.c6
-rw-r--r--source/blender/editors/transform/transform_orientations.c5
-rw-r--r--source/blender/editors/transform/transform_snap.c22
-rw-r--r--source/blender/editors/util/numinput.c17
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c16
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c2
-rw-r--r--source/blender/gpu/intern/gpu_draw.c5
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp2
-rw-r--r--source/blender/imbuf/IMB_moviecache.h13
-rw-r--r--source/blender/imbuf/intern/imageprocess.c6
-rw-r--r--source/blender/imbuf/intern/jp2.c2
-rw-r--r--source/blender/imbuf/intern/jpeg.c4
-rw-r--r--source/blender/imbuf/intern/moviecache.c117
-rw-r--r--source/blender/imbuf/intern/scaling.c4
-rw-r--r--source/blender/makesdna/DNA_anim_types.h2
-rw-r--r--source/blender/makesdna/DNA_mask_types.h16
-rw-r--r--source/blender/makesdna/DNA_node_types.h14
-rw-r--r--source/blender/makesdna/DNA_texture_types.h2
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c6
-rw-r--r--source/blender/makesrna/RNA_enum_types.h2
-rw-r--r--source/blender/makesrna/RNA_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c2
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c4
-rw-r--r--source/blender/makesrna/intern/rna_mask.c23
-rw-r--r--source/blender/makesrna/intern/rna_nla.c41
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c53
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c13
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c20
-rw-r--r--source/blender/makesrna/intern/rna_texture.c14
-rw-r--r--source/blender/modifiers/intern/MOD_array.c21
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c3
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c6
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c5
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c4
-rw-r--r--source/blender/modifiers/intern/MOD_skin.c51
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c2
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c2
-rw-r--r--source/blender/nodes/CMakeLists.txt1
-rw-r--r--source/blender/nodes/NOD_composite.h2
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c4
-rw-r--r--source/blender/nodes/composite/node_composite_util.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keying.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_trackpos.c65
-rw-r--r--source/blender/nodes/shader/node_shader_util.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops.c3
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c4
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_select.c2
-rw-r--r--source/blender/python/generic/bpy_internal_import.c11
-rw-r--r--source/blender/python/generic/bpy_internal_import.h3
-rw-r--r--source/blender/python/generic/idprop_py_api.c2
-rw-r--r--source/blender/python/generic/py_capi_utils.c17
-rw-r--r--source/blender/python/generic/py_capi_utils.h3
-rw-r--r--source/blender/python/intern/bpy_operator.c2
-rw-r--r--source/blender/python/intern/bpy_props.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c2
-rw-r--r--source/blender/python/intern/bpy_rna_array.c2
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c2
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c2
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c4
-rw-r--r--source/blender/python/mathutils/mathutils_noise.c4
-rw-r--r--source/blender/quicktime/apple/qtkit_export.m4
-rw-r--r--source/blender/quicktime/apple/qtkit_import.m2
-rw-r--r--source/blender/quicktime/apple/quicktime_import.c2
-rw-r--r--source/blender/render/intern/include/zbuf.h4
-rw-r--r--source/blender/render/intern/raytrace/reorganize.h2
-rw-r--r--source/blender/render/intern/source/convertblender.c14
-rw-r--r--source/blender/render/intern/source/imagetexture.c2
-rw-r--r--source/blender/render/intern/source/initrender.c2
-rw-r--r--source/blender/render/intern/source/rayshade.c2
-rw-r--r--source/blender/render/intern/source/render_texture.c8
-rw-r--r--source/blender/render/intern/source/renderdatabase.c10
-rw-r--r--source/blender/render/intern/source/shadbuf.c8
-rw-r--r--source/blender/render/intern/source/strand.c4
-rw-r--r--source/blender/render/intern/source/sunsky.c2
-rw-r--r--source/blender/render/intern/source/volumetric.c2
-rw-r--r--source/blender/render/intern/source/zbuf.c8
-rw-r--r--source/blender/windowmanager/CMakeLists.txt4
-rw-r--r--source/blender/windowmanager/SConscript3
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c42
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c2
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c12
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c4
-rw-r--r--source/creator/CMakeLists.txt6
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp7
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp3
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp2
-rw-r--r--source/gameengine/Converter/BL_ArmatureChannel.cpp4
-rw-r--r--source/gameengine/Converter/BL_ArmatureConstraint.cpp10
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp53
-rw-r--r--source/gameengine/Converter/BL_MeshDeformer.h10
-rw-r--r--source/gameengine/Converter/KX_ConvertActuators.cpp10
-rw-r--r--source/gameengine/Converter/KX_ConvertSensors.cpp8
-rw-r--r--source/gameengine/Expressions/ListValue.h2
-rw-r--r--source/gameengine/Expressions/VoidValue.h17
-rw-r--r--source/gameengine/GameLogic/SCA_IObject.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.h2
-rw-r--r--source/gameengine/GamePlayer/common/GPC_Canvas.h2
-rw-r--r--source/gameengine/Ketsji/BL_Texture.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp28
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h2
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp32
-rw-r--r--source/gameengine/Ketsji/KX_GameActuator.h52
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp13
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h32
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp65
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h52
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp67
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.h52
-rw-r--r--source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h52
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp57
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h52
-rw-r--r--source/gameengine/Ketsji/KX_SceneActuator.h52
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.cpp116
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.h52
-rw-r--r--source/gameengine/Ketsji/KX_WorldInfo.h2
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp9
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h6
-rw-r--r--source/gameengine/Rasterizer/RAS_2DFilterManager.cpp13
-rw-r--r--source/gameengine/Rasterizer/RAS_Deformer.h4
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.h4
-rw-r--r--source/gameengine/Rasterizer/RAS_IRasterizer.h8
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_MeshObject.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp9
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h4
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h4
-rw-r--r--source/gameengine/SceneGraph/SG_BBox.cpp12
-rw-r--r--source/gameengine/SceneGraph/SG_Spatial.cpp6
-rw-r--r--source/gameengine/SceneGraph/SG_Tree.cpp3
-rw-r--r--source/gameengine/VideoTexture/ImageBase.cpp3
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp25
-rw-r--r--source/gameengine/VideoTexture/Texture.cpp7
-rw-r--r--source/gameengine/VideoTexture/VideoBase.h2
658 files changed, 10987 insertions, 4869 deletions
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index e2adc17a2e8..777fbbf0dba 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -17,6 +17,7 @@ set(WITH_FFTW3 OFF CACHE FORCE BOOL)
set(WITH_LIBMV OFF CACHE FORCE BOOL)
set(WITH_CARVE OFF CACHE FORCE BOOL)
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
+set(WITH_COMPOSITOR OFF CACHE FORCE BOOL)
set(WITH_GHOST_XDND OFF CACHE FORCE BOOL)
set(WITH_IK_ITASC OFF CACHE FORCE BOOL)
set(WITH_IMAGE_CINEON OFF CACHE FORCE BOOL)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 3608f41e369..bceeb5acc86 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -23,6 +23,25 @@
#
# ***** END GPL LICENSE BLOCK *****
+macro(list_insert_after
+ list_id item_check item_add
+ )
+ set(_index)
+ list(FIND ${list_id} "${item_check}" _index)
+ math(EXPR _index "${_index} + 1")
+ list(INSERT ${list_id} "${_index}" ${item_add})
+ unset(_index)
+endmacro()
+
+macro(list_insert_before
+ list_id item_check item_add
+ )
+ set(_index)
+ list(FIND ${list_id} "${item_check}" _index)
+ list(INSERT ${list_id} "${_index}" ${item_add})
+ unset(_index)
+endmacro()
+
# foo_bar.spam --> foo_barMySuffix.spam
macro(file_suffix
file_name_new file_name file_suffix
diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1
index 6257a78171b..c7a762f08c7 100644
--- a/doc/manpage/blender.1
+++ b/doc/manpage/blender.1
@@ -1,13 +1,4 @@
-.TH "BLENDER" "1" "April 26, 2012" "Blender Blender 2\&.63 (sub 0)
- build date: 2012-04-26
- build time: 19:38:31
- build revision: 45987
- build platform: Linux
- build type: Debug
- build c flags: -fopenmp -msse2 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wall -Wcast-align -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type -Wstrict-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings
- build c++ flags: -D__STDC_CONSTANT_MACROS -fopenmp -msse2 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wall -Wno-invalid-offsetof -Wno-sign-compare
- build link flags: -pthread
- build system: CMake"
+.TH "BLENDER" "1" "July 19, 2012" "Blender Blender 2\&.63 (sub 14)"
.SH NAME
blender \- a 3D modelling and rendering package
@@ -24,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business
http://www.blender.org
.SH OPTIONS
-Blender 2.63 (sub 0)
+Blender 2.63 (sub 14)
Usage: blender [args ...] [file] [args ...]
.br
.SS "Render Options:"
@@ -223,18 +214,6 @@ Turn debugging on
Enable floating point exceptions
.br
-.TP
-.B \-\-debug\-ffmpeg
-.br
-Enable debug messages from FFmpeg library
-.br
-
-.TP
-.B \-\-debug\-libmv
-.br
-Enable debug messages from libmv library
-.br
-
.IP
.TP
@@ -258,12 +237,6 @@ Set the BLENDER_SYSTEM_SCRIPTS environment variable
.br
.TP
-.B \-\-env\-system\-plugins
-.br
-Set the BLENDER_SYSTEM_PLUGINS environment variable
-.br
-
-.TP
.B \-\-env\-system\-python
.br
Set the BLENDER_SYSTEM_PYTHON environment variable
@@ -316,7 +289,7 @@ Enable automatic python script execution, (default)
.TP
.B \-Y or \-\-disable\-autoexec
.br
-Disable automatic python script execution (pydrivers, pyconstraints, pynodes)
+Disable automatic python script execution (pydrivers & startup scripts)
.br
.IP
@@ -384,6 +357,26 @@ Enable all debug messages (excludes libmv)
.br
.TP
+.B \-\-debug\-value <value>
+.br
+Set debug value of <value> on startup
+.br
+
+.IP
+
+.TP
+.B \-\-debug\-jobs
+.br
+Enable time profiling for background jobs.
+.br
+
+.TP
+.B \-\-verbose <verbose>
+.br
+Set logging verbosity level.
+.br
+
+.TP
.B \-R
.br
Register .blend extension, then exit (Windows only)
@@ -421,7 +414,6 @@ Arguments are executed in the order they are given. eg
\fIBLENDER_SYSTEM_DATAFILES\fR Directory for system wide data files.
\fIBLENDER_SYSTEM_PYTHON\fR Directory for system python libraries.
\fITMP\fR or \fITMPDIR\fR Store temporary files here.
- \fISDL_AUDIODRIVER\fR LibSDL audio driver \- alsa, esd, dma.
\fIPYTHONHOME\fR Path to the python directory, eg. /usr/lib/python.
.br
.br
diff --git a/intern/boolop/intern/BOP_CarveInterface.cpp b/intern/boolop/intern/BOP_CarveInterface.cpp
index ff7244ea84b..4b3bda113fd 100644
--- a/intern/boolop/intern/BOP_CarveInterface.cpp
+++ b/intern/boolop/intern/BOP_CarveInterface.cpp
@@ -547,13 +547,32 @@ static uint quadMerge(std::map<MeshSet<3>::vertex_t*, uint> *vertexToIndex_map,
return 0;
}
-static bool Carve_checkDegeneratedFace(MeshSet<3>::face_t *face)
+static bool Carve_checkDegeneratedFace(std::map<MeshSet<3>::vertex_t*, uint> *vertexToIndex_map, MeshSet<3>::face_t *face)
{
/* only tris and quads for now */
if (face->n_edges == 3) {
+ uint v1, v2, v3;
+
+ v1 = vertexToIndex_map->find(face->edge->prev->vert)->second;
+ v2 = vertexToIndex_map->find(face->edge->vert)->second;
+ v3 = vertexToIndex_map->find(face->edge->next->vert)->second;
+
+ if (v1 == v2 || v2 == v3 || v1 == v3)
+ return true;
+
return triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->vert->v) < DBL_EPSILON;
}
else if (face->n_edges == 4) {
+ uint v1, v2, v3, v4;
+
+ v1 = vertexToIndex_map->find(face->edge->prev->vert)->second;
+ v2 = vertexToIndex_map->find(face->edge->vert)->second;
+ v3 = vertexToIndex_map->find(face->edge->next->vert)->second;
+ v4 = vertexToIndex_map->find(face->edge->next->next->vert)->second;
+
+ if (v1 == v2 || v1 == v3 || v1 == v4 || v2 == v3 || v2 == v4 || v3 == v4)
+ return true;
+
return triangleArea(face->edge->vert->v, face->edge->next->vert->v, face->edge->next->next->vert->v) +
triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->next->vert->v) < DBL_EPSILON;
}
@@ -595,8 +614,14 @@ static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::Face
MeshSet<3>::face_iter face_iter = poly->faceBegin();
for (i = 0; face_iter != poly->faceEnd(); ++face_iter, ++i) {
MeshSet<3>::face_t *f = *face_iter;
+
+ if (Carve_checkDegeneratedFace(&vertexToIndex_map, f))
+ continue;
+
ofaces[oface_num.getAttribute(f)].push_back(i);
+
MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
+
for (; edge_iter != f->end(); ++edge_iter) {
int index = vertexToIndex_map[edge_iter->vert];
vi[index].push_back(i);
@@ -659,36 +684,27 @@ static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::Face
}
}
- bool degenerativeFace = false;
-
- if (!result) {
- /* merged triangles are already checked for degenerative quad */
- degenerativeFace = Carve_checkDegeneratedFace(f);
- }
-
- if (!degenerativeFace) {
- // add all information except vertices to the output mesh
- outputMesh->FaceSet().push_back(BSP_MFace());
- BSP_MFace& outFace = outputMesh->FaceSet().back();
- outFace.m_verts.clear();
- outFace.m_plane.setValue(f->plane.N.v);
- outFace.m_orig_face = orig;
-
- // if we merged faces, use the list of common vertices; otherwise
- // use the faces's vertices
- if (result) {
- // make quat using verts stored in result
- outFace.m_verts.push_back(quadverts[0]);
- outFace.m_verts.push_back(quadverts[1]);
- outFace.m_verts.push_back(quadverts[2]);
- outFace.m_verts.push_back(quadverts[3]);
- } else {
- MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
- for (; edge_iter != f->end(); ++edge_iter) {
- //int index = ofacevert_num.getAttribute(f, edge_iter.idx());
- int index = vertexToIndex_map[edge_iter->vert];
- outFace.m_verts.push_back( index );
- }
+ // add all information except vertices to the output mesh
+ outputMesh->FaceSet().push_back(BSP_MFace());
+ BSP_MFace& outFace = outputMesh->FaceSet().back();
+ outFace.m_verts.clear();
+ outFace.m_plane.setValue(f->plane.N.v);
+ outFace.m_orig_face = orig;
+
+ // if we merged faces, use the list of common vertices; otherwise
+ // use the faces's vertices
+ if (result) {
+ // make quat using verts stored in result
+ outFace.m_verts.push_back(quadverts[0]);
+ outFace.m_verts.push_back(quadverts[1]);
+ outFace.m_verts.push_back(quadverts[2]);
+ outFace.m_verts.push_back(quadverts[3]);
+ } else {
+ MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
+ for (; edge_iter != f->end(); ++edge_iter) {
+ //int index = ofacevert_num.getAttribute(f, edge_iter.idx());
+ int index = vertexToIndex_map[edge_iter->vert];
+ outFace.m_verts.push_back( index );
}
}
}
diff --git a/intern/bsp/intern/BSP_CSGMesh.cpp b/intern/bsp/intern/BSP_CSGMesh.cpp
index 82919688a38..4dda7741f67 100644
--- a/intern/bsp/intern/BSP_CSGMesh.cpp
+++ b/intern/bsp/intern/BSP_CSGMesh.cpp
@@ -486,7 +486,7 @@ VertexFaces(
BSP_MEdge &e = edges[*e_it];
// iterate through the faces of this edge - push unselected
- // edges to ouput and then select the edge
+ // edges to output and then select the edge
vector<BSP_FaceInd>::const_iterator e_faces_end = e.m_faces.end();
vector<BSP_FaceInd>::iterator e_faces_it = e.m_faces.begin();
diff --git a/intern/cycles/kernel/kernel_differential.h b/intern/cycles/kernel/kernel_differential.h
index 04027523ea5..2190e04e231 100644
--- a/intern/cycles/kernel/kernel_differential.h
+++ b/intern/cycles/kernel/kernel_differential.h
@@ -22,7 +22,7 @@ CCL_NAMESPACE_BEGIN
__device void differential_transfer(differential3 *dP_, const differential3 dP, float3 D, const differential3 dD, float3 Ng, float t)
{
- /* ray differential transfer through homogenous medium, to
+ /* ray differential transfer through homogeneous medium, to
* compute dPdx/dy at a shading point from the incoming ray */
float3 tmp = D/dot(D, Ng);
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 34c8879aa1f..18e802b610d 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -187,7 +187,10 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
if(from->type != to->type) {
/* for closures we can't do automatic conversion */
if(from->type == SHADER_SOCKET_CLOSURE || to->type == SHADER_SOCKET_CLOSURE) {
- fprintf(stderr, "ShaderGraph connect: can only connect closure to closure.\n");
+ fprintf(stderr, "ShaderGraph connect: can only connect closure to closure "
+ "(ShaderNode:%s, ShaderOutput:%s , type:%d -> to ShaderNode:%s, ShaderInput:%s, type:%d).\n",
+ from->parent->name.c_str(), from->name, (int)from->type,
+ to->parent->name.c_str(), to->name, (int)to->type);
return;
}
diff --git a/intern/cycles/subd/subd_build.cpp b/intern/cycles/subd/subd_build.cpp
index c8181838ec3..312980f1fa2 100644
--- a/intern/cycles/subd/subd_build.cpp
+++ b/intern/cycles/subd/subd_build.cpp
@@ -117,7 +117,7 @@ Patch *SubdAccBuilder::run(SubdFace *face)
memcpy(patch->hull, position, sizeof(float3)*20);
return patch;
}
- else if(face->num_edges() == 4) {
+ else if(face->num_edges() == 4) {
GregoryQuadPatch *patch = new GregoryQuadPatch();
memcpy(patch->hull, position, sizeof(float3)*20);
return patch;
@@ -644,7 +644,7 @@ Patch *SubdLinearBuilder::run(SubdFace *face)
hull = lpatch->hull;
patch = lpatch;
}
- else if(face->num_edges() == 4) {
+ else if(face->num_edges() == 4) {
LinearQuadPatch *lpatch = new LinearQuadPatch();
hull = lpatch->hull;
patch = lpatch;
diff --git a/intern/cycles/util/util_cache.cpp b/intern/cycles/util/util_cache.cpp
index 44d784ba741..2924ed30b88 100644
--- a/intern/cycles/util/util_cache.cpp
+++ b/intern/cycles/util/util_cache.cpp
@@ -26,8 +26,6 @@
#include "util_path.h"
#include "util_types.h"
-#define BOOST_FILESYSTEM_VERSION 2
-
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
@@ -117,7 +115,7 @@ void Cache::clear_except(const string& name, const set<string>& except)
boost::filesystem::directory_iterator it(dir), it_end;
for(; it != it_end; it++) {
- string filename = it->path().filename();
+ string filename = it->path().filename().string();
if(boost::starts_with(filename, name))
if(except.find(filename) == except.end())
diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp
index 717aa34c426..53dbfe9a42c 100644
--- a/intern/cycles/util/util_path.cpp
+++ b/intern/cycles/util/util_path.cpp
@@ -26,8 +26,6 @@ OIIO_NAMESPACE_USING
#include <stdio.h>
-#define BOOST_FILESYSTEM_VERSION 2
-
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
@@ -60,7 +58,7 @@ string path_user_get(const string& sub)
string path_filename(const string& path)
{
- return boost::filesystem::path(path).filename();
+ return boost::filesystem::path(path).filename().string();
}
string path_dirname(const string& path)
diff --git a/intern/decimation/intern/LOD_QuadricEditor.cpp b/intern/decimation/intern/LOD_QuadricEditor.cpp
index b56f6a5b520..fbaf0c1180f 100644
--- a/intern/decimation/intern/LOD_QuadricEditor.cpp
+++ b/intern/decimation/intern/LOD_QuadricEditor.cpp
@@ -174,7 +174,7 @@ BuildQuadrics(
vector<LOD_Edge>::iterator edge_it = edges.begin();
vector<LOD_Edge>::const_iterator edge_end = edges.end();
- for (; edge_it != edge_end; ++edge_it) {
+ for (; edge_it != edge_end; ++edge_it) {
MT_Vector3 target = TargetVertex(*edge_it);
@@ -235,7 +235,7 @@ ComputeEdgeCosts(
vector<LOD_EdgeInd>::const_iterator edge_it = edges.begin();
vector<LOD_EdgeInd>::const_iterator edge_end = edges.end();
- for (; edge_it != edge_end; ++edge_it) {
+ for (; edge_it != edge_end; ++edge_it) {
MT_Vector3 target = TargetVertex(edge_set[*edge_it]);
diff --git a/intern/dualcon/intern/octree.cpp b/intern/dualcon/intern/octree.cpp
index 1ad502b018d..9f44e7bbfdf 100644
--- a/intern/dualcon/intern/octree.cpp
+++ b/intern/dualcon/intern/octree.cpp
@@ -54,7 +54,7 @@ Octree::Octree(ModelReader *mr,
After playing around with this option, the only case I could
find where this option gives different results is on
relatively thin corners. Sometimes along these corners two
- vertices from seperate sides will be placed in the same
+ vertices from separate sides will be placed in the same
position, so hole gets filled with a 5-sided face, where two
of those vertices are in the same 3D location. If
`use_manifold' is disabled, then the modifier doesn't
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
index d719a4caa55..84e56799ee0 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
@@ -48,7 +48,7 @@ GHOST_DisplayManagerX11(
GHOST_DisplayManager(),
m_system(system)
{
- //nothing to do.
+ /* nothing to do. */
}
GHOST_TSuccess
@@ -87,7 +87,7 @@ getNumDisplaySettings(
XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes);
#else
- // We only have one X11 setting at the moment.
+ /* We only have one X11 setting at the moment. */
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
numSettings = GHOST_TInt32(1);
#endif
@@ -144,8 +144,8 @@ getDisplaySetting(
setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display));
#endif
- // Don't think it's possible to get this value from X!
- // So let's guess!!
+ /* Don't think it's possible to get this value from X!
+ * So let's guess!! */
setting.frequency = 60;
return GHOST_kSuccess;
@@ -171,11 +171,10 @@ setCurrentDisplaySetting(
const GHOST_DisplaySetting& setting)
{
#ifdef WITH_X11_XF86VMODE
- //
- // Mode switching code ported from Quake 2:
- // ftp://ftp.idsoftware.com/idstuff/source/q2source-3.21.zip
- // See linux/gl_glx.c:GLimp_SetMode
- //
+ /* Mode switching code ported from Quake 2:
+ * ftp:/* ftp.idsoftware.com/idstuff/source/q2source-3.21.zip */
+ * See linux/gl_glx.c:GLimp_SetMode
+ */
int majorVersion, minorVersion;
XF86VidModeModeInfo **vidmodes;
Display *dpy = m_system->getXDisplay();
@@ -187,7 +186,7 @@ setCurrentDisplaySetting(
scrnum = DefaultScreen(dpy);
- // Get video mode list
+ /* Get video mode list */
majorVersion = minorVersion = 0;
if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) {
fprintf(stderr, "Error: XF86VidMode extension missing!\n");
@@ -228,20 +227,21 @@ setCurrentDisplaySetting(
actualWidth, actualHeight);
# endif
- // change to the mode
+ /* change to the mode */
XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]);
- // Move the viewport to top left
+ /* Move the viewport to top left */
XF86VidModeSetViewPort(dpy, scrnum, 0, 0);
}
- else
+ else {
return GHOST_kFailure;
+ }
XFlush(dpy);
return GHOST_kSuccess;
#else
- // Just pretend the request was successful.
+ /* Just pretend the request was successful. */
return GHOST_kSuccess;
#endif
}
diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp b/intern/ghost/intern/GHOST_DropTargetX11.cpp
index c1cc55b332a..e2e15277a99 100644
--- a/intern/ghost/intern/GHOST_DropTargetX11.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp
@@ -144,23 +144,23 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char
break;
}
- // We are now converting
+ /* We are now converting */
state = STATE_CONVERTING;
break;
case STATE_CONVERTING:
bothDigits = true;
- // Create a buffer to hold the hex. For example, if %20, this
- // buffer would hold 20 (in ASCII)
+ /* Create a buffer to hold the hex. For example, if %20, this
+ * buffer would hold 20 (in ASCII) */
memset(tempNumBuf, 0, sizeof(tempNumBuf));
- // Conversion complete (i.e. don't convert again next iter)
+ /* Conversion complete (i.e. don't convert again next iter) */
state = STATE_SEARCH;
strncpy(tempNumBuf, &encodedIn[i], 2);
- // Ensure both characters are hexadecimal
+ /* Ensure both characters are hexadecimal */
for (j = 0; j < 2; ++j) {
if (!isxdigit(tempNumBuf[j]))
@@ -170,16 +170,16 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char
if (!bothDigits)
break;
- // Convert two hexadecimal characters into one character
+ /* Convert two hexadecimal characters into one character */
sscanf(tempNumBuf, "%x", &asciiCharacter);
- // Ensure we aren't going to overflow
+ /* Ensure we aren't going to overflow */
assert(strlen(decodedOut) < bufferSize);
- // Concatenate this character onto the output
+ /* Concatenate this character onto the output */
strncat(decodedOut, (char *)&asciiCharacter, 1);
- // Skip the next character
+ /* Skip the next character */
i++;
break;
}
diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.cpp b/intern/ghost/intern/GHOST_SystemPathsX11.cpp
index 83f7e87977c..35bebd588c3 100644
--- a/intern/ghost/intern/GHOST_SystemPathsX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemPathsX11.cpp
@@ -38,11 +38,11 @@
#include <sys/time.h>
#include <unistd.h>
-#include <stdio.h> // for fprintf only
-#include <cstdlib> // for exit
+#include <stdio.h> /* for fprintf only */
+#include <cstdlib> /* for exit */
-#include <pwd.h> // for get home without use getenv()
-#include <limits.h> // for PATH_MAX
+#include <pwd.h> /* for get home without use getenv() */
+#include <limits.h> /* for PATH_MAX */
#ifdef PREFIX
static const char *static_path = PREFIX "/share";
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 2d8f5e7890c..eccfc18eef9 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -32,7 +32,6 @@
* \ingroup GHOST
*/
-
#include "GHOST_SystemX11.h"
#include "GHOST_WindowX11.h"
#include "GHOST_WindowManager.h"
@@ -44,11 +43,11 @@
#include "GHOST_DisplayManagerX11.h"
#include "GHOST_EventDragnDrop.h"
#ifdef WITH_INPUT_NDOF
-#include "GHOST_NDOFManagerX11.h"
+# include "GHOST_NDOFManagerX11.h"
#endif
#ifdef WITH_XDND
-#include "GHOST_DropTargetX11.h"
+# include "GHOST_DropTargetX11.h"
#endif
#include "GHOST_Debug.h"
@@ -61,20 +60,19 @@
#include <X11/XF86keysym.h>
#endif
-// For timing
-
+/* For timing */
#include <sys/time.h>
#include <unistd.h>
#include <iostream>
#include <vector>
-#include <stdio.h> // for fprintf only
-#include <cstdlib> // for exit
+#include <stdio.h> /* for fprintf only */
+#include <cstdlib> /* for exit */
static GHOST_TKey
convertXKey(KeySym key);
-//these are for copy and select copy
+/* these are for copy and select copy */
static char *txt_cut_buffer = NULL;
static char *txt_select_buffer = NULL;
@@ -90,12 +88,15 @@ GHOST_SystemX11(
if (!m_display) {
std::cerr << "Unable to open a display" << std::endl;
- abort(); //was return before, but this would just mean it will crash later
+ abort(); /* was return before, but this would just mean it will crash later */
}
- /* Open a connection to the X input manager */
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
- m_xim = XOpenIM(m_display, NULL, (char *)GHOST_X11_RES_NAME, (char *)GHOST_X11_RES_CLASS);
+ /* note -- don't open connection to XIM server here, because the locale
+ * has to be set before opening the connection but setlocale() has not
+ * been called yet. the connection will be opened after entering
+ * the event loop. */
+ m_xim = NULL;
#endif
m_delete_window_atom
@@ -125,13 +126,13 @@ GHOST_SystemX11(
m_last_warp = 0;
- // compute the initial time
+ /* compute the initial time */
timeval tv;
if (gettimeofday(&tv, NULL) == -1) {
GHOST_ASSERT(false, "Could not instantiate timer!");
}
- // Taking care not to overflow the tv.tv_sec*1000
+ /* Taking care not to overflow the tv.tv_sec*1000 */
m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000;
@@ -187,7 +188,7 @@ getMilliSeconds() const
GHOST_ASSERT(false, "Could not compute time!");
}
- // Taking care not to overflow the tv.tv_sec*1000
+ /* Taking care not to overflow the tv.tv_sec*1000 */
return GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time;
}
@@ -251,16 +252,16 @@ createWindow(
- window = new GHOST_WindowX11(
- this, m_display, title, left, top, width, height, state, parentWindow, type, stereoVisual
- );
+ window = new GHOST_WindowX11(this, m_display, title,
+ left, top, width, height,
+ state, parentWindow, type, stereoVisual);
if (window) {
- // Both are now handle in GHOST_WindowX11.cpp
- // Focus and Delete atoms.
+ /* Both are now handle in GHOST_WindowX11.cpp
+ * Focus and Delete atoms. */
if (window->getValid()) {
- // Store the pointer to the window
+ /* Store the pointer to the window */
m_windowManager->addWindow(window);
m_windowManager->setActiveWindow(window);
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
@@ -273,6 +274,35 @@ createWindow(
return window;
}
+#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
+static void destroyIMCallback(XIM xim, XPointer ptr, XPointer data)
+{
+ GHOST_PRINT("XIM server died\n");
+
+ if (ptr)
+ *(XIM *)ptr = NULL;
+}
+
+bool GHOST_SystemX11::openX11_IM()
+{
+ if (!m_display)
+ return false;
+
+ /* set locale modifiers such as "@im=ibus" specified by XMODIFIERS */
+ XSetLocaleModifiers("");
+
+ m_xim = XOpenIM(m_display, NULL, (char *)GHOST_X11_RES_NAME, (char *)GHOST_X11_RES_CLASS);
+ if (!m_xim)
+ return false;
+
+ XIMCallback destroy;
+ destroy.callback = (XIMProc)destroyIMCallback;
+ destroy.client_data = (XPointer)&m_xim;
+ XSetIMValues(m_xim, XNDestroyCallback, &destroy, NULL);
+ return true;
+}
+#endif
+
GHOST_WindowX11 *
GHOST_SystemX11::
findGhostWindow(
@@ -281,10 +311,10 @@ findGhostWindow(
if (xwind == 0) return NULL;
- // It is not entirely safe to do this as the backptr may point
- // to a window that has recently been removed.
- // We should always check the window manager's list of windows
- // and only process events on these windows.
+ /* It is not entirely safe to do this as the backptr may point
+ * to a window that has recently been removed.
+ * We should always check the window manager's list of windows
+ * and only process events on these windows. */
vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
@@ -379,8 +409,8 @@ GHOST_SystemX11::
processEvents(
bool waitForEvent)
{
- // Get all the current events -- translate them into
- // ghost events and call base class pushEvent() method.
+ /* Get all the current events -- translate them into
+ * ghost events and call base class pushEvent() method. */
bool anyProcessed = false;
@@ -408,6 +438,38 @@ processEvents(
while (XPending(m_display)) {
XEvent xevent;
XNextEvent(m_display, &xevent);
+
+#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
+ /* open connection to XIM server and create input context (XIC)
+ * when receiving the first FocusIn or KeyPress event after startup,
+ * or recover XIM and XIC when the XIM server has been restarted */
+ if (xevent.type == FocusIn || xevent.type == KeyPress) {
+ if (!m_xim && openX11_IM()) {
+ GHOST_PRINT("Connected to XIM server\n");
+ }
+
+ if (m_xim) {
+ GHOST_WindowX11 * window = findGhostWindow(xevent.xany.window);
+ if (window && !window->getX11_XIC() && window->createX11_XIC()) {
+ GHOST_PRINT("XIM input context created\n");
+ if (xevent.type == KeyPress)
+ /* we can assume the window has input focus
+ * here, because key events are received only
+ * when the window is focused. */
+ XSetICFocus(window->getX11_XIC());
+ }
+ }
+ }
+
+ /* dispatch event to XIM server */
+ if ((XFilterEvent(&xevent, (Window)NULL) == True) && (xevent.type != KeyRelease)) {
+ /* do nothing now, the event is consumed by XIM.
+ * however, KeyRelease event should be processed
+ * here, otherwise modifiers remain activated. */
+ continue;
+ }
+#endif
+
processEvent(&xevent);
anyProcessed = true;
}
@@ -455,8 +517,8 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XExposeEvent & xee = xe->xexpose;
if (xee.count == 0) {
- // Only generate a single expose event
- // per read of the event queue.
+ /* Only generate a single expose event
+ * per read of the event queue. */
g_event = new
GHOST_Event(
@@ -535,7 +597,19 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XKeyEvent *xke = &(xe->xkey);
KeySym key_sym = XLookupKeysym(xke, 0);
char ascii;
- char utf8_buf[6]; /* 6 is enough for a utf8 char */
+#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
+ /* utf8_array[] is initial buffer used for Xutf8LookupString().
+ * if the length of the utf8 string exceeds this array, allocate
+ * another memory area and call Xutf8LookupString() again.
+ * the last 5 bytes are used to avoid segfault that might happen
+ * at the end of this buffer when the constructor of GHOST_EventKey
+ * reads 6 bytes regardless of the effective data length. */
+ char utf8_array[16 * 6 + 5]; /* 16 utf8 characters */
+ char *utf8_buf = utf8_array;
+ int len = 1; /* at least one null character will be stored */
+#else
+ char *utf8_buf = NULL;
+#endif
GHOST_TKey gkey = convertXKey(key_sym);
GHOST_TEventType type = (xke->type == KeyPress) ?
@@ -547,15 +621,20 @@ GHOST_SystemX11::processEvent(XEvent *xe)
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
/* getting unicode on key-up events gives XLookupNone status */
- if (xke->type == KeyPress) {
+ XIC xic = window->getX11_XIC();
+ if (xic && xke->type == KeyPress) {
Status status;
- int len;
/* use utf8 because its not locale depentant, from xorg docs */
- if (!(len = Xutf8LookupString(window->getX11_XIC(), xke, utf8_buf, sizeof(utf8_buf), &key_sym, &status))) {
+ if (!(len = Xutf8LookupString(xic, xke, utf8_buf, sizeof(utf8_array) - 5, &key_sym, &status))) {
utf8_buf[0] = '\0';
}
+ if (status == XBufferOverflow) {
+ utf8_buf = (char *) malloc(len + 5);
+ len = Xutf8LookupString(xic, xke, utf8_buf, len, &key_sym, &status);
+ }
+
if ((status == XLookupChars || status == XLookupBoth)) {
if ((unsigned char)utf8_buf[0] >= 32) { /* not an ascii control character */
/* do nothing for now, this is valid utf8 */
@@ -571,19 +650,16 @@ GHOST_SystemX11::processEvent(XEvent *xe)
else {
printf("Bad keycode lookup. Keysym 0x%x Status: %s\n",
(unsigned int) key_sym,
- (status == XBufferOverflow ? "BufferOverflow" :
- status == XLookupNone ? "XLookupNone" :
+ (status == XLookupNone ? "XLookupNone" :
status == XLookupKeySym ? "XLookupKeySym" :
"Unknown status"));
- printf("'%.*s' %p %p\n", len, utf8_buf, window->getX11_XIC(), m_xim);
+ printf("'%.*s' %p %p\n", len, utf8_buf, xic, m_xim);
}
}
else {
utf8_buf[0] = '\0';
}
-#else
- utf8_buf[0] = '\0';
#endif
g_event = new
@@ -595,6 +671,42 @@ GHOST_SystemX11::processEvent(XEvent *xe)
ascii,
utf8_buf
);
+
+#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
+ /* when using IM for some languages such as Japanese,
+ * one event inserts multiple utf8 characters */
+ if (xic && xke->type == KeyPress) {
+ unsigned char c;
+ int i = 0;
+ while (1) {
+ /* search character boundary */
+ if ((unsigned char)utf8_buf[i++] > 0x7f) {
+ for (; i < len; ++i) {
+ c = utf8_buf[i];
+ if (c < 0x80 || c > 0xbf) break;
+ }
+ }
+
+ if (i >= len) break;
+
+ /* enqueue previous character */
+ pushEvent(g_event);
+
+ g_event = new
+ GHOST_EventKey(
+ getMilliSeconds(),
+ type,
+ window,
+ gkey,
+ '\0',
+ &utf8_buf[i]
+ );
+ }
+ }
+
+ if (utf8_buf != utf8_array)
+ free(utf8_buf);
+#endif
break;
}
@@ -647,7 +759,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
break;
}
- // change of size, border, layer etc.
+ /* change of size, border, layer etc. */
case ConfigureNotify:
{
/* XConfigureEvent & xce = xe->xconfigure; */
@@ -666,15 +778,24 @@ GHOST_SystemX11::processEvent(XEvent *xe)
{
XFocusChangeEvent &xfe = xe->xfocus;
- // TODO: make sure this is the correct place for activate/deactivate
+ /* TODO: make sure this is the correct place for activate/deactivate */
// printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window);
- // May have to look at the type of event and filter some
- // out.
-
+ /* May have to look at the type of event and filter some out. */
+
GHOST_TEventType gtype = (xfe.type == FocusIn) ?
GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate;
+#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
+ XIC xic = window->getX11_XIC();
+ if (xic) {
+ if (xe->type == FocusIn)
+ XSetICFocus(xic);
+ else
+ XUnsetICFocus(xic);
+ }
+#endif
+
g_event = new
GHOST_Event(
getMilliSeconds(),
@@ -736,7 +857,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
case DestroyNotify:
::exit(-1);
- // We're not interested in the following things.(yet...)
+ /* We're not interested in the following things.(yet...) */
case NoExpose:
case GraphicsExpose:
break;
@@ -821,8 +942,12 @@ GHOST_SystemX11::processEvent(XEvent *xe)
nxe.xselection.target = xse->target;
nxe.xselection.time = xse->time;
- /*Check to see if the requestor is asking for String*/
- if (xse->target == utf8_string || xse->target == string || xse->target == compound_text || xse->target == c_string) {
+ /* Check to see if the requestor is asking for String */
+ if (xse->target == utf8_string ||
+ xse->target == string ||
+ xse->target == compound_text ||
+ xse->target == c_string)
+ {
if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) {
XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace,
(unsigned char *)txt_select_buffer, strlen(txt_select_buffer));
@@ -844,11 +969,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XFlush(m_display);
}
else {
- //Change property to None because we do not support anything but STRING
+ /* Change property to None because we do not support anything but STRING */
nxe.xselection.property = None;
}
- //Send the event to the client 0 0 == False, SelectionNotify
+ /* Send the event to the client 0 0 == False, SelectionNotify */
XSendEvent(m_display, xse->requestor, 0, 0, &nxe);
XFlush(m_display);
break;
@@ -899,14 +1024,14 @@ getModifierKeys(
GHOST_ModifierKeys& keys) const
{
- // analyse the masks retuned from XQueryPointer.
+ /* analyse the masks retuned from XQueryPointer. */
memset((void *)m_keyboard_vector, 0, sizeof(m_keyboard_vector));
XQueryKeymap(m_display, (char *)m_keyboard_vector);
- // now translate key symobols into keycodes and
- // test with vector.
+ /* now translate key symobols into keycodes and
+ * test with vector. */
const static KeyCode shift_l = XKeysymToKeycode(m_display, XK_Shift_L);
const static KeyCode shift_r = XKeysymToKeycode(m_display, XK_Shift_R);
@@ -917,16 +1042,16 @@ getModifierKeys(
const static KeyCode super_l = XKeysymToKeycode(m_display, XK_Super_L);
const static KeyCode super_r = XKeysymToKeycode(m_display, XK_Super_R);
- // shift
+ /* shift */
keys.set(GHOST_kModifierKeyLeftShift, ((m_keyboard_vector[shift_l >> 3] >> (shift_l & 7)) & 1) != 0);
keys.set(GHOST_kModifierKeyRightShift, ((m_keyboard_vector[shift_r >> 3] >> (shift_r & 7)) & 1) != 0);
- // control
+ /* control */
keys.set(GHOST_kModifierKeyLeftControl, ((m_keyboard_vector[control_l >> 3] >> (control_l & 7)) & 1) != 0);
keys.set(GHOST_kModifierKeyRightControl, ((m_keyboard_vector[control_r >> 3] >> (control_r & 7)) & 1) != 0);
- // alt
+ /* alt */
keys.set(GHOST_kModifierKeyLeftAlt, ((m_keyboard_vector[alt_l >> 3] >> (alt_l & 7)) & 1) != 0);
keys.set(GHOST_kModifierKeyRightAlt, ((m_keyboard_vector[alt_r >> 3] >> (alt_r & 7)) & 1) != 0);
- // super (windows) - only one GHOST-kModifierKeyOS, so mapping to either
+ /* super (windows) - only one GHOST-kModifierKeyOS, so mapping to either */
keys.set(GHOST_kModifierKeyOS, ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) ||
((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) != 0);
@@ -999,9 +1124,9 @@ setCursorPosition(
GHOST_TInt32 y
) {
- // This is a brute force move in screen coordinates
- // XWarpPointer does relative moves so first determine the
- // current pointer position.
+ /* This is a brute force move in screen coordinates
+ * XWarpPointer does relative moves so first determine the
+ * current pointer position. */
int cx, cy;
if (getCursorPosition(cx, cy) == GHOST_kFailure) {
@@ -1212,15 +1337,15 @@ convertXKey(KeySym key)
/* from xclip.c xcout() v0.11 */
-#define XCLIB_XCOUT_NONE 0 /* no context */
+#define XCLIB_XCOUT_NONE 0 /* no context */
#define XCLIB_XCOUT_SENTCONVSEL 1 /* sent a request */
-#define XCLIB_XCOUT_INCR 2 /* in an incr loop */
+#define XCLIB_XCOUT_INCR 2 /* in an incr loop */
#define XCLIB_XCOUT_FALLBACK 3 /* STRING failed, need fallback to UTF8 */
#define XCLIB_XCOUT_FALLBACK_UTF8 4 /* UTF8 failed, move to compouned */
#define XCLIB_XCOUT_FALLBACK_COMP 5 /* compouned failed, move to text. */
#define XCLIB_XCOUT_FALLBACK_TEXT 6
-// Retrieves the contents of a selections.
+/* Retrieves the contents of a selections. */
void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
Atom sel, Atom target, unsigned char **txt,
unsigned long *len, unsigned int *context) const
@@ -1237,15 +1362,15 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
Window win = window->getXWindow();
switch (*context) {
- // There is no context, do an XConvertSelection()
+ /* There is no context, do an XConvertSelection() */
case XCLIB_XCOUT_NONE:
- // Initialise return length to 0
+ /* Initialise return length to 0 */
if (*len > 0) {
free(*txt);
*len = 0;
}
- // Send a selection request
+ /* Send a selection request */
XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime);
*context = XCLIB_XCOUT_SENTCONVSEL;
return;
@@ -1267,22 +1392,22 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
return;
}
- // find the size and format of the data in property
+ /* find the size and format of the data in property */
XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, &buffer);
XFree(buffer);
if (pty_type == m_incr) {
- // start INCR mechanism by deleting property
+ /* start INCR mechanism by deleting property */
XDeleteProperty(m_display, win, m_xclip_out);
XFlush(m_display);
*context = XCLIB_XCOUT_INCR;
return;
}
- // if it's not incr, and not format == 8, then there's
- // nothing in the selection (that xclip understands, anyway)
+ /* if it's not incr, and not format == 8, then there's
+ * nothing in the selection (that xclip understands, anyway) */
if (pty_format != 8) {
*context = XCLIB_XCOUT_NONE;
@@ -1294,73 +1419,73 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
False, AnyPropertyType, &pty_type,
&pty_format, &pty_items, &pty_size, &buffer);
- // finished with property, delete it
+ /* finished with property, delete it */
XDeleteProperty(m_display, win, m_xclip_out);
- // copy the buffer to the pointer for returned data
+ /* copy the buffer to the pointer for returned data */
ltxt = (unsigned char *) malloc(pty_items);
memcpy(ltxt, buffer, pty_items);
- // set the length of the returned data
+ /* set the length of the returned data */
*len = pty_items;
*txt = ltxt;
- // free the buffer
+ /* free the buffer */
XFree(buffer);
*context = XCLIB_XCOUT_NONE;
- // complete contents of selection fetched, return 1
+ /* complete contents of selection fetched, return 1 */
return;
case XCLIB_XCOUT_INCR:
- // To use the INCR method, we basically delete the
- // property with the selection in it, wait for an
- // event indicating that the property has been created,
- // then read it, delete it, etc.
+ /* To use the INCR method, we basically delete the
+ * property with the selection in it, wait for an
+ * event indicating that the property has been created,
+ * then read it, delete it, etc. */
- // make sure that the event is relevant
+ /* make sure that the event is relevant */
if (evt.type != PropertyNotify)
return;
- // skip unless the property has a new value
+ /* skip unless the property has a new value */
if (evt.xproperty.state != PropertyNewValue)
return;
- // check size and format of the property
+ /* check size and format of the property */
XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer);
if (pty_format != 8) {
- // property does not contain text, delete it
- // to tell the other X client that we have read
- // it and to send the next property
+ /* property does not contain text, delete it
+ * to tell the other X client that we have read
+ * it and to send the next property */
XFree(buffer);
XDeleteProperty(m_display, win, m_xclip_out);
return;
}
if (pty_size == 0) {
- // no more data, exit from loop
+ /* no more data, exit from loop */
XFree(buffer);
XDeleteProperty(m_display, win, m_xclip_out);
*context = XCLIB_XCOUT_NONE;
- // this means that an INCR transfer is now
- // complete, return 1
+ /* this means that an INCR transfer is now
+ * complete, return 1 */
return;
}
XFree(buffer);
- // if we have come this far, the propery contains
- // text, we know the size.
+ /* if we have come this far, the propery contains
+ * text, we know the size. */
XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
False, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer);
- // allocate memory to accommodate data in *txt
+ /* allocate memory to accommodate data in *txt */
if (*len == 0) {
*len = pty_items;
ltxt = (unsigned char *) malloc(*len);
@@ -1370,13 +1495,13 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
ltxt = (unsigned char *) realloc(ltxt, *len);
}
- // add data to ltxt
+ /* add data to ltxt */
memcpy(&ltxt[*len - pty_items], buffer, pty_items);
*txt = ltxt;
XFree(buffer);
- // delete property to get the next item
+ /* delete property to get the next item */
XDeleteProperty(m_display, win, m_xclip_out);
XFlush(m_display);
return;
@@ -1390,7 +1515,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
Atom target = m_utf8_string;
Window owner;
- // from xclip.c doOut() v0.11
+ /* from xclip.c doOut() v0.11 */
unsigned char *sel_buf;
unsigned long sel_len = 0;
XEvent evt;
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index fd5a33c02d7..d86790e262f 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -309,6 +309,10 @@ private:
* X11 window xwind
*/
+#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
+ bool openX11_IM();
+#endif
+
GHOST_WindowX11 *
findGhostWindow(
Window xwind
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index f94f08b1d13..ac6cc548f32 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -1235,9 +1235,11 @@ GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress)
// Progress fill
progressBox = NSInsetRect(progressBox, 1, 1);
- [[NSColor knobColor] setFill];
+
progressBox.size.width = progressBox.size.width * progress;
- NSRectFill(progressBox);
+ NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor darkGrayColor] endingColor:[NSColor lightGrayColor]];
+ [gradient drawInRect:progressBox angle:90];
+ [gradient release];
[dockIcon unlockFocus];
diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h
index dcbb7d2b346..e3d092101b0 100644
--- a/intern/ghost/intern/GHOST_WindowNULL.h
+++ b/intern/ghost/intern/GHOST_WindowNULL.h
@@ -81,9 +81,9 @@ protected:
GHOST_TSuccess activateDrawingContext( ) { return GHOST_kFailure; }
~GHOST_WindowNULL( ) { /* nothing */ }
GHOST_TSuccess setWindowCursorVisibility( bool visible ) { return GHOST_kSuccess; }
- GHOST_TSuccess setState(GHOST_TWindowState state) { return GHOST_kSuccess; }
+ GHOST_TSuccess setState(GHOST_TWindowState state) { return GHOST_kSuccess; }
GHOST_TWindowState getState() const { return GHOST_kWindowStateNormal; }
- GHOST_TSuccess invalidate() { return GHOST_kSuccess; }
+ GHOST_TSuccess invalidate() { return GHOST_kSuccess; }
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; }
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index e3fe28e2e64..3a6e646de11 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -1343,7 +1343,7 @@ static int EnumPixelFormats(HDC hdc)
::DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
w = WeightPixelFormat(pfd);
// be strict on stereo
- if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) {
+ if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) {
if (w > weight) {
weight = w;
iPixelFormat = i;
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 285fbe96638..3dc10d17169 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -39,7 +39,7 @@
#include "GHOST_DropTargetX11.h"
#endif
-// For standard X11 cursors
+/* For standard X11 cursors */
#include <X11/cursorfont.h>
#include <X11/Xatom.h>
@@ -53,8 +53,8 @@
#include <algorithm>
#include <string>
-// For obscure full screen mode stuuf
-// lifted verbatim from blut.
+/* For obscure full screen mode stuuf
+ * lifted verbatim from blut. */
typedef struct {
long flags;
@@ -95,7 +95,7 @@ typedef struct {
f.write('\n')
*/
-// See the python script above to regenerate the 48x48 icon within blender
+/* See the python script above to regenerate the 48x48 icon within blender */
#define BLENDER_ICON_WIDTH 48
#define BLENDER_ICON_HEIGHT 48
static unsigned char BLENDER_ICON_48x48x24[] = {
@@ -178,13 +178,13 @@ GHOST_WindowX11(
m_custom_cursor(None)
{
- // Set up the minimum atrributes that we require and see if
- // X can find us a visual matching those requirements.
+ /* Set up the minimum atrributes that we require and see if
+ * X can find us a visual matching those requirements. */
int attributes[40], i, samples;
Atom atoms[2];
int natom;
- int glxVersionMajor, glxVersionMinor; // As in GLX major.minor
+ int glxVersionMajor, glxVersionMinor; /* As in GLX major.minor */
#ifdef WITH_X11_XINPUT
/* initialize incase X11 fails to load */
@@ -251,11 +251,11 @@ GHOST_WindowX11(
}
}
- // Create a bunch of attributes needed to create an X window.
+ /* Create a bunch of attributes needed to create an X window. */
- // First create a colormap for the window and visual.
- // This seems pretty much a legacy feature as we are in rgba mode anyway.
+ /* First create a colormap for the window and visual.
+ * This seems pretty much a legacy feature as we are in rgba mode anyway. */
XSetWindowAttributes xattributes;
memset(&xattributes, 0, sizeof(xattributes));
@@ -268,7 +268,7 @@ GHOST_WindowX11(
xattributes.border_pixel = 0;
- // Specify which events we are interested in hearing.
+ /* Specify which events we are interested in hearing. */
xattributes.event_mask =
ExposureMask | StructureNotifyMask |
@@ -277,7 +277,7 @@ GHOST_WindowX11(
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | FocusChangeMask | PropertyChangeMask;
- // create the window!
+ /* create the window! */
;
if (parentWindow == 0) {
@@ -287,7 +287,7 @@ GHOST_WindowX11(
top,
width,
height,
- 0, // no border.
+ 0, /* no border. */
m_visual->depth,
InputOutput,
m_visual->visual,
@@ -311,12 +311,12 @@ GHOST_WindowX11(
m_window = XCreateWindow(m_display,
- parentWindow, // reparent against embedder
+ parentWindow, /* reparent against embedder */
left,
top,
width,
height,
- 0, // no border.
+ 0, /* no border. */
m_visual->depth,
InputOutput,
m_visual->visual,
@@ -353,9 +353,9 @@ GHOST_WindowX11(
m_post_init = False;
m_post_state = GHOST_kWindowStateNormal;
}
-
- // Create some hints for the window manager on how
- // we want this window treated.
+
+ /* Create some hints for the window manager on how
+ * we want this window treated. */
XSizeHints *xsizehints = XAllocSizeHints();
xsizehints->flags = PPosition | PSize | PMinSize | PMaxSize;
@@ -363,8 +363,8 @@ GHOST_WindowX11(
xsizehints->y = top;
xsizehints->width = width;
xsizehints->height = height;
- xsizehints->min_width = 320; // size hints, could be made apart of the ghost api
- xsizehints->min_height = 240; // limits are also arbitrary, but should not allow 1x1 window
+ xsizehints->min_width = 320; /* size hints, could be made apart of the ghost api */
+ xsizehints->min_height = 240; /* limits are also arbitrary, but should not allow 1x1 window */
xsizehints->max_width = 65535;
xsizehints->max_height = 65535;
XSetWMNormalHints(m_display, m_window, xsizehints);
@@ -401,13 +401,10 @@ GHOST_WindowX11(
}
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
- m_xic = XCreateIC(m_system->getX11_XIM(), XNClientWindow, m_window, XNFocusWindow, m_window,
- XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
- XNResourceName, GHOST_X11_RES_NAME, XNResourceClass,
- GHOST_X11_RES_CLASS, NULL);
+ m_xic = NULL;
#endif
- // Set the window icon
+ /* Set the window icon */
XWMHints *xwmhints = XAllocWMHints();
XImage *x_image, *mask_image;
Pixmap icon_pixmap, mask_pixmap;
@@ -445,7 +442,7 @@ GHOST_WindowX11(
XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
- // Now the pixmap is ok to assign to the window as a hint
+ /* Now the pixmap is ok to assign to the window as a hint */
xwmhints->icon_pixmap = icon_pixmap;
xwmhints->icon_mask = mask_pixmap;
XFreeGC(display, gc_icon);
@@ -458,7 +455,7 @@ GHOST_WindowX11(
xwmhints->flags = InputHint | IconPixmapHint | IconMaskHint | StateHint;
XSetWMHints(display, m_window, xwmhints);
XFree(xwmhints);
- // done setting the icon
+ /* done setting the icon */
setTitle(title);
@@ -466,7 +463,7 @@ GHOST_WindowX11(
initXInputDevices();
#endif
- // now set up the rendering context.
+ /* now set up the rendering context. */
if (installDrawingContext(type) == GHOST_kSuccess) {
m_valid_setup = true;
GHOST_PRINT("Created window\n");
@@ -478,6 +475,47 @@ GHOST_WindowX11(
XFlush(m_display);
}
+#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
+static void destroyICCallback(XIC xic, XPointer ptr, XPointer data)
+{
+ GHOST_PRINT("XIM input context destroyed\n");
+
+ if (ptr) {
+ *(XIC *)ptr = NULL;
+ }
+}
+
+bool GHOST_WindowX11::createX11_XIC()
+{
+ XIM xim = m_system->getX11_XIM();
+ if (!xim)
+ return false;
+
+ XICCallback destroy;
+ destroy.callback = (XICProc)destroyICCallback;
+ destroy.client_data = (XPointer)&m_xic;
+ m_xic = XCreateIC(xim, XNClientWindow, m_window, XNFocusWindow, m_window,
+ XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
+ XNResourceName, GHOST_X11_RES_NAME,
+ XNResourceClass, GHOST_X11_RES_CLASS,
+ XNDestroyCallback, &destroy,
+ NULL);
+ if (!m_xic)
+ return false;
+
+ unsigned long fevent;
+ XGetICValues(m_xic, XNFilterEvents, &fevent, NULL);
+ XSelectInput(m_display, m_window,
+ ExposureMask | StructureNotifyMask |
+ KeyPressMask | KeyReleaseMask |
+ EnterWindowMask | LeaveWindowMask |
+ ButtonPressMask | ButtonReleaseMask |
+ PointerMotionMask | FocusChangeMask |
+ PropertyChangeMask | fevent);
+ return true;
+}
+#endif
+
#ifdef WITH_X11_XINPUT
/*
* Dummy function to get around IO Handler exiting if device invalid
@@ -710,8 +748,8 @@ setTitle(
(const unsigned char *) title.ReadPtr(),
title.Length());
-// This should convert to valid x11 string
-// and getTitle would need matching change
+ /* This should convert to valid x11 string
+ * and getTitle would need matching change */
XStoreName(m_display, m_window, title);
XFlush(m_display);
@@ -734,8 +772,8 @@ GHOST_WindowX11::
getWindowBounds(
GHOST_Rect& bounds) const
{
- // Getting the window bounds under X11 is not
- // really supported (nor should it be desired).
+ /* Getting the window bounds under X11 is not
+ * really supported (nor should it be desired). */
getClientBounds(bounds);
}
@@ -810,7 +848,7 @@ screenToClient(
GHOST_TInt32& outX,
GHOST_TInt32& outY) const
{
- // This is correct!
+ /* This is correct! */
int ax, ay;
Window temp;
@@ -1236,18 +1274,18 @@ GHOST_TSuccess
GHOST_WindowX11::
invalidate()
{
- // So the idea of this function is to generate an expose event
- // for the window.
- // Unfortunately X does not handle expose events for you and
- // it is the client's job to refresh the dirty part of the window.
- // We need to queue up invalidate calls and generate GHOST events
- // for them in the system.
-
- // We implement this by setting a boolean in this class to concatenate
- // all such calls into a single event for this window.
-
- // At the same time we queue the dirty windows in the system class
- // and generate events for them at the next processEvents call.
+ /* So the idea of this function is to generate an expose event
+ * for the window.
+ * Unfortunately X does not handle expose events for you and
+ * it is the client's job to refresh the dirty part of the window.
+ * We need to queue up invalidate calls and generate GHOST events
+ * for them in the system.
+ *
+ * We implement this by setting a boolean in this class to concatenate
+ * all such calls into a single event for this window.
+ *
+ * At the same time we queue the dirty windows in the system class
+ * and generate events for them at the next processEvents call. */
if (m_invalid_window == false) {
m_system->addDirtyWindow(this);
@@ -1346,7 +1384,7 @@ GHOST_WindowX11::
installDrawingContext(
GHOST_TDrawingContextType type)
{
- // only support openGL for now.
+ /* only support openGL for now. */
GHOST_TSuccess success;
switch (type) {
case GHOST_kDrawingContextTypeOpenGL:
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index a04a43bc33a..753d8960a18 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -234,6 +234,8 @@ public:
XIC getX11_XIC() {
return m_xic;
}
+
+ bool createX11_XIC();
#endif
#ifdef WITH_XDND
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 7fcfba5afec..65ce7baba1e 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -20,19 +20,19 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Brecht Van Lommel
+ * Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file MEM_guardedalloc.h
- * \ingroup MEM
+/**
+ * \file MEM_guardedalloc.h
+ * \ingroup MEM
+ *
+ * \author Copyright (C) 2001 NaN Technologies B.V.
+ * \brief Read \ref MEMPage
*
- * \author Copyright (C) 2001 NaN Technologies B.V.
- * \brief Read \ref MEMPage
- */
-
-/**
* \page MEMPage Guarded memory(de)allocation
*
* \section aboutmem c-style guarded memory allocation
@@ -60,8 +60,8 @@
#ifndef __MEM_GUARDEDALLOC_H__
#define __MEM_GUARDEDALLOC_H__
-#include <stdio.h> /* needed for FILE* */
-#include "MEM_sys_types.h" /* needed for uintptr_t */
+#include <stdio.h> /* needed for FILE* */
+#include "MEM_sys_types.h" /* needed for uintptr_t */
#ifdef __cplusplus
extern "C" {
@@ -70,7 +70,7 @@ extern "C" {
/** Returns the length of the allocated memory segment pointed at
* by vmemh. If the pointer was not previously allocated by this
* module, the result is undefined.*/
- size_t MEM_allocN_len(void *vmemh)
+ size_t MEM_allocN_len(const void *vmemh)
#ifdef __GNUC__
__attribute__((warn_unused_result))
#endif
@@ -111,32 +111,34 @@ extern "C" {
* Allocate a block of memory of size len, with tag name str. The
* memory is cleared. The name must be static, because only a
* pointer to it is stored ! */
- void *MEM_callocN(size_t len, const char * str)
+ void *MEM_callocN(size_t len, const char *str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
- __attribute__((nonnull))
+ __attribute__((nonnull(2)))
__attribute__((alloc_size(1)))
#endif
;
-
- /** Allocate a block of memory of size len, with tag name str. The
+
+ /**
+ * Allocate a block of memory of size len, with tag name str. The
* name must be a static, because only a pointer to it is stored !
* */
- void *MEM_mallocN(size_t len, const char * str)
+ void *MEM_mallocN(size_t len, const char *str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
- __attribute__((nonnull))
+ __attribute__((nonnull(2)))
__attribute__((alloc_size(1)))
#endif
;
-
- /** Same as callocN, clears memory and uses mmap (disk cached) if supported.
+
+ /**
+ * Same as callocN, clears memory and uses mmap (disk cached) if supported.
* Can be free'd with MEM_freeN as usual.
* */
- void *MEM_mapallocN(size_t len, const char * str)
+ void *MEM_mapallocN(size_t len, const char *str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
- __attribute__((nonnull))
+ __attribute__((nonnull(2)))
__attribute__((alloc_size(1)))
#endif
;
@@ -171,7 +173,8 @@ extern "C" {
/** Attempt to enforce OSX (or other OS's) to have malloc and stack nonzero */
void MEM_set_memory_debug(void);
- /** Memory usage stats
+ /**
+ * Memory usage stats
* - MEM_get_memory_in_use is all memory
* - MEM_get_mapped_memory_in_use is a subset of all memory */
uintptr_t MEM_get_memory_in_use(void);
@@ -213,11 +216,10 @@ public: \
MEM_freeN(mem); \
} \
-#endif
-
+#endif /* __cplusplus */
#ifdef __cplusplus
}
-#endif
+#endif /* __cplusplus */
-#endif
+#endif /* __MEM_GUARDEDALLOC_H__ */
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 9ba8c0f3d58..76df58f4a50 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -20,7 +20,8 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Brecht Van Lommel
+ * Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -222,10 +223,10 @@ void MEM_set_memory_debug(void)
malloc_debug_memset = 1;
}
-size_t MEM_allocN_len(void *vmemh)
+size_t MEM_allocN_len(const void *vmemh)
{
if (vmemh) {
- MemHead *memh = vmemh;
+ const MemHead *memh = vmemh;
memh--;
return memh->len;
@@ -904,6 +905,4 @@ const char *MEM_name_ptr(void *vmemh)
return "MEM_name_ptr(NULL)";
}
}
-#endif
-
-/* eof */
+#endif /* NDEBUG */
diff --git a/intern/itasc/Scene.cpp b/intern/itasc/Scene.cpp
index 877cd883208..7a83f821bf0 100644
--- a/intern/itasc/Scene.cpp
+++ b/intern/itasc/Scene.cpp
@@ -40,7 +40,7 @@ public:
{
q_nr += m_qrange.start;
project(m_scene->m_Wq, Range(q_nr, ndof), m_qrange).setZero();
- // update the ouput vector so that the movement of this joint will be
+ // update the ouput vector so that the movement of this joint will be
// taken into account and we can put the joint back in its initial position
// which means that the jacobian doesn't need to be changed
for (unsigned int i=0 ;i<ndof ; ++i, ++q_nr) {
diff --git a/intern/memutil/MEM_CacheLimiter.h b/intern/memutil/MEM_CacheLimiter.h
index 9a36b67aa2f..801ee154d40 100644
--- a/intern/memutil/MEM_CacheLimiter.h
+++ b/intern/memutil/MEM_CacheLimiter.h
@@ -32,7 +32,7 @@
* @section MEM_CacheLimiter
* This class defines a generic memory cache management system
* to limit memory usage to a fixed global maximum.
- *
+ *
* Please use the C-API in MEM_CacheLimiterC-Api.h for code written in C.
*
* Usage example:
@@ -41,12 +41,12 @@
* public:
* ~BigFatImage() { tell_everyone_we_are_gone(this); }
* };
- *
+ *
* void doit() {
* MEM_Cache<BigFatImage> BigFatImages;
*
* MEM_Cache_Handle<BigFatImage>* h = BigFatImages.insert(new BigFatImage);
- *
+ *
* BigFatImages.enforce_limits();
* h->ref();
*
@@ -58,6 +58,8 @@
*/
#include <list>
+#include <queue>
+#include <vector>
#include "MEM_Allocator.h"
template<class T>
@@ -65,36 +67,44 @@ class MEM_CacheLimiter;
#ifndef __MEM_CACHELIMITERC_API_H__
extern "C" {
- extern void MEM_CacheLimiter_set_maximum(size_t m);
- extern size_t MEM_CacheLimiter_get_maximum();
+ void MEM_CacheLimiter_set_maximum(size_t m);
+ size_t MEM_CacheLimiter_get_maximum();
};
#endif
template<class T>
class MEM_CacheLimiterHandle {
public:
- explicit MEM_CacheLimiterHandle(T * data_,
- MEM_CacheLimiter<T> * parent_)
- : data(data_), refcount(0), parent(parent_) { }
+ explicit MEM_CacheLimiterHandle(T * data_,MEM_CacheLimiter<T> *parent_) :
+ data(data_),
+ refcount(0),
+ parent(parent_)
+ { }
- void ref() {
- refcount++;
+ void ref() {
+ refcount++;
}
- void unref() {
- refcount--;
+
+ void unref() {
+ refcount--;
}
- T * get() {
- return data;
+
+ T *get() {
+ return data;
}
- const T * get() const {
- return data;
+
+ const T *get() const {
+ return data;
}
- int get_refcount() const {
- return refcount;
+
+ int get_refcount() const {
+ return refcount;
}
- bool can_destroy() const {
- return !data || !refcount;
+
+ bool can_destroy() const {
+ return !data || !refcount;
}
+
bool destroy_if_possible() {
if (can_destroy()) {
delete data;
@@ -104,48 +114,64 @@ public:
}
return false;
}
+
void unmanage() {
parent->unmanage(this);
}
+
void touch() {
parent->touch(this);
}
+
+ void set_priority(int priority) {
+ this->priority = priority;
+ }
+
+ int get_priority(void) {
+ return this->priority;
+ }
+
private:
friend class MEM_CacheLimiter<T>;
T * data;
int refcount;
- typename std::list<MEM_CacheLimiterHandle<T> *,
- MEM_Allocator<MEM_CacheLimiterHandle<T> *> >::iterator me;
+ int priority;
+ typename std::list<MEM_CacheLimiterHandle<T> *, MEM_Allocator<MEM_CacheLimiterHandle<T> *> >::iterator me;
MEM_CacheLimiter<T> * parent;
};
template<class T>
class MEM_CacheLimiter {
public:
- typedef typename std::list<MEM_CacheLimiterHandle<T> *,
- MEM_Allocator<MEM_CacheLimiterHandle<T> *> >::iterator iterator;
typedef size_t (*MEM_CacheLimiter_DataSize_Func) (void *data);
+ typedef int (*MEM_CacheLimiter_ItemPriority_Func) (void *item, int default_priority);
+
MEM_CacheLimiter(MEM_CacheLimiter_DataSize_Func getDataSize_)
: getDataSize(getDataSize_) {
}
+
~MEM_CacheLimiter() {
for (iterator it = queue.begin(); it != queue.end(); it++) {
delete *it;
}
}
- MEM_CacheLimiterHandle<T> * insert(T * elem) {
+
+ MEM_CacheLimiterHandle<T> *insert(T * elem) {
queue.push_back(new MEM_CacheLimiterHandle<T>(elem, this));
iterator it = queue.end();
--it;
queue.back()->me = it;
return queue.back();
}
- void unmanage(MEM_CacheLimiterHandle<T> * handle) {
+
+ void unmanage(MEM_CacheLimiterHandle<T> *handle) {
queue.erase(handle->me);
delete handle;
}
+
void enforce_limits() {
+ MEM_CachePriorityQueue priority_queue;
size_t max = MEM_CacheLimiter_get_maximum();
size_t mem_in_use, cur_size;
@@ -159,27 +185,33 @@ public:
mem_in_use = MEM_get_memory_in_use();
}
- for (iterator it = queue.begin();
- it != queue.end() && mem_in_use > max;)
- {
- iterator jt = it;
- ++it;
+ if (mem_in_use <= max) {
+ return;
+ }
- if(getDataSize) {
- cur_size= getDataSize((*jt)->get()->get_data());
- } else {
- cur_size= mem_in_use;
- }
+ priority_queue = get_priority_queue();
+
+ while (!priority_queue.empty() && mem_in_use > max) {
+ MEM_CacheElementPtr elem = priority_queue.top();
- (*jt)->destroy_if_possible();
+ priority_queue.pop();
if(getDataSize) {
- mem_in_use-= cur_size;
+ cur_size = getDataSize(elem->get()->get_data());
} else {
- mem_in_use-= cur_size - MEM_get_memory_in_use();
+ cur_size = mem_in_use;
+ }
+
+ if (elem->destroy_if_possible()) {
+ if (getDataSize) {
+ mem_in_use -= cur_size;
+ } else {
+ mem_in_use -= cur_size - MEM_get_memory_in_use();
+ }
}
}
}
+
void touch(MEM_CacheLimiterHandle<T> * handle) {
queue.push_back(handle);
queue.erase(handle->me);
@@ -187,7 +219,24 @@ public:
--it;
handle->me = it;
}
+
+ void set_item_priority_func(MEM_CacheLimiter_ItemPriority_Func item_priority_func) {
+ getItemPriority = item_priority_func;
+ }
+
private:
+ typedef MEM_CacheLimiterHandle<T> *MEM_CacheElementPtr;
+ typedef std::list<MEM_CacheElementPtr, MEM_Allocator<MEM_CacheElementPtr> > MEM_CacheQueue;
+ typedef typename MEM_CacheQueue::iterator iterator;
+
+ struct compare_element_priority : public std::binary_function<MEM_CacheElementPtr, MEM_CacheElementPtr, bool> {
+ bool operator()(const MEM_CacheElementPtr left_elem, const MEM_CacheElementPtr right_elem) const {
+ return left_elem->get_priority() > right_elem->get_priority();
+ }
+ };
+
+ typedef std::priority_queue<MEM_CacheElementPtr, std::vector<MEM_CacheElementPtr>, compare_element_priority > MEM_CachePriorityQueue;
+
size_t total_size() {
size_t size = 0;
for (iterator it = queue.begin(); it != queue.end(); it++) {
@@ -196,9 +245,33 @@ private:
return size;
}
- std::list<MEM_CacheLimiterHandle<T>*,
- MEM_Allocator<MEM_CacheLimiterHandle<T> *> > queue;
+ MEM_CachePriorityQueue get_priority_queue(void) {
+ MEM_CachePriorityQueue priority_queue;
+ iterator it;
+ int i;
+
+ for (it = queue.begin(), i = 0; it != queue.end(); it++, i++) {
+ MEM_CacheElementPtr elem = *it;
+ int priority;
+
+ /* by default 0 means higherst priority element */
+ priority = -(queue.size() - i - 1);
+
+ if (getItemPriority) {
+ priority = getItemPriority(elem->get()->get_data(), priority);
+ }
+
+ elem->set_priority(priority);
+
+ priority_queue.push(elem);
+ }
+
+ return priority_queue;
+ }
+
+ MEM_CacheQueue queue;
MEM_CacheLimiter_DataSize_Func getDataSize;
+ MEM_CacheLimiter_ItemPriority_Func getItemPriority;
};
#endif // __MEM_CACHELIMITER_H__
diff --git a/intern/memutil/MEM_CacheLimiterC-Api.h b/intern/memutil/MEM_CacheLimiterC-Api.h
index 4ed692fb55f..1ae5e9df1c6 100644
--- a/intern/memutil/MEM_CacheLimiterC-Api.h
+++ b/intern/memutil/MEM_CacheLimiterC-Api.h
@@ -31,7 +31,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-
+
struct MEM_CacheLimiter_s;
struct MEM_CacheLimiterHandle_s;
@@ -39,106 +39,111 @@ typedef struct MEM_CacheLimiter_s MEM_CacheLimiterC;
typedef struct MEM_CacheLimiterHandle_s MEM_CacheLimiterHandleC;
/* function used to remove data from memory */
-typedef void(*MEM_CacheLimiter_Destruct_Func)(void*);
+typedef void (*MEM_CacheLimiter_Destruct_Func)(void*);
/* function used to measure stored data element size */
-typedef size_t(*MEM_CacheLimiter_DataSize_Func) (void*);
+typedef size_t (*MEM_CacheLimiter_DataSize_Func) (void*);
+
+/* function used to measure priority of item when freeing memory */
+typedef int (*MEM_CacheLimiter_ItemPriority_Func) (void*, int);
#ifndef __MEM_CACHELIMITER_H__
-extern void MEM_CacheLimiter_set_maximum(size_t m);
-extern int MEM_CacheLimiter_get_maximum(void);
+void MEM_CacheLimiter_set_maximum(size_t m);
+int MEM_CacheLimiter_get_maximum(void);
#endif /* __MEM_CACHELIMITER_H__ */
-/**
- * Create new MEM_CacheLimiter object
+
+/**
+ * Create new MEM_CacheLimiter object
* managed objects are destructed with the data_destructor
*
* @param data_destructor
* @return A new MEM_CacheLimter object
*/
-extern MEM_CacheLimiterC * new_MEM_CacheLimiter(
- MEM_CacheLimiter_Destruct_Func data_destructor,
- MEM_CacheLimiter_DataSize_Func data_size);
+MEM_CacheLimiterC *new_MEM_CacheLimiter(MEM_CacheLimiter_Destruct_Func data_destructor,
+ MEM_CacheLimiter_DataSize_Func data_size);
-/**
+/**
* Delete MEM_CacheLimiter
- *
+ *
* Frees the memory of the CacheLimiter but does not touch managed objects!
*
* @param This "This" pointer
*/
-extern void delete_MEM_CacheLimiter(MEM_CacheLimiterC * This);
+void delete_MEM_CacheLimiter(MEM_CacheLimiterC *This);
-/**
+/**
* Manage object
- *
+ *
* @param This "This" pointer, data data object to manage
* @return CacheLimiterHandle to ref, unref, touch the managed object
*/
-
-extern MEM_CacheLimiterHandleC * MEM_CacheLimiter_insert(
- MEM_CacheLimiterC * This, void * data);
-/**
+MEM_CacheLimiterHandleC *MEM_CacheLimiter_insert(MEM_CacheLimiterC * This, void * data);
+
+/**
* Free objects until memory constraints are satisfied
- *
+ *
* @param This "This" pointer
*/
-extern void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC * This);
+void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC *This);
-/**
- * Unmanage object previously inserted object.
+/**
+ * Unmanage object previously inserted object.
* Does _not_ delete managed object!
- *
+ *
* @param This "This" pointer, handle of object
*/
-
-extern void MEM_CacheLimiter_unmanage(MEM_CacheLimiterHandleC * handle);
+void MEM_CacheLimiter_unmanage(MEM_CacheLimiterHandleC *handle);
-/**
+
+/**
* Raise priority of object (put it at the tail of the deletion chain)
- *
+ *
* @param handle of object
*/
-
-extern void MEM_CacheLimiter_touch(MEM_CacheLimiterHandleC * handle);
-/**
+void MEM_CacheLimiter_touch(MEM_CacheLimiterHandleC *handle);
+
+/**
* Increment reference counter. Objects with reference counter != 0 are _not_
* deleted.
- *
+ *
* @param handle of object
*/
-
-extern void MEM_CacheLimiter_ref(MEM_CacheLimiterHandleC * handle);
-/**
+void MEM_CacheLimiter_ref(MEM_CacheLimiterHandleC *handle);
+
+/**
* Decrement reference counter. Objects with reference counter != 0 are _not_
* deleted.
- *
+ *
* @param handle of object
*/
-
-extern void MEM_CacheLimiter_unref(MEM_CacheLimiterHandleC * handle);
-/**
+void MEM_CacheLimiter_unref(MEM_CacheLimiterHandleC *handle);
+
+/**
* Get reference counter.
- *
+ *
* @param This "This" pointer, handle of object
*/
-
-extern int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC * handle);
-/**
+int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC *handle);
+
+/**
* Get pointer to managed object
- *
+ *
* @param handle of object
*/
-
-extern void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC * handle);
+
+void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC *handle);
+
+void MEM_CacheLimiter_ItemPriority_Func_set(MEM_CacheLimiterC *This,
+ MEM_CacheLimiter_ItemPriority_Func item_priority_func);
#ifdef __cplusplus
}
diff --git a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
index cfa6a207e1c..81a1ce670ae 100644
--- a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
+++ b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
@@ -31,7 +31,7 @@
static size_t & get_max()
{
- static size_t m = 32*1024*1024;
+ static size_t m = 32 * 1024 * 1024;
return m;
}
@@ -50,8 +50,7 @@ class MEM_CacheLimiterCClass;
typedef MEM_CacheLimiterHandle<MEM_CacheLimiterHandleCClass> handle_t;
typedef MEM_CacheLimiter<MEM_CacheLimiterHandleCClass> cache_t;
-typedef std::list<MEM_CacheLimiterHandleCClass*,
- MEM_Allocator<MEM_CacheLimiterHandleCClass* > > list_t;
+typedef std::list<MEM_CacheLimiterHandleCClass*, MEM_Allocator<MEM_CacheLimiterHandleCClass* > > list_t;
class MEM_CacheLimiterCClass {
public:
@@ -59,11 +58,10 @@ public:
: data_destructor(data_destructor_), cache(data_size) {
}
~MEM_CacheLimiterCClass();
-
+
handle_t * insert(void * data);
- void destruct(void * data,
- list_t::iterator it);
+ void destruct(void * data, list_t::iterator it);
cache_t * get_cache() {
return &cache;
@@ -72,42 +70,48 @@ private:
MEM_CacheLimiter_Destruct_Func data_destructor;
MEM_CacheLimiter<MEM_CacheLimiterHandleCClass> cache;
-
+
list_t cclass_list;
};
class MEM_CacheLimiterHandleCClass {
public:
- MEM_CacheLimiterHandleCClass(void * data_,
- MEM_CacheLimiterCClass * parent_)
- : data(data_), parent(parent_) { }
+ MEM_CacheLimiterHandleCClass(void * data_, MEM_CacheLimiterCClass * parent_) :
+ data(data_),
+ parent(parent_)
+ { }
+
~MEM_CacheLimiterHandleCClass();
+
void set_iter(list_t::iterator it_) {
it = it_;
}
+
void set_data(void * data_) {
data = data_;
}
- void * get_data() const {
+
+ void *get_data() const {
return data;
}
+
private:
- void * data;
- MEM_CacheLimiterCClass * parent;
+ void *data;
+ MEM_CacheLimiterCClass *parent;
list_t::iterator it;
};
-handle_t * MEM_CacheLimiterCClass::insert(void * data)
+handle_t *MEM_CacheLimiterCClass::insert(void * data)
{
cclass_list.push_back(new MEM_CacheLimiterHandleCClass(data, this));
list_t::iterator it = cclass_list.end();
--it;
cclass_list.back()->set_iter(it);
-
+
return cache.insert(cclass_list.back());
}
-void MEM_CacheLimiterCClass::destruct(void * data, list_t::iterator it)
+void MEM_CacheLimiterCClass::destruct(void * data, list_t::iterator it)
{
data_destructor(data);
cclass_list.erase(it);
@@ -123,77 +127,78 @@ MEM_CacheLimiterHandleCClass::~MEM_CacheLimiterHandleCClass()
MEM_CacheLimiterCClass::~MEM_CacheLimiterCClass()
{
// should not happen, but don't leak memory in this case...
- for (list_t::iterator it = cclass_list.begin();
- it != cclass_list.end(); it++) {
+ for (list_t::iterator it = cclass_list.begin(); it != cclass_list.end(); it++) {
(*it)->set_data(0);
+
delete *it;
}
}
// ----------------------------------------------------------------------
-static inline MEM_CacheLimiterCClass* cast(MEM_CacheLimiterC * l)
+static inline MEM_CacheLimiterCClass *cast(MEM_CacheLimiterC *l)
{
- return (MEM_CacheLimiterCClass*) l;
+ return (MEM_CacheLimiterCClass *) l;
}
-static inline handle_t* cast(MEM_CacheLimiterHandleC * l)
+static inline handle_t *cast(MEM_CacheLimiterHandleC *l)
{
- return (handle_t*) l;
+ return (handle_t *) l;
}
-MEM_CacheLimiterC * new_MEM_CacheLimiter(
- MEM_CacheLimiter_Destruct_Func data_destructor,
- MEM_CacheLimiter_DataSize_Func data_size)
+MEM_CacheLimiterC *new_MEM_CacheLimiter(MEM_CacheLimiter_Destruct_Func data_destructor,
+ MEM_CacheLimiter_DataSize_Func data_size)
{
- return (MEM_CacheLimiterC*) new MEM_CacheLimiterCClass(
- data_destructor,
- data_size);
+ return (MEM_CacheLimiterC *) new MEM_CacheLimiterCClass(data_destructor, data_size);
}
-void delete_MEM_CacheLimiter(MEM_CacheLimiterC * This)
+void delete_MEM_CacheLimiter(MEM_CacheLimiterC *This)
{
delete cast(This);
}
-MEM_CacheLimiterHandleC * MEM_CacheLimiter_insert(
- MEM_CacheLimiterC * This, void * data)
+MEM_CacheLimiterHandleC *MEM_CacheLimiter_insert(MEM_CacheLimiterC *This, void *data)
{
return (MEM_CacheLimiterHandleC *) cast(This)->insert(data);
}
-void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC * This)
+void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC *This)
{
cast(This)->get_cache()->enforce_limits();
}
-
-void MEM_CacheLimiter_unmanage(MEM_CacheLimiterHandleC * handle)
+
+void MEM_CacheLimiter_unmanage(MEM_CacheLimiterHandleC *handle)
{
cast(handle)->unmanage();
}
-
-void MEM_CacheLimiter_touch(MEM_CacheLimiterHandleC * handle)
+
+void MEM_CacheLimiter_touch(MEM_CacheLimiterHandleC *handle)
{
cast(handle)->touch();
}
-
-void MEM_CacheLimiter_ref(MEM_CacheLimiterHandleC * handle)
+
+void MEM_CacheLimiter_ref(MEM_CacheLimiterHandleC *handle)
{
cast(handle)->ref();
}
-
-void MEM_CacheLimiter_unref(MEM_CacheLimiterHandleC * handle)
+
+void MEM_CacheLimiter_unref(MEM_CacheLimiterHandleC *handle)
{
cast(handle)->unref();
}
-int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC * handle)
+int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC *handle)
{
return cast(handle)->get_refcount();
}
-
-void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC * handle)
+void *MEM_CacheLimiter_get(MEM_CacheLimiterHandleC *handle)
{
return cast(handle)->get()->get_data();
}
+
+void MEM_CacheLimiter_ItemPriority_Func_set(MEM_CacheLimiterC *This,
+ MEM_CacheLimiter_ItemPriority_Func item_priority_func)
+{
+ cast(This)->get_cache()->set_item_priority_func(item_priority_func);
+}
diff --git a/intern/raskter/CMakeLists.txt b/intern/raskter/CMakeLists.txt
index 3e1368d8eb0..de6d2c33b7f 100644
--- a/intern/raskter/CMakeLists.txt
+++ b/intern/raskter/CMakeLists.txt
@@ -33,8 +33,11 @@ set(INC_SYS
set(SRC
raskter.c
+ raskter_mt.c
+ raskter_kdtree.c
raskter.h
+ raskter_kdtree.h
)
blender_add_lib(bf_intern_raskter "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/raskter/raskter.c b/intern/raskter/raskter.c
index b405fde82e8..e2d4809a23c 100644
--- a/intern/raskter/raskter.c
+++ b/intern/raskter/raskter.c
@@ -30,36 +30,13 @@
#include <stdlib.h>
#include "raskter.h"
+//#define __PLX__FAKE_AA__
+//#define __PLX_KD_TREE__
+#ifdef __PLX_KD_TREE__
+#include "kdtree.h"
+#endif
+
-#define __PLX__FAKE_AA__
-
-/* from BLI_utildefines.h */
-#define MIN2(x, y) ( (x) < (y) ? (x) : (y) )
-#define MAX2(x, y) ( (x) > (y) ? (x) : (y) )
-#define ABS(a) ( (a) < 0 ? (-(a)) : (a) )
-
-struct e_status {
- int x;
- int ybeg;
- int xshift;
- int xdir;
- int drift;
- int drift_inc;
- int drift_dec;
- int num;
- struct e_status *e_next;
-};
-
-struct r_buffer_stats {
- float *buf;
- int sizex;
- int sizey;
-};
-
-struct r_fill_context {
- struct e_status *all_edges, *possible_edges;
- struct r_buffer_stats rb;
-};
/*
* Sort all the edges of the input polygon by Y, then by X, of the "first" vertex encountered.
@@ -69,102 +46,113 @@ struct r_fill_context {
* just the poly. Since the DEM code could end up being coupled with this, we'll keep it separate
* for now.
*/
-static void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, struct e_status *open_edge)
-{
- int i;
- int xbeg;
- int ybeg;
- int xend;
- int yend;
- int dx;
- int dy;
- int temp_pos;
- int xdist;
- struct e_status *e_new;
- struct e_status *next_edge;
- struct e_status **next_edge_ref;
- struct poly_vert *v;
- /* set up pointers */
- v = verts;
- ctx->all_edges = NULL;
- /* loop all verts */
- for (i = 0; i < num_verts; i++) {
- /* determine beginnings and endings of edges, linking last vertex to first vertex */
- xbeg = v[i].x;
- ybeg = v[i].y;
- if (i) {
- /* we're not at the last vert, so end of the edge is the previous vertex */
- xend = v[i - 1].x;
- yend = v[i - 1].y;
- }
- else {
- /* we're at the first vertex, so the "end" of this edge is the last vertex */
- xend = v[num_verts - 1].x;
- yend = v[num_verts - 1].y;
- }
- /* make sure our edges are facing the correct direction */
- if (ybeg > yend) {
- /* flip the Xs */
- temp_pos = xbeg;
- xbeg = xend;
- xend = temp_pos;
- /* flip the Ys */
- temp_pos = ybeg;
- ybeg = yend;
- yend = temp_pos;
- }
-
- /* calculate y delta */
- dy = yend - ybeg;
- /* dont draw horizontal lines directly, they are scanned as part of the edges they connect, so skip em. :) */
- if (dy) {
- /* create the edge and determine it's slope (for incremental line drawing) */
- e_new = open_edge++;
-
- /* calculate x delta */
- dx = xend - xbeg;
- if (dx > 0) {
- e_new->xdir = 1;
- xdist = dx;
- }
- else {
- e_new->xdir = -1;
- xdist = -dx;
- }
-
- e_new->x = xbeg;
- e_new->ybeg = ybeg;
- e_new->num = dy;
- e_new->drift_dec = dy;
-
- /* calculate deltas for incremental drawing */
- if (dx >= 0) {
- e_new->drift = 0;
- }
- else {
- e_new->drift = -dy + 1;
- }
- if (dy >= xdist) {
- e_new->drift_inc = xdist;
- e_new->xshift = 0;
- }
- else {
- e_new->drift_inc = xdist % dy;
- e_new->xshift = (xdist / dy) * e_new->xdir;
- }
- next_edge_ref = &ctx->all_edges;
- /* link in all the edges, in sorted order */
- for (;; ) {
- next_edge = *next_edge_ref;
- if (!next_edge || (next_edge->ybeg > ybeg) || ((next_edge->ybeg == ybeg) && (next_edge->x >= xbeg))) {
- e_new->e_next = next_edge;
- *next_edge_ref = e_new;
- break;
- }
- next_edge_ref = &next_edge->e_next;
- }
- }
- }
+void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, struct e_status *open_edge) {
+ int i;
+ int xbeg;
+ int ybeg;
+ int xend;
+ int yend;
+ int dx;
+ int dy;
+ int temp_pos;
+ int xdist;
+ struct e_status *e_new;
+ struct e_status *next_edge;
+ struct e_status **next_edge_ref;
+ struct poly_vert *v;
+ /* set up pointers */
+ v = verts;
+ ctx->all_edges = NULL;
+ /* initialize some boundaries */
+ ctx->rb.xmax = v[0].x;
+ ctx->rb.xmin = v[0].x;
+ ctx->rb.ymax = v[0].y;
+ ctx->rb.ymin = v[0].y;
+ /* loop all verts */
+ for(i = 0; i < num_verts; i++) {
+ /* determine beginnings and endings of edges, linking last vertex to first vertex */
+ xbeg = v[i].x;
+ ybeg = v[i].y;
+ /* keep track of our x and y bounds */
+ if(xbeg >= ctx->rb.xmax) {
+ ctx->rb.xmax = xbeg;
+ } else if(xbeg <= ctx->rb.xmin) {
+ ctx->rb.xmin = xbeg;
+ }
+ if(ybeg >= ctx->rb.ymax) {
+ ctx->rb.ymax= ybeg;
+ } else if(ybeg <= ctx->rb.ymin) {
+ ctx->rb.ymin=ybeg;
+ }
+ if(i) {
+ /* we're not at the last vert, so end of the edge is the previous vertex */
+ xend = v[i - 1].x;
+ yend = v[i - 1].y;
+ } else {
+ /* we're at the first vertex, so the "end" of this edge is the last vertex */
+ xend = v[num_verts - 1].x;
+ yend = v[num_verts - 1].y;
+ }
+ /* make sure our edges are facing the correct direction */
+ if(ybeg > yend) {
+ /* flip the Xs */
+ temp_pos = xbeg;
+ xbeg = xend;
+ xend = temp_pos;
+ /* flip the Ys */
+ temp_pos = ybeg;
+ ybeg = yend;
+ yend = temp_pos;
+ }
+
+ /* calculate y delta */
+ dy = yend - ybeg;
+ /* dont draw horizontal lines directly, they are scanned as part of the edges they connect, so skip em. :) */
+ if(dy) {
+ /* create the edge and determine it's slope (for incremental line drawing) */
+ e_new = open_edge++;
+
+ /* calculate x delta */
+ dx = xend - xbeg;
+ if(dx > 0) {
+ e_new->xdir = 1;
+ xdist = dx;
+ } else {
+ e_new->xdir = -1;
+ xdist = -dx;
+ }
+
+ e_new->x = xbeg;
+ e_new->ybeg = ybeg;
+ e_new->num = dy;
+ e_new->drift_dec = dy;
+
+ /* calculate deltas for incremental drawing */
+ if(dx >= 0) {
+ e_new->drift = 0;
+ } else {
+ e_new->drift = -dy + 1;
+ }
+ if(dy >= xdist) {
+ e_new->drift_inc = xdist;
+ e_new->xshift = 0;
+ } else {
+ e_new->drift_inc = xdist % dy;
+ e_new->xshift = (xdist / dy) * e_new->xdir;
+ }
+ next_edge_ref = &ctx->all_edges;
+ /* link in all the edges, in sorted order */
+ for(;;) {
+ next_edge = *next_edge_ref;
+ if(!next_edge || (next_edge->ybeg > ybeg) || ((next_edge->ybeg == ybeg) && (next_edge->x >= xbeg))) {
+ e_new->e_next = next_edge;
+ *next_edge_ref = e_new;
+ break;
+ }
+ next_edge_ref = &next_edge->e_next;
+ }
+ }
+ }
}
/*
@@ -172,281 +160,275 @@ static void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *v
* for speed, but waiting on final design choices for curve-data before eliminating data the DEM code will need
* if it ends up being coupled with this function.
*/
-static int rast_scan_fill(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, float intensity)
-{
- int x_curr; /* current pixel position in X */
- int y_curr; /* current scan line being drawn */
- int yp; /* y-pixel's position in frame buffer */
- int swixd = 0; /* whether or not edges switched position in X */
- float *cpxl; /* pixel pointers... */
- float *mpxl;
- float *spxl;
- struct e_status *e_curr; /* edge pointers... */
- struct e_status *e_temp;
- struct e_status *edgbuf;
- struct e_status **edgec;
-
-
- /*
- * If the number of verts specified to render as a polygon is less than 3,
- * return immediately. Obviously we cant render a poly with sides < 3. The
- * return for this we set to 1, simply so it can be distinguished from the
- * next place we could return.
- * which is a failure to allocate memory.
- */
- if (num_verts < 3) {
- return(1);
- }
-
- /*
- * Try to allocate an edge buffer in memory. needs to be the size of the edge tracking data
- * multiplied by the number of edges, which is always equal to the number of verts in
- * a 2D polygon. Here we return 0 to indicate a memory allocation failure, as opposed to a 1 for
- * the preceeding error, which was a rasterization request on a 2D poly with less than
- * 3 sides.
- */
- if ((edgbuf = (struct e_status *)(malloc(sizeof(struct e_status) * num_verts))) == NULL) {
- return(0);
- }
-
- /*
- * Do some preprocessing on all edges. This constructs a table structure in memory of all
- * the edge properties and can "flip" some edges so sorting works correctly.
- */
- preprocess_all_edges(ctx, verts, num_verts, edgbuf);
-
- /* can happen with a zero area mask */
- if (ctx->all_edges == NULL) {
- free(edgbuf);
- return(1);
- }
-
- /*
- * Set the pointer for tracking the edges currently in processing to NULL to make sure
- * we don't get some crazy value after initialization.
- */
- ctx->possible_edges = NULL;
-
- /*
- * Loop through all scan lines to be drawn. Since we sorted by Y values during
- * preprocess_all_edges(), we can already exact values for the lowest and
- * highest Y values we could possibly need by induction. The preprocessing sorted
- * out edges by Y position, we can cycle the current edge being processed once
- * it runs out of Y pixels. When we have no more edges, meaning the current edge
- * is NULL after setting the "current" edge to be the previous current edge's
- * "next" edge in the Y sorted edge connection chain, we can stop looping Y values,
- * since we can't possibly have more scan lines if we ran out of edges. :)
- *
- * TODO: This clips Y to the frame buffer, which should be done in the preprocessor, but for now is done here.
- * Will get changed once DEM code gets in.
- */
- for (y_curr = ctx->all_edges->ybeg; (ctx->all_edges || ctx->possible_edges); y_curr++) {
-
- /*
- * Link any edges that start on the current scan line into the list of
- * edges currently needed to draw at least this, if not several, scan lines.
- */
-
- /*
- * Set the current edge to the beginning of the list of edges to be rasterized
- * into this scan line.
- *
- * We could have lots of edge here, so iterate over all the edges needed. The
- * preprocess_all_edges() function sorted edges by X within each chunk of Y sorting
- * so we safely cycle edges to thier own "next" edges in order.
- *
- * At each iteration, make sure we still have a non-NULL edge.
- */
- for (edgec = &ctx->possible_edges; ctx->all_edges && (ctx->all_edges->ybeg == y_curr); ) {
- x_curr = ctx->all_edges->x; /* Set current X position. */
- for (;; ) { /* Start looping edges. Will break when edges run out. */
- e_curr = *edgec; /* Set up a current edge pointer. */
- if (!e_curr || (e_curr->x >= x_curr)) { /* If we have an no edge, or we need to skip some X-span, */
- e_temp = ctx->all_edges->e_next; /* set a temp "next" edge to test. */
- *edgec = ctx->all_edges; /* Add this edge to the list to be scanned. */
- ctx->all_edges->e_next = e_curr; /* Set up the next edge. */
- edgec = &ctx->all_edges->e_next; /* Set our list to the next edge's location in memory. */
- ctx->all_edges = e_temp; /* Skip the NULL or bad X edge, set pointer to next edge. */
- break; /* Stop looping edges (since we ran out or hit empty X span. */
- }
- else {
- edgec = &e_curr->e_next; /* Set the pointer to the edge list the "next" edge. */
- }
- }
- }
-
- /*
- * Determine the current scan line's offset in the pixel buffer based on its Y position.
- * Basically we just multiply the current scan line's Y value by the number of pixels in each line.
- */
- yp = y_curr * ctx->rb.sizex;
- /*
- * Set a "scan line pointer" in memory. The location of the buffer plus the row offset.
- */
- spxl = ctx->rb.buf + (yp);
- /*
- * Set up the current edge to the first (in X) edge. The edges which could possibly be in this
- * list were determined in the preceeding edge loop above. They were already sorted in X by the
- * initial processing function.
- *
- * At each iteration, test for a NULL edge. Since we'll keep cycling edge's to their own "next" edge
- * we will eventually hit a NULL when the list runs out.
- */
- for (e_curr = ctx->possible_edges; e_curr; e_curr = e_curr->e_next) {
- /*
- * Calculate a span of pixels to fill on the current scan line.
- *
- * Set the current pixel pointer by adding the X offset to the scan line's start offset.
- * Cycle the current edge the next edge.
- * Set the max X value to draw to be one less than the next edge's first pixel. This way we are
- * sure not to ever get into a situation where we have overdraw. (drawing the same pixel more than
- * one time because it's on a vertex connecting two edges)
- *
- * Then blast through all the pixels in the span, advancing the pointer and setting the color to white.
- *
- * TODO: Here we clip to the scan line, this is not efficient, and should be done in the preprocessor,
- * but for now it is done here until the DEM code comes in.
- */
-
- /* set up xmin and xmax bounds on this scan line */
- cpxl = spxl + MAX2(e_curr->x, 0);
- e_curr = e_curr->e_next;
- mpxl = spxl + MIN2(e_curr->x, ctx->rb.sizex) - 1;
-
- if ((y_curr >= 0) && (y_curr < ctx->rb.sizey)) {
- /* draw the pixels. */
- for(; cpxl <= mpxl; *cpxl++ += intensity);
- }
- }
-
- /*
- * Loop through all edges of polygon that could be hit by this scan line,
- * and figure out their x-intersections with the next scan line.
- *
- * Either A.) we wont have any more edges to test, or B.) we just add on the
- * slope delta computed in preprocessing step. Since this draws non-antialiased
- * polygons, we dont have fractional positions, so we only move in x-direction
- * when needed to get all the way to the next pixel over...
- */
- for (edgec = &ctx->possible_edges; (e_curr = *edgec); ) {
- if (!(--(e_curr->num))) {
- *edgec = e_curr->e_next;
- }
- else {
- e_curr->x += e_curr->xshift;
- if ((e_curr->drift += e_curr->drift_inc) > 0) {
- e_curr->x += e_curr->xdir;
- e_curr->drift -= e_curr->drift_dec;
- }
- edgec = &e_curr->e_next;
- }
- }
- /*
- * It's possible that some edges may have crossed during the last step, so we'll be sure
- * that we ALWAYS intersect scan lines in order by shuffling if needed to make all edges
- * sorted by x-intersection coordinate. We'll always scan through at least once to see if
- * edges crossed, and if so, we set the 'swixd' flag. If 'swixd' gets set on the initial
- * pass, then we know we need to sort by x, so then cycle through edges again and perform
- * the sort.-
- */
- if (ctx->possible_edges) {
- for (edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
- /* if the current edge hits scan line at greater X than the next edge, we need to exchange the edges */
- if (e_curr->x > e_curr->e_next->x) {
- *edgec = e_curr->e_next;
- /* exchange the pointers */
- e_temp = e_curr->e_next->e_next;
- e_curr->e_next->e_next = e_curr;
- e_curr->e_next = e_temp;
- /* set flag that we had at least one switch */
- swixd = 1;
- }
- }
- /* if we did have a switch, look for more (there will more if there was one) */
- for (;; ) {
- /* reset exchange flag so it's only set if we encounter another one */
- swixd = 0;
- for (edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
- /* again, if current edge hits scan line at higher X than next edge, exchange the edges and set flag */
- if (e_curr->x > e_curr->e_next->x) {
- *edgec = e_curr->e_next;
- /* exchange the pointers */
- e_temp = e_curr->e_next->e_next;
- e_curr->e_next->e_next = e_curr;
- e_curr->e_next = e_temp;
- /* flip the exchanged flag */
- swixd = 1;
- }
- }
- /* if we had no exchanges, we're done reshuffling the pointers */
- if (!swixd) {
- break;
- }
- }
- }
- }
-
- free(edgbuf);
- return 1;
+static int rast_scan_fill(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, float intensity) {
+ int x_curr; /* current pixel position in X */
+ int y_curr; /* current scan line being drawn */
+ int yp; /* y-pixel's position in frame buffer */
+ int swixd = 0; /* whether or not edges switched position in X */
+ float *cpxl; /* pixel pointers... */
+ float *mpxl;
+ float *spxl;
+ struct e_status *e_curr; /* edge pointers... */
+ struct e_status *e_temp;
+ struct e_status *edgbuf;
+ struct e_status **edgec;
+
+
+ /*
+ * If the number of verts specified to render as a polygon is less than 3,
+ * return immediately. Obviously we cant render a poly with sides < 3. The
+ * return for this we set to 1, simply so it can be distinguished from the
+ * next place we could return, /home/guest/blender-svn/soc-2011-tomato/intern/raskter/raskter.
+ * which is a failure to allocate memory.
+ */
+ if(num_verts < 3) {
+ return(1);
+ }
+
+ /*
+ * Try to allocate an edge buffer in memory. needs to be the size of the edge tracking data
+ * multiplied by the number of edges, which is always equal to the number of verts in
+ * a 2D polygon. Here we return 0 to indicate a memory allocation failure, as opposed to a 1 for
+ * the preceeding error, which was a rasterization request on a 2D poly with less than
+ * 3 sides.
+ */
+ if((edgbuf = (struct e_status *)(malloc(sizeof(struct e_status) * num_verts))) == NULL) {
+ return(0);
+ }
+
+ /*
+ * Do some preprocessing on all edges. This constructs a table structure in memory of all
+ * the edge properties and can "flip" some edges so sorting works correctly.
+ */
+ preprocess_all_edges(ctx, verts, num_verts, edgbuf);
+
+ /* can happen with a zero area mask */
+ if (ctx->all_edges == NULL) {
+ free(edgbuf);
+ return(1);
+ }
+ /*
+ * Set the pointer for tracking the edges currently in processing to NULL to make sure
+ * we don't get some crazy value after initialization.
+ */
+ ctx->possible_edges = NULL;
+
+ /*
+ * Loop through all scan lines to be drawn. Since we sorted by Y values during
+ * preprocess_all_edges(), we can already exact values for the lowest and
+ * highest Y values we could possibly need by induction. The preprocessing sorted
+ * out edges by Y position, we can cycle the current edge being processed once
+ * it runs out of Y pixels. When we have no more edges, meaning the current edge
+ * is NULL after setting the "current" edge to be the previous current edge's
+ * "next" edge in the Y sorted edge connection chain, we can stop looping Y values,
+ * since we can't possibly have more scan lines if we ran out of edges. :)
+ *
+ * TODO: This clips Y to the frame buffer, which should be done in the preprocessor, but for now is done here.
+ * Will get changed once DEM code gets in.
+ */
+ for(y_curr = ctx->all_edges->ybeg; (ctx->all_edges || ctx->possible_edges); y_curr++) {
+
+ /*
+ * Link any edges that start on the current scan line into the list of
+ * edges currently needed to draw at least this, if not several, scan lines.
+ */
+
+ /*
+ * Set the current edge to the beginning of the list of edges to be rasterized
+ * into this scan line.
+ *
+ * We could have lots of edge here, so iterate over all the edges needed. The
+ * preprocess_all_edges() function sorted edges by X within each chunk of Y sorting
+ * so we safely cycle edges to thier own "next" edges in order.
+ *
+ * At each iteration, make sure we still have a non-NULL edge.
+ */
+ for(edgec = &ctx->possible_edges; ctx->all_edges && (ctx->all_edges->ybeg == y_curr);) {
+ x_curr = ctx->all_edges->x; /* Set current X position. */
+ for(;;) { /* Start looping edges. Will break when edges run out. */
+ e_curr = *edgec; /* Set up a current edge pointer. */
+ if(!e_curr || (e_curr->x >= x_curr)) { /* If we have an no edge, or we need to skip some X-span, */
+ e_temp = ctx->all_edges->e_next; /* set a temp "next" edge to test. */
+ *edgec = ctx->all_edges; /* Add this edge to the list to be scanned. */
+ ctx->all_edges->e_next = e_curr; /* Set up the next edge. */
+ edgec = &ctx->all_edges->e_next; /* Set our list to the next edge's location in memory. */
+ ctx->all_edges = e_temp; /* Skip the NULL or bad X edge, set pointer to next edge. */
+ break; /* Stop looping edges (since we ran out or hit empty X span. */
+ } else {
+ edgec = &e_curr->e_next; /* Set the pointer to the edge list the "next" edge. */
+ }
+ }
+ }
+
+ /*
+ * Determine the current scan line's offset in the pixel buffer based on its Y position.
+ * Basically we just multiply the current scan line's Y value by the number of pixels in each line.
+ */
+ yp = y_curr * ctx->rb.sizex;
+ /*
+ * Set a "scan line pointer" in memory. The location of the buffer plus the row offset.
+ */
+ spxl = ctx->rb.buf + (yp);
+ /*
+ * Set up the current edge to the first (in X) edge. The edges which could possibly be in this
+ * list were determined in the preceeding edge loop above. They were already sorted in X by the
+ * initial processing function.
+ *
+ * At each iteration, test for a NULL edge. Since we'll keep cycling edge's to their own "next" edge
+ * we will eventually hit a NULL when the list runs out.
+ */
+ for(e_curr = ctx->possible_edges; e_curr; e_curr = e_curr->e_next) {
+ /*
+ * Calculate a span of pixels to fill on the current scan line.
+ *
+ * Set the current pixel pointer by adding the X offset to the scan line's start offset.
+ * Cycle the current edge the next edge.
+ * Set the max X value to draw to be one less than the next edge's first pixel. This way we are
+ * sure not to ever get into a situation where we have overdraw. (drawing the same pixel more than
+ * one time because it's on a vertex connecting two edges)
+ *
+ * Then blast through all the pixels in the span, advancing the pointer and setting the color to white.
+ *
+ * TODO: Here we clip to the scan line, this is not efficient, and should be done in the preprocessor,
+ * but for now it is done here until the DEM code comes in.
+ */
+
+ /* set up xmin and xmax bounds on this scan line */
+ cpxl = spxl + MAX2(e_curr->x, 0);
+ e_curr = e_curr->e_next;
+ mpxl = spxl + MIN2(e_curr->x, ctx->rb.sizex) - 1;
+
+ if((y_curr >= 0) && (y_curr < ctx->rb.sizey)) {
+ /* draw the pixels. */
+ for(; cpxl <= mpxl; *cpxl++ += intensity);
+ }
+ }
+
+ /*
+ * Loop through all edges of polygon that could be hit by this scan line,
+ * and figure out their x-intersections with the next scan line.
+ *
+ * Either A.) we wont have any more edges to test, or B.) we just add on the
+ * slope delta computed in preprocessing step. Since this draws non-antialiased
+ * polygons, we dont have fractional positions, so we only move in x-direction
+ * when needed to get all the way to the next pixel over...
+ */
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec);) {
+ if(!(--(e_curr->num))) {
+ *edgec = e_curr->e_next;
+ } else {
+ e_curr->x += e_curr->xshift;
+ if((e_curr->drift += e_curr->drift_inc) > 0) {
+ e_curr->x += e_curr->xdir;
+ e_curr->drift -= e_curr->drift_dec;
+ }
+ edgec = &e_curr->e_next;
+ }
+ }
+ /*
+ * It's possible that some edges may have crossed during the last step, so we'll be sure
+ * that we ALWAYS intersect scan lines in order by shuffling if needed to make all edges
+ * sorted by x-intersection coordinate. We'll always scan through at least once to see if
+ * edges crossed, and if so, we set the 'swixd' flag. If 'swixd' gets set on the initial
+ * pass, then we know we need to sort by x, so then cycle through edges again and perform
+ * the sort.-
+ */
+ if(ctx->possible_edges) {
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
+ /* if the current edge hits scan line at greater X than the next edge, we need to exchange the edges */
+ if(e_curr->x > e_curr->e_next->x) {
+ *edgec = e_curr->e_next;
+ /* exchange the pointers */
+ e_temp = e_curr->e_next->e_next;
+ e_curr->e_next->e_next = e_curr;
+ e_curr->e_next = e_temp;
+ /* set flag that we had at least one switch */
+ swixd = 1;
+ }
+ }
+ /* if we did have a switch, look for more (there will more if there was one) */
+ for(;;) {
+ /* reset exchange flag so it's only set if we encounter another one */
+ swixd = 0;
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
+ /* again, if current edge hits scan line at higher X than next edge, exchange the edges and set flag */
+ if(e_curr->x > e_curr->e_next->x) {
+ *edgec = e_curr->e_next;
+ /* exchange the pointers */
+ e_temp = e_curr->e_next->e_next;
+ e_curr->e_next->e_next = e_curr;
+ e_curr->e_next = e_temp;
+ /* flip the exchanged flag */
+ swixd = 1;
+ }
+ }
+ /* if we had no exchanges, we're done reshuffling the pointers */
+ if(!swixd) {
+ break;
+ }
+ }
+ }
+ }
+
+ free(edgbuf);
+ return 1;
}
-int PLX_raskterize(float (*base_verts)[2], int num_base_verts,
- float *buf, int buf_x, int buf_y, int do_mask_AA)
-{
- int subdiv_AA = (do_mask_AA != 0) ? 8 : 0;
- int i; /* i: Loop counter. */
- int sAx;
- int sAy;
- struct poly_vert *ply; /* ply: Pointer to a list of integer buffer-space vertex coordinates. */
- struct r_fill_context ctx = {0};
- const float buf_x_f = (float)(buf_x);
- const float buf_y_f = (float)(buf_y);
- float div_offset = (1.0f / (float)(subdiv_AA));
- float div_offset_static = 0.5f * (float)(subdiv_AA) * div_offset;
- /*
- * Allocate enough memory for our poly_vert list. It'll be the size of the poly_vert
- * data structure multiplied by the number of base_verts.
- *
- * In the event of a failure to allocate the memory, return 0, so this error can
- * be distinguished as a memory allocation error.
- */
- if ((ply = (struct poly_vert *)(malloc(sizeof(struct poly_vert) * num_base_verts))) == NULL) {
- return(0);
- }
-
- ctx.rb.buf = buf; /* Set the output buffer pointer. */
- ctx.rb.sizex = buf_x; /* Set the output buffer size in X. (width) */
- ctx.rb.sizey = buf_y; /* Set the output buffer size in Y. (height) */
- /*
- * Loop over all verts passed in to be rasterized. Each vertex's X and Y coordinates are
- * then converted from normalized screen space (0.0 <= POS <= 1.0) to integer coordinates
- * in the buffer-space coordinates passed in inside buf_x and buf_y.
- *
- * It's worth noting that this function ONLY outputs fully white pixels in a mask. Every pixel
- * drawn will be 1.0f in value, there is no anti-aliasing.
- */
-
- if (!subdiv_AA) {
- for (i = 0; i < num_base_verts; i++) { /* Loop over all base_verts. */
- ply[i].x = (int)((base_verts[i][0] * buf_x_f) + 0.5f); /* Range expand normalized X to integer buffer-space X. */
- ply[i].y = (int)((base_verts[i][1] * buf_y_f) + 0.5f); /* Range expand normalized Y to integer buffer-space Y. */
- }
-
- i = rast_scan_fill(&ctx, ply, num_base_verts, 1.0f); /* Call our rasterizer, passing in the integer coords for each vert. */
- }
- else {
- for (sAx = 0; sAx < subdiv_AA; sAx++) {
- for (sAy = 0; sAy < subdiv_AA; sAy++) {
- for (i = 0; i < num_base_verts; i++) {
- ply[i].x = (int)((base_verts[i][0] * buf_x_f) + 0.5f - div_offset_static + (div_offset * (float)(sAx)));
- ply[i].y = (int)((base_verts[i][1] * buf_y_f) + 0.5f - div_offset_static + (div_offset * (float)(sAy)));
- }
- i = rast_scan_fill(&ctx, ply, num_base_verts, (1.0f / (float)(subdiv_AA * subdiv_AA)));
- }
- }
- }
- free(ply); /* Free the memory allocated for the integer coordinate table. */
- return(i); /* Return the value returned by the rasterizer. */
+int PLX_raskterize(float(*base_verts)[2], int num_base_verts,
+ float *buf, int buf_x, int buf_y, int do_mask_AA) {
+ int subdiv_AA = (do_mask_AA != 0)? 0:0;
+ int i; /* i: Loop counter. */
+ int sAx;
+ int sAy;
+ struct poly_vert *ply; /* ply: Pointer to a list of integer buffer-space vertex coordinates. */
+ struct r_fill_context ctx = {0};
+ const float buf_x_f = (float)(buf_x);
+ const float buf_y_f = (float)(buf_y);
+ float div_offset=(1.0f / (float)(subdiv_AA));
+ float div_offset_static = 0.5f * (float)(subdiv_AA) * div_offset;
+ /*
+ * Allocate enough memory for our poly_vert list. It'll be the size of the poly_vert
+ * data structure multiplied by the number of base_verts.
+ *
+ * In the event of a failure to allocate the memory, return 0, so this error can
+ * be distinguished as a memory allocation error.
+ */
+ if((ply = (struct poly_vert *)(malloc(sizeof(struct poly_vert) * num_base_verts))) == NULL) {
+ return(0);
+ }
+
+ ctx.rb.buf = buf; /* Set the output buffer pointer. */
+ ctx.rb.sizex = buf_x; /* Set the output buffer size in X. (width) */
+ ctx.rb.sizey = buf_y; /* Set the output buffer size in Y. (height) */
+ /*
+ * Loop over all verts passed in to be rasterized. Each vertex's X and Y coordinates are
+ * then converted from normalized screen space (0.0 <= POS <= 1.0) to integer coordinates
+ * in the buffer-space coordinates passed in inside buf_x and buf_y.
+ *
+ * It's worth noting that this function ONLY outputs fully white pixels in a mask. Every pixel
+ * drawn will be 1.0f in value, there is no anti-aliasing.
+ */
+
+ if(!subdiv_AA) {
+ for(i = 0; i < num_base_verts; i++) { /* Loop over all base_verts. */
+ ply[i].x = (int)((base_verts[i][0] * buf_x_f) + 0.5f); /* Range expand normalized X to integer buffer-space X. */
+ ply[i].y = (int)((base_verts[i][1] * buf_y_f) + 0.5f); /* Range expand normalized Y to integer buffer-space Y. */
+ }
+
+ i = rast_scan_fill(&ctx, ply, num_base_verts,1.0f); /* Call our rasterizer, passing in the integer coords for each vert. */
+ } else {
+ for(sAx=0; sAx < subdiv_AA; sAx++) {
+ for(sAy=0; sAy < subdiv_AA; sAy++) {
+ for(i=0; i < num_base_verts; i++) {
+ ply[i].x = (int)((base_verts[i][0]*buf_x_f)+0.5f - div_offset_static + (div_offset*(float)(sAx)));
+ ply[i].y = (int)((base_verts[i][1]*buf_y_f)+0.5f - div_offset_static + (div_offset*(float)(sAy)));
+ }
+ i = rast_scan_fill(&ctx, ply, num_base_verts,(1.0f / (float)(subdiv_AA*subdiv_AA)));
+ }
+ }
+ }
+ free(ply); /* Free the memory allocated for the integer coordinate table. */
+ return(i); /* Return the value returned by the rasterizer. */
}
/*
@@ -455,911 +437,1087 @@ int PLX_raskterize(float (*base_verts)[2], int num_base_verts,
* if it ends up being coupled with this function.
*/
static int rast_scan_feather(struct r_fill_context *ctx,
- float (*base_verts_f)[2], int num_base_verts,
- struct poly_vert *feather_verts, float(*feather_verts_f)[2], int num_feather_verts)
-{
- int x_curr; /* current pixel position in X */
- int y_curr; /* current scan line being drawn */
- int yp; /* y-pixel's position in frame buffer */
- int swixd = 0; /* whether or not edges switched position in X */
- float *cpxl; /* pixel pointers... */
- float *mpxl;
- float *spxl;
- struct e_status *e_curr; /* edge pointers... */
- struct e_status *e_temp;
- struct e_status *edgbuf;
- struct e_status **edgec;
-
- /* from dem */
- int a; // a = temporary pixel index buffer loop counter
- float fsz; // size of the frame
- unsigned int rsl; // long used for finding fast 1.0/sqrt
- float rsf; // float used for finding fast 1.0/sqrt
- const float rsopf = 1.5f; // constant float used for finding fast 1.0/sqrt
-
- //unsigned int gradientFillOffset;
- float t;
- float ud; // ud = unscaled edge distance
- float dmin; // dmin = minimun edge distance
- float odist; // odist = current outer edge distance
- float idist; // idist = current inner edge distance
- float dx; // dx = X-delta (used for distance proportion calculation)
- float dy; // dy = Y-delta (used for distance proportion calculation)
- float xpxw = (1.0f / (float)(ctx->rb.sizex)); // xpxw = normalized pixel width
- float ypxh = (1.0f / (float)(ctx->rb.sizey)); // ypxh = normalized pixel height
-
- /*
- * If the number of verts specified to render as a polygon is less than 3,
- * return immediately. Obviously we cant render a poly with sides < 3. The
- * return for this we set to 1, simply so it can be distinguished from the
- * next place we could return,
- * which is a failure to allocate memory.
- */
- if (num_feather_verts < 3) {
- return(1);
- }
-
- /*
- * Try to allocate an edge buffer in memory. needs to be the size of the edge tracking data
- * multiplied by the number of edges, which is always equal to the number of verts in
- * a 2D polygon. Here we return 0 to indicate a memory allocation failure, as opposed to a 1 for
- * the preceeding error, which was a rasterization request on a 2D poly with less than
- * 3 sides.
- */
- if ((edgbuf = (struct e_status *)(malloc(sizeof(struct e_status) * num_feather_verts))) == NULL) {
- return(0);
- }
-
- /*
- * Do some preprocessing on all edges. This constructs a table structure in memory of all
- * the edge properties and can "flip" some edges so sorting works correctly.
- */
- preprocess_all_edges(ctx, feather_verts, num_feather_verts, edgbuf);
-
- /* can happen with a zero area mask */
- if (ctx->all_edges == NULL) {
- free(edgbuf);
- return(1);
- }
-
- /*
- * Set the pointer for tracking the edges currently in processing to NULL to make sure
- * we don't get some crazy value after initialization.
- */
- ctx->possible_edges = NULL;
-
- /*
- * Loop through all scan lines to be drawn. Since we sorted by Y values during
- * preprocess_all_edges(), we can already exact values for the lowest and
- * highest Y values we could possibly need by induction. The preprocessing sorted
- * out edges by Y position, we can cycle the current edge being processed once
- * it runs out of Y pixels. When we have no more edges, meaning the current edge
- * is NULL after setting the "current" edge to be the previous current edge's
- * "next" edge in the Y sorted edge connection chain, we can stop looping Y values,
- * since we can't possibly have more scan lines if we ran out of edges. :)
- *
- * TODO: This clips Y to the frame buffer, which should be done in the preprocessor, but for now is done here.
- * Will get changed once DEM code gets in.
- */
- for (y_curr = ctx->all_edges->ybeg; (ctx->all_edges || ctx->possible_edges); y_curr++) {
-
- /*
- * Link any edges that start on the current scan line into the list of
- * edges currently needed to draw at least this, if not several, scan lines.
- */
-
- /*
- * Set the current edge to the beginning of the list of edges to be rasterized
- * into this scan line.
- *
- * We could have lots of edge here, so iterate over all the edges needed. The
- * preprocess_all_edges() function sorted edges by X within each chunk of Y sorting
- * so we safely cycle edges to thier own "next" edges in order.
- *
- * At each iteration, make sure we still have a non-NULL edge.
- */
- for (edgec = &ctx->possible_edges; ctx->all_edges && (ctx->all_edges->ybeg == y_curr); ) {
- x_curr = ctx->all_edges->x; /* Set current X position. */
- for (;; ) { /* Start looping edges. Will break when edges run out. */
- e_curr = *edgec; /* Set up a current edge pointer. */
- if (!e_curr || (e_curr->x >= x_curr)) { /* If we have an no edge, or we need to skip some X-span, */
- e_temp = ctx->all_edges->e_next; /* set a temp "next" edge to test. */
- *edgec = ctx->all_edges; /* Add this edge to the list to be scanned. */
- ctx->all_edges->e_next = e_curr; /* Set up the next edge. */
- edgec = &ctx->all_edges->e_next; /* Set our list to the next edge's location in memory. */
- ctx->all_edges = e_temp; /* Skip the NULL or bad X edge, set pointer to next edge. */
- break; /* Stop looping edges (since we ran out or hit empty X span. */
- }
- else {
- edgec = &e_curr->e_next; /* Set the pointer to the edge list the "next" edge. */
- }
- }
- }
-
- /*
- * Determine the current scan line's offset in the pixel buffer based on its Y position.
- * Basically we just multiply the current scan line's Y value by the number of pixels in each line.
- */
- yp = y_curr * ctx->rb.sizex;
- /*
- * Set a "scan line pointer" in memory. The location of the buffer plus the row offset.
- */
- spxl = ctx->rb.buf + (yp);
- /*
- * Set up the current edge to the first (in X) edge. The edges which could possibly be in this
- * list were determined in the preceeding edge loop above. They were already sorted in X by the
- * initial processing function.
- *
- * At each iteration, test for a NULL edge. Since we'll keep cycling edge's to their own "next" edge
- * we will eventually hit a NULL when the list runs out.
- */
- for (e_curr = ctx->possible_edges; e_curr; e_curr = e_curr->e_next) {
- /*
- * Calculate a span of pixels to fill on the current scan line.
- *
- * Set the current pixel pointer by adding the X offset to the scan line's start offset.
- * Cycle the current edge the next edge.
- * Set the max X value to draw to be one less than the next edge's first pixel. This way we are
- * sure not to ever get into a situation where we have overdraw. (drawing the same pixel more than
- * one time because it's on a vertex connecting two edges)
- *
- * Then blast through all the pixels in the span, advancing the pointer and setting the color to white.
- *
- * TODO: Here we clip to the scan line, this is not efficient, and should be done in the preprocessor,
- * but for now it is done here until the DEM code comes in.
- */
-
- /* set up xmin and xmax bounds on this scan line */
- cpxl = spxl + MAX2(e_curr->x, 0);
- e_curr = e_curr->e_next;
- mpxl = spxl + MIN2(e_curr->x, ctx->rb.sizex) - 1;
-
- if ((y_curr >= 0) && (y_curr < ctx->rb.sizey)) {
- t = ((float)((cpxl - spxl) % ctx->rb.sizex) + 0.5f) * xpxw;
- fsz = ((float)(y_curr) + 0.5f) * ypxh;
- /* draw the pixels. */
- for (; cpxl <= mpxl; cpxl++, t += xpxw) {
- //do feather check
- // first check that pixel isn't already full, and only operate if it is not
- if (*cpxl < 0.9999f) {
-
- dmin = 2.0f; // reset min distance to edge pixel
- for (a = 0; a < num_feather_verts; a++) { // loop through all outer edge buffer pixels
- dy = t - feather_verts_f[a][0]; // set dx to gradient pixel column - outer edge pixel row
- dx = fsz - feather_verts_f[a][1]; // set dy to gradient pixel row - outer edge pixel column
- ud = dx * dx + dy * dy; // compute sum of squares
- if (ud < dmin) { // if our new sum of squares is less than the current minimum
- dmin = ud; // set a new minimum equal to the new lower value
- }
- }
- odist = dmin; // cast outer min to a float
- rsf = odist * 0.5f; //
- rsl = *(unsigned int *)&odist; // use some peculiar properties of the way bits are stored
- rsl = 0x5f3759df - (rsl >> 1); // in floats vs. unsigned ints to compute an approximate
- odist = *(float *)&rsl; // reciprocal square root
- odist = odist * (rsopf - (rsf * odist * odist)); // -- ** this line can be iterated for more accuracy ** --
- odist = odist * (rsopf - (rsf * odist * odist));
- dmin = 2.0f; // reset min distance to edge pixel
- for (a = 0; a < num_base_verts; a++) { // loop through all inside edge pixels
- dy = t - base_verts_f[a][0]; // compute delta in Y from gradient pixel to inside edge pixel
- dx = fsz - base_verts_f[a][1]; // compute delta in X from gradient pixel to inside edge pixel
- ud = dx * dx + dy * dy; // compute sum of squares
- if (ud < dmin) { // if our new sum of squares is less than the current minimum we've found
- dmin = ud; // set a new minimum equal to the new lower value
- }
- }
- idist = dmin; // cast inner min to a float
- rsf = idist * 0.5f; //
- rsl = *(unsigned int *)&idist; //
- rsl = 0x5f3759df - (rsl >> 1); // see notes above
- idist = *(float *)&rsl; //
- idist = idist * (rsopf - (rsf * idist * idist)); //
- idist = idist * (rsopf - (rsf * idist * idist));
- /*
- * Note once again that since we are using reciprocals of distance values our
- * proportion is already the correct intensity, and does not need to be
- * subracted from 1.0 like it would have if we used real distances.
- */
-
- /* set intensity, do the += so overlapping gradients are additive */
- *cpxl = (idist / (idist + odist));
- }
- }
- }
- }
-
- /*
- * Loop through all edges of polygon that could be hit by this scan line,
- * and figure out their x-intersections with the next scan line.
- *
- * Either A.) we wont have any more edges to test, or B.) we just add on the
- * slope delta computed in preprocessing step. Since this draws non-antialiased
- * polygons, we dont have fractional positions, so we only move in x-direction
- * when needed to get all the way to the next pixel over...
- */
- for (edgec = &ctx->possible_edges; (e_curr = *edgec); ) {
- if (!(--(e_curr->num))) {
- *edgec = e_curr->e_next;
- }
- else {
- e_curr->x += e_curr->xshift;
- if ((e_curr->drift += e_curr->drift_inc) > 0) {
- e_curr->x += e_curr->xdir;
- e_curr->drift -= e_curr->drift_dec;
- }
- edgec = &e_curr->e_next;
- }
- }
- /*
- * It's possible that some edges may have crossed during the last step, so we'll be sure
- * that we ALWAYS intersect scan lines in order by shuffling if needed to make all edges
- * sorted by x-intersection coordinate. We'll always scan through at least once to see if
- * edges crossed, and if so, we set the 'swixd' flag. If 'swixd' gets set on the initial
- * pass, then we know we need to sort by x, so then cycle through edges again and perform
- * the sort.-
- */
- if (ctx->possible_edges) {
- for (edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
- /* if the current edge hits scan line at greater X than the next edge, we need to exchange the edges */
- if (e_curr->x > e_curr->e_next->x) {
- *edgec = e_curr->e_next;
- /* exchange the pointers */
- e_temp = e_curr->e_next->e_next;
- e_curr->e_next->e_next = e_curr;
- e_curr->e_next = e_temp;
- /* set flag that we had at least one switch */
- swixd = 1;
- }
- }
- /* if we did have a switch, look for more (there will more if there was one) */
- for (;; ) {
- /* reset exchange flag so it's only set if we encounter another one */
- swixd = 0;
- for (edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
- /* again, if current edge hits scan line at higher X than next edge,
- * exchange the edges and set flag */
- if (e_curr->x > e_curr->e_next->x) {
- *edgec = e_curr->e_next;
- /* exchange the pointers */
- e_temp = e_curr->e_next->e_next;
- e_curr->e_next->e_next = e_curr;
- e_curr->e_next = e_temp;
- /* flip the exchanged flag */
- swixd = 1;
- }
- }
- /* if we had no exchanges, we're done reshuffling the pointers */
- if (!swixd) {
- break;
- }
- }
- }
- }
-
- free(edgbuf);
- return 1;
+ float(*base_verts_f)[2], int num_base_verts,
+ struct poly_vert *feather_verts, float(*feather_verts_f)[2], int num_feather_verts) {
+ int x_curr; /* current pixel position in X */
+ int y_curr; /* current scan line being drawn */
+ int yp; /* y-pixel's position in frame buffer */
+ int swixd = 0; /* whether or not edges switched position in X */
+ float *cpxl; /* pixel pointers... */
+ float *mpxl;
+ float *spxl;
+ struct e_status *e_curr; /* edge pointers... */
+ struct e_status *e_temp;
+ struct e_status *edgbuf;
+ struct e_status **edgec;
+
+ /* from dem */
+ int a; // a = temporary pixel index buffer loop counter
+ float fsz; // size of the frame
+ unsigned int rsl; // long used for finding fast 1.0/sqrt
+ float rsf; // float used for finding fast 1.0/sqrt
+ const float rsopf = 1.5f; // constant float used for finding fast 1.0/sqrt
+
+ //unsigned int gradientFillOffset;
+ float t;
+ float ud; // ud = unscaled edge distance
+ float dmin; // dmin = minimum edge distance
+ float odist; // odist = current outer edge distance
+ float idist; // idist = current inner edge distance
+ float dx; // dx = X-delta (used for distance proportion calculation)
+ float dy; // dy = Y-delta (used for distance proportion calculation)
+ float xpxw = (1.0f / (float)(ctx->rb.sizex)); // xpxw = normalized pixel width
+ float ypxh = (1.0f / (float)(ctx->rb.sizey)); // ypxh = normalized pixel height
+#ifdef __PLX_KD_TREE__
+ void *res_kdi;
+ void *res_kdo;
+ float clup[2];
+#endif
+
+ /*
+ * If the number of verts specified to render as a polygon is less than 3,
+ * return immediately. Obviously we cant render a poly with sides < 3. The
+ * return for this we set to 1, simply so it can be distinguished from the
+ * next place we could return,
+ * which is a failure to allocate memory.
+ */
+ if(num_feather_verts < 3) {
+ return(1);
+ }
+
+ /*
+ * Try to allocate an edge buffer in memory. needs to be the size of the edge tracking data
+ * multiplied by the number of edges, which is always equal to the number of verts in
+ * a 2D polygon. Here we return 0 to indicate a memory allocation failure, as opposed to a 1 for
+ * the preceeding error, which was a rasterization request on a 2D poly with less than
+ * 3 sides.
+ */
+ if((edgbuf = (struct e_status *)(malloc(sizeof(struct e_status) * num_feather_verts))) == NULL) {
+ return(0);
+ }
+
+ /*
+ * Do some preprocessing on all edges. This constructs a table structure in memory of all
+ * the edge properties and can "flip" some edges so sorting works correctly.
+ */
+ preprocess_all_edges(ctx, feather_verts, num_feather_verts, edgbuf);
+
+ /* can happen with a zero area mask */
+ if (ctx->all_edges == NULL) {
+ free(edgbuf);
+ return(1);
+ }
+
+ /*
+ * Set the pointer for tracking the edges currently in processing to NULL to make sure
+ * we don't get some crazy value after initialization.
+ */
+ ctx->possible_edges = NULL;
+
+ /*
+ * Loop through all scan lines to be drawn. Since we sorted by Y values during
+ * preprocess_all_edges(), we can already exact values for the lowest and
+ * highest Y values we could possibly need by induction. The preprocessing sorted
+ * out edges by Y position, we can cycle the current edge being processed once
+ * it runs out of Y pixels. When we have no more edges, meaning the current edge
+ * is NULL after setting the "current" edge to be the previous current edge's
+ * "next" edge in the Y sorted edge connection chain, we can stop looping Y values,
+ * since we can't possibly have more scan lines if we ran out of edges. :)
+ *
+ * TODO: This clips Y to the frame buffer, which should be done in the preprocessor, but for now is done here.
+ * Will get changed once DEM code gets in.
+ */
+ for(y_curr = ctx->all_edges->ybeg; (ctx->all_edges || ctx->possible_edges); y_curr++) {
+
+ /*
+ * Link any edges that start on the current scan line into the list of
+ * edges currently needed to draw at least this, if not several, scan lines.
+ */
+
+ /*
+ * Set the current edge to the beginning of the list of edges to be rasterized
+ * into this scan line.
+ *
+ * We could have lots of edge here, so iterate over all the edges needed. The
+ * preprocess_all_edges() function sorted edges by X within each chunk of Y sorting
+ * so we safely cycle edges to thier own "next" edges in order.
+ *
+ * At each iteration, make sure we still have a non-NULL edge.
+ */
+ for(edgec = &ctx->possible_edges; ctx->all_edges && (ctx->all_edges->ybeg == y_curr);) {
+ x_curr = ctx->all_edges->x; /* Set current X position. */
+ for(;;) { /* Start looping edges. Will break when edges run out. */
+ e_curr = *edgec; /* Set up a current edge pointer. */
+ if(!e_curr || (e_curr->x >= x_curr)) { /* If we have an no edge, or we need to skip some X-span, */
+ e_temp = ctx->all_edges->e_next; /* set a temp "next" edge to test. */
+ *edgec = ctx->all_edges; /* Add this edge to the list to be scanned. */
+ ctx->all_edges->e_next = e_curr; /* Set up the next edge. */
+ edgec = &ctx->all_edges->e_next; /* Set our list to the next edge's location in memory. */
+ ctx->all_edges = e_temp; /* Skip the NULL or bad X edge, set pointer to next edge. */
+ break; /* Stop looping edges (since we ran out or hit empty X span. */
+ } else {
+ edgec = &e_curr->e_next; /* Set the pointer to the edge list the "next" edge. */
+ }
+ }
+ }
+
+ /*
+ * Determine the current scan line's offset in the pixel buffer based on its Y position.
+ * Basically we just multiply the current scan line's Y value by the number of pixels in each line.
+ */
+ yp = y_curr * ctx->rb.sizex;
+ /*
+ * Set a "scan line pointer" in memory. The location of the buffer plus the row offset.
+ */
+ spxl = ctx->rb.buf + (yp);
+ /*
+ * Set up the current edge to the first (in X) edge. The edges which could possibly be in this
+ * list were determined in the preceeding edge loop above. They were already sorted in X by the
+ * initial processing function.
+ *
+ * At each iteration, test for a NULL edge. Since we'll keep cycling edge's to their own "next" edge
+ * we will eventually hit a NULL when the list runs out.
+ */
+ for(e_curr = ctx->possible_edges; e_curr; e_curr = e_curr->e_next) {
+ /*
+ * Calculate a span of pixels to fill on the current scan line.
+ *
+ * Set the current pixel pointer by adding the X offset to the scan line's start offset.
+ * Cycle the current edge the next edge.
+ * Set the max X value to draw to be one less than the next edge's first pixel. This way we are
+ * sure not to ever get into a situation where we have overdraw. (drawing the same pixel more than
+ * one time because it's on a vertex connecting two edges)
+ *
+ * Then blast through all the pixels in the span, advancing the pointer and setting the color to white.
+ *
+ * TODO: Here we clip to the scan line, this is not efficient, and should be done in the preprocessor,
+ * but for now it is done here until the DEM code comes in.
+ */
+
+ /* set up xmin and xmax bounds on this scan line */
+ cpxl = spxl + MAX2(e_curr->x, 0);
+ e_curr = e_curr->e_next;
+ mpxl = spxl + MIN2(e_curr->x, ctx->rb.sizex) - 1;
+
+ if((y_curr >= 0) && (y_curr < ctx->rb.sizey)) {
+ t = ((float)((cpxl - spxl) % ctx->rb.sizex) + 0.5f) * xpxw;
+ fsz = ((float)(y_curr) + 0.5f) * ypxh;
+ /* draw the pixels. */
+ for(; cpxl <= mpxl; cpxl++, t += xpxw) {
+ //do feather check
+ // first check that pixel isn't already full, and only operate if it is not
+ if(*cpxl < 0.9999f) {
+#ifndef __PLX_KD_TREE__
+ dmin = 2.0f; // reset min distance to edge pixel
+ for(a = 0; a < num_feather_verts; a++) { // loop through all outer edge buffer pixels
+ dx = t - feather_verts_f[a][0]; // set dx to gradient pixel column - outer edge pixel row
+ dy = fsz - feather_verts_f[a][1]; // set dy to gradient pixel row - outer edge pixel column
+ ud = dx * dx + dy * dy; // compute sum of squares
+ if(ud < dmin) { // if our new sum of squares is less than the current minimum
+ dmin = ud; // set a new minimum equal to the new lower value
+ }
+ }
+ odist = dmin; // cast outer min to a float
+ rsf = odist * 0.5f; //
+ rsl = *(unsigned int *)&odist; // use some peculiar properties of the way bits are stored
+ rsl = 0x5f3759df - (rsl >> 1); // in floats vs. unsigned ints to compute an approximate
+ odist = *(float *)&rsl; // reciprocal square root
+ odist = odist * (rsopf - (rsf * odist * odist)); // -- ** this line can be iterated for more accuracy ** --
+ odist = odist * (rsopf - (rsf * odist * odist));
+ dmin = 2.0f; // reset min distance to edge pixel
+ for(a = 0; a < num_base_verts; a++) { // loop through all inside edge pixels
+ dx = t - base_verts_f[a][0]; // compute delta in Y from gradient pixel to inside edge pixel
+ dy = fsz - base_verts_f[a][1]; // compute delta in X from gradient pixel to inside edge pixel
+ ud = dx * dx + dy * dy; // compute sum of squares
+ if(ud < dmin) { // if our new sum of squares is less than the current minimum we've found
+ dmin = ud; // set a new minimum equal to the new lower value
+ }
+ }
+ idist = dmin; // cast inner min to a float
+ rsf = idist * 0.5f; //
+ rsl = *(unsigned int *)&idist; //
+ rsl = 0x5f3759df - (rsl >> 1); // see notes above
+ idist = *(float *)&rsl; //
+ idist = idist * (rsopf - (rsf * idist * idist)); //
+ idist = idist * (rsopf - (rsf * idist * idist));
+ /*
+ * Note once again that since we are using reciprocals of distance values our
+ * proportion is already the correct intensity, and does not need to be
+ * subtracted from 1.0 like it would have if we used real distances.
+ */
+#else
+ clup[0]=t;
+ clup[1]=fsz;
+ res_kdi=kd_nearestf(ctx->kdi,clup);
+ res_kdo=kd_nearestf(ctx->kdo,clup);
+ kd_res_itemf(res_kdi,clup);
+ dx=t-clup[0];
+ dy=fsz-clup[1];
+ idist=dx*dx+dy*dy;
+ rsf = idist * 0.5f; //
+ rsl = *(unsigned int *)&idist; //
+ rsl = 0x5f3759df - (rsl >> 1); // see notes above
+ idist = *(float *)&rsl; //
+ idist = idist * (rsopf - (rsf * idist * idist)); //
+ idist = idist * (rsopf - (rsf * idist * idist));
+ kd_res_itemf(res_kdo,clup);
+ dx=t-clup[0];
+ dy=fsz-clup[1];
+ odist=dx*dx+dy*dy;
+ rsf = odist * 0.5f; //
+ rsl = *(unsigned int *)&odist; // use some peculiar properties of the way bits are stored
+ rsl = 0x5f3759df - (rsl >> 1); // in floats vs. unsigned ints to compute an approximate
+ odist = *(float *)&rsl; // reciprocal square root
+ odist = odist * (rsopf - (rsf * odist * odist)); // -- ** this line can be iterated for more accuracy ** --
+ odist = odist * (rsopf - (rsf * odist * odist));
+
+#endif
+ /* set intensity, do the += so overlapping gradients are additive */
+ *cpxl = (idist / (idist+odist));
+ }
+ }
+ }
+ }
+
+ /*
+ * Loop through all edges of polygon that could be hit by this scan line,
+ * and figure out their x-intersections with the next scan line.
+ *
+ * Either A.) we wont have any more edges to test, or B.) we just add on the
+ * slope delta computed in preprocessing step. Since this draws non-antialiased
+ * polygons, we dont have fractional positions, so we only move in x-direction
+ * when needed to get all the way to the next pixel over...
+ */
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec);) {
+ if(!(--(e_curr->num))) {
+ *edgec = e_curr->e_next;
+ } else {
+ e_curr->x += e_curr->xshift;
+ if((e_curr->drift += e_curr->drift_inc) > 0) {
+ e_curr->x += e_curr->xdir;
+ e_curr->drift -= e_curr->drift_dec;
+ }
+ edgec = &e_curr->e_next;
+ }
+ }
+ /*
+ * It's possible that some edges may have crossed during the last step, so we'll be sure
+ * that we ALWAYS intersect scan lines in order by shuffling if needed to make all edges
+ * sorted by x-intersection coordinate. We'll always scan through at least once to see if
+ * edges crossed, and if so, we set the 'swixd' flag. If 'swixd' gets set on the initial
+ * pass, then we know we need to sort by x, so then cycle through edges again and perform
+ * the sort.-
+ */
+ if(ctx->possible_edges) {
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
+ /* if the current edge hits scan line at greater X than the next edge, we need to exchange the edges */
+ if(e_curr->x > e_curr->e_next->x) {
+ *edgec = e_curr->e_next;
+ /* exchange the pointers */
+ e_temp = e_curr->e_next->e_next;
+ e_curr->e_next->e_next = e_curr;
+ e_curr->e_next = e_temp;
+ /* set flag that we had at least one switch */
+ swixd = 1;
+ }
+ }
+ /* if we did have a switch, look for more (there will more if there was one) */
+ for(;;) {
+ /* reset exchange flag so it's only set if we encounter another one */
+ swixd = 0;
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
+ /* again, if current edge hits scan line at higher X than next edge,
+ * exchange the edges and set flag */
+ if(e_curr->x > e_curr->e_next->x) {
+ *edgec = e_curr->e_next;
+ /* exchange the pointers */
+ e_temp = e_curr->e_next->e_next;
+ e_curr->e_next->e_next = e_curr;
+ e_curr->e_next = e_temp;
+ /* flip the exchanged flag */
+ swixd = 1;
+ }
+ }
+ /* if we had no exchanges, we're done reshuffling the pointers */
+ if(!swixd) {
+ break;
+ }
+ }
+ }
+ }
+
+ free(edgbuf);
+ return 1;
}
-int PLX_raskterize_feather(float (*base_verts)[2], int num_base_verts, float (*feather_verts)[2], int num_feather_verts,
- float *buf, int buf_x, int buf_y) {
- int i; /* i: Loop counter. */
- struct poly_vert *fe; /* fe: Pointer to a list of integer buffer-space feather vertex coords. */
- struct r_fill_context ctx = {0};
-
- /* for faster multiply */
- const float buf_x_f = (float)buf_x;
- const float buf_y_f = (float)buf_y;
-
- /*
- * Allocate enough memory for our poly_vert list. It'll be the size of the poly_vert
- * data structure multiplied by the number of verts.
- *
- * In the event of a failure to allocate the memory, return 0, so this error can
- * be distinguished as a memory allocation error.
- */
- if ((fe = (struct poly_vert *)(malloc(sizeof(struct poly_vert) * num_feather_verts))) == NULL) {
- return(0);
- }
-
- /*
- * Loop over all verts passed in to be rasterized. Each vertex's X and Y coordinates are
- * then converted from normalized screen space (0.0 <= POS <= 1.0) to integer coordinates
- * in the buffer-space coordinates passed in inside buf_x and buf_y.
- *
- * It's worth noting that this function ONLY outputs fully white pixels in a mask. Every pixel
- * drawn will be 1.0f in value, there is no anti-aliasing.
- */
- for (i = 0; i < num_feather_verts; i++) { /* Loop over all verts. */
- fe[i].x = (int)((feather_verts[i][0] * buf_x_f) + 0.5f); /* Range expand normalized X to integer buffer-space X. */
- fe[i].y = (int)((feather_verts[i][1] * buf_y_f) + 0.5f); /* Range expand normalized Y to integer buffer-space Y. */
- }
-
- ctx.rb.buf = buf; /* Set the output buffer pointer. */
- ctx.rb.sizex = buf_x; /* Set the output buffer size in X. (width) */
- ctx.rb.sizey = buf_y; /* Set the output buffer size in Y. (height) */
-
- /* Call our rasterizer, passing in the integer coords for each vert. */
- i = rast_scan_feather(&ctx, base_verts, num_base_verts, fe, feather_verts, num_feather_verts);
- free(fe);
- return i; /* Return the value returned by the rasterizer. */
+int PLX_raskterize_feather(float(*base_verts)[2], int num_base_verts, float(*feather_verts)[2], int num_feather_verts,
+ float *buf, int buf_x, int buf_y) {
+ //void plx_floatsort(float(*f)[2], unsigned int n, int sortby);
+ int i; /* i: Loop counter. */
+ struct poly_vert *fe; /* fe: Pointer to a list of integer buffer-space feather vertex coords. */
+ struct r_fill_context ctx = {0};
+
+ /* for faster multiply */
+ const float buf_x_f = (float)buf_x;
+ const float buf_y_f = (float)buf_y;
+#ifdef __PLX_KD_TREE__
+ ctx.kdi = kd_create(2);
+ ctx.kdo = kd_create(2);
+#endif
+ /*
+ * Allocate enough memory for our poly_vert list. It'll be the size of the poly_vert
+ * data structure multiplied by the number of verts.
+ *
+ * In the event of a failure to allocate the memory, return 0, so this error can
+ * be distinguished as a memory allocation error.
+ */
+ if((fe = (struct poly_vert *)(malloc(sizeof(struct poly_vert) * num_feather_verts))) == NULL) {
+ return(0);
+ }
+
+ /*
+ * Loop over all verts passed in to be rasterized. Each vertex's X and Y coordinates are
+ * then converted from normalized screen space (0.0 <= POS <= 1.0) to integer coordinates
+ * in the buffer-space coordinates passed in inside buf_x and buf_y.
+ *
+ * It's worth noting that this function ONLY outputs fully white pixels in a mask. Every pixel
+ * drawn will be 1.0f in value, there is no anti-aliasing.
+ */
+ for(i = 0; i < num_feather_verts; i++) { /* Loop over all verts. */
+ fe[i].x = (int)((feather_verts[i][0] * buf_x_f) + 0.5f); /* Range expand normalized X to integer buffer-space X. */
+ fe[i].y = (int)((feather_verts[i][1] * buf_y_f) + 0.5f); /* Range expand normalized Y to integer buffer-space Y. */
+#ifdef __PLX_KD_TREE__
+ kd_insertf(ctx.kdo,feather_verts[i],NULL);
+ }
+ for(i=0;i<num_base_verts;i++){
+ kd_insertf(ctx.kdi,base_verts[i],NULL);
+#endif
+ }
+
+ ctx.rb.buf = buf; /* Set the output buffer pointer. */
+ ctx.rb.sizex = buf_x; /* Set the output buffer size in X. (width) */
+ ctx.rb.sizey = buf_y; /* Set the output buffer size in Y. (height) */
+ /* pre-sort the sets of edge verts on y */
+ //plx_floatsort(base_verts,num_base_verts,0);
+ //plx_floatsort(base_verts,num_base_verts,1);
+ //plx_floatsort(feather_verts,num_feather_verts,0);
+ //plx_floatsort(feather_verts,num_feather_verts,1);
+ /* Call our rasterizer, passing in the integer coords for each vert. */
+ i = rast_scan_feather(&ctx, base_verts, num_base_verts, fe, feather_verts, num_feather_verts);
+ free(fe);
+ return i; /* Return the value returned by the rasterizer. */
}
#ifndef __PLX__FAKE_AA__
-static int get_range_expanded_pixel_coord(float normalized_value, int max_value)
-{
- return (int)((normalized_value * (float)(max_value)) + 0.5f);
+int get_range_expanded_pixel_coord(float normalized_value, int max_value) {
+ return (int)((normalized_value * (float)(max_value)) + 0.5f);
}
-static float get_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y)
-{
- if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
- return 0.0f;
- }
- return buf[(pos_y * buf_y) + buf_x];
+__inline float get_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y) {
+ if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
+ return 0.0f;
+ }
+ return buf[(pos_y * buf_x) + pos_x];
}
-static float get_pixel_intensity_bilinear(float *buf, int buf_x, int buf_y, float u, float v)
-{
- int a;
- int b;
- int a_plus_1;
- int b_plus_1;
- float prop_u;
- float prop_v;
- float inv_prop_u;
- float inv_prop_v;
- if(u<0.0f || u>1.0f || v<0.0f || v>1.0f) {
- return 0.0f;
- }
- u = u * (float)(buf_x) - 0.5f;
- v = v * (float)(buf_y) - 0.5f;
- a = (int)(u);
- b = (int)(v);
- prop_u = u - (float)(a);
- prop_v = v - (float)(b);
- inv_prop_u = 1.0f - prop_u;
- inv_prop_v = 1.0f - prop_v;
- a_plus_1 = MIN2((buf_x-1),a+1);
- b_plus_1 = MIN2((buf_y-1),b+1);
- return (buf[(b * buf_y) + a] * inv_prop_u + buf[(b*buf_y)+(a_plus_1)] * prop_u)*inv_prop_v+(buf[((b_plus_1) * buf_y)+a] * inv_prop_u + buf[((b_plus_1)*buf_y)+(a_plus_1)] * prop_u) * prop_v;
+__inline float get_pixel_intensity_bilinear(float *buf, int buf_x, int buf_y, float u, float v) {
+ int a;
+ int b;
+ int a_plus_1;
+ int b_plus_1;
+ float prop_u;
+ float prop_v;
+ float inv_prop_u;
+ float inv_prop_v;
+ if(u<0.0f || u>1.0f || v<0.0f || v>1.0f) {
+ return 0.0f;
+ }
+ u = u * (float)(buf_x) - 0.5f;
+ v = v * (float)(buf_y) - 0.5f;
+ a = (int)(u);
+ b = (int)(v);
+ prop_u = u - (float)(a);
+ prop_v = v - (float)(b);
+ inv_prop_u = 1.0f - prop_u;
+ inv_prop_v = 1.0f - prop_v;
+ a_plus_1 = MIN2((buf_x-1),a+1);
+ b_plus_1 = MIN2((buf_y-1),b+1);
+ return (buf[(b * buf_x) + a] * inv_prop_u + buf[(b*buf_x)+(a_plus_1)] * prop_u)*inv_prop_v+(buf[((b_plus_1) * buf_x)+a] * inv_prop_u + buf[((b_plus_1)*buf_x)+(a_plus_1)] * prop_u) * prop_v;
}
-static void set_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y, float intensity)
-{
- if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
- return;
- }
- buf[(pos_y * buf_y) + buf_x] = intensity;
+__inline void set_pixel_intensity(float *buf, int buf_x, int buf_y, int pos_x, int pos_y, float intensity) {
+ if(pos_x < 0 || pos_x >= buf_x || pos_y < 0 || pos_y >= buf_y) {
+ return;
+ }
+ buf[(pos_y * buf_x) + pos_x] = intensity;
}
#endif
-int PLX_antialias_buffer(float *buf, int buf_x, int buf_y)
-{
+int PLX_antialias_buffer(float *buf, int buf_x, int buf_y) {
#ifdef __PLX__FAKE_AA__
#ifdef __PLX_GREY_AA__
- int i=0;
- int sz = buf_x * buf_y;
- for(i=0; i<sz; i++) {
- buf[i] *= 0.5f;
- }
+ int i=0;
+ int sz = buf_x * buf_y;
+ for(i=0; i<sz; i++) {
+ buf[i] *= 0.5f;
+ }
#endif
- (void)buf_x;
- (void)buf_y;
- (void)buf;
- return 1;
+ (void)buf_x;
+ (void)buf_y;
+ (void)buf;
+ return 1;
#else
- /*XXX - TODO: THIS IS NOT FINAL CODE - IT DOES NOT WORK - DO NOT ENABLE IT */
- const float p0 = 1.0f;
- const float p1 = 1.0f;
- const float p2 = 1.0f;
- const float p3 = 1.0f;
- const float p4 = 1.0f;
- const float p5 = 1.5f;
- const float p6 = 2.0f;
- const float p7 = 2.0f;
- const float p8 = 2.0f;
- const float p9 = 2.0f;
- const float p10 = 4.0f;
- const float p11 = 8.0f;
-
- const float edge_threshold = 0.063f;
- const float edge_threshold_min = 0.0312f;
- const float quality_subpix = 1.0f;
-// int px_x;
-// int px_y;
-
- float posM_x,posM_y;
- float posB_x,posB_y;
- float posN_x,posN_y;
- float posP_x,posP_y;
- float offNP_x,offNP_y;
- float lumaM;
- float lumaS;
- float lumaE;
- float lumaN;
- float lumaW;
- float lumaNW;
- float lumaSE;
- float lumaNE;
- float lumaSW;
- float lumaNS;
- float lumaWE;
- float lumaNESE;
- float lumaNWNE;
- float lumaNWSW;
- float lumaSWSE;
- float lumaNN;
- float lumaSS;
- float lumaEndN;
- float lumaEndP;
- float lumaMM;
- float lumaMLTZero;
- float subpixNWSWNESE;
- float subpixRcpRange;
- float subpixNSWE;
- float maxSM;
- float minSM;
- float maxESM;
- float minESM;
- float maxWN;
- float minWN;
- float rangeMax;
- float rangeMin;
- float rangeMaxScaled;
- float range;
- float rangeMaxClamped;
- float edgeHorz;
- float edgeVert;
- float edgeHorz1;
- float edgeVert1;
- float edgeHorz2;
- float edgeVert2;
- float edgeHorz3;
- float edgeVert3;
- float edgeHorz4;
- float edgeVert4;
- float lengthSign;
- float subpixA;
- float subpixB;
- float subpixC;
- float subpixD;
- float subpixE;
- float subpixF;
- float subpixG;
- float subpixH;
- float gradientN;
- float gradientS;
- float gradient;
- float gradientScaled;
- float dstN;
- float dstP;
- float dst;
- float spanLength;
- float spanLengthRcp;
- float pixelOffset;
- float pixelOffsetGood;
- float pixelOffsetSubpix;
- int directionN;
- int goodSpan;
- int goodSpanN;
- int goodSpanP;
- int horzSpan;
- int earlyExit;
- int pairN;
- int doneN;
- int doneP;
- int doneNP;
- int curr_x=0;
- int curr_y=0;
- for(curr_y=0; curr_y < buf_y; curr_y++) {
- for(curr_x=0; curr_x < buf_x; curr_x++) {
- posM_x = ((float)(curr_x) + 0.5f) * (1.0f/(float)(buf_x));
- posM_y = ((float)(curr_y) + 0.5f) * (1.0f/(float)(buf_y));
-
- lumaM = get_pixel_intensity(buf, buf_x, buf_y, curr_x, curr_y);
- lumaS = get_pixel_intensity(buf, buf_x, buf_y, curr_x, curr_y - 1);
- lumaE = get_pixel_intensity(buf, buf_x, buf_y, curr_x + 1, curr_y);
- lumaN = get_pixel_intensity(buf, buf_x, buf_y, curr_x, curr_y + 1);
- lumaW = get_pixel_intensity(buf, buf_x, buf_y, curr_x - 1, curr_y);
-
- maxSM = MAX2(lumaS, lumaM);
- minSM = MIN2(lumaS, lumaM);
- maxESM = MAX2(lumaE, maxSM);
- minESM = MIN2(lumaE, minSM);
- maxWN = MAX2(lumaN, lumaW);
- minWN = MIN2(lumaN, lumaW);
- rangeMax = MAX2(maxWN, maxESM);
- rangeMin = MIN2(minWN, minESM);
- rangeMaxScaled = rangeMax * edge_threshold;
- range = rangeMax - rangeMin;
- rangeMaxClamped = MAX2(edge_threshold_min, rangeMaxScaled);
-
- earlyExit = range < rangeMaxClamped ? 1:0;
- if(earlyExit) {
- set_pixel_intensity(buf, buf_x, buf_y, curr_x, curr_y, lumaM);
- }
-
- lumaNW = get_pixel_intensity(buf, buf_x, buf_y, curr_x + 1, curr_y - 1);
- lumaSE = get_pixel_intensity(buf, buf_x, buf_y, curr_x - 1, curr_y + 1);
- lumaNE = get_pixel_intensity(buf, buf_x, buf_y, curr_x + 1, curr_y + 1);
- lumaSW = get_pixel_intensity(buf, buf_x, buf_y, curr_x - 1, curr_y - 1);
-
- lumaNS = lumaN + lumaS;
- lumaWE = lumaW + lumaE;
- subpixRcpRange = 1.0f/range;
- subpixNSWE = lumaNS + lumaWE;
- edgeHorz1 = (-2.0f * lumaM) + lumaNS;
- edgeVert1 = (-2.0f * lumaM) + lumaWE;
-
- lumaNESE = lumaNE + lumaSE;
- lumaNWNE = lumaNW + lumaNE;
- edgeHorz2 = (-2.0f * lumaE) + lumaNESE;
- edgeVert2 = (-2.0f * lumaN) + lumaNWNE;
-
- lumaNWSW = lumaNW + lumaSW;
- lumaSWSE = lumaSW + lumaSE;
- edgeHorz4 = (ABS(edgeHorz1) * 2.0f) + ABS(edgeHorz2);
- edgeVert4 = (ABS(edgeVert1) * 2.0f) + ABS(edgeVert2);
- edgeHorz3 = (-2.0f * lumaW) + lumaNWSW;
- edgeVert3 = (-2.0f * lumaS) + lumaSWSE;
- edgeHorz = ABS(edgeHorz3) + edgeHorz4;
- edgeVert = ABS(edgeVert3) + edgeVert4;
-
- subpixNWSWNESE = lumaNWSW + lumaNESE;
- lengthSign = 1.0f / (float)(buf_x);
- horzSpan = edgeHorz >= edgeVert ? 1:0;
- subpixA = subpixNSWE * 2.0f + subpixNWSWNESE;
-
- if(!horzSpan) {
- lumaN = lumaW;
- lumaS = lumaE;
- }
- else {
- lengthSign = 1.0f / (float)(buf_y);
- }
- subpixB = (subpixA * (1.0f/12.0f)) - lumaM;
-
- gradientN = lumaN - lumaM;
- gradientS = lumaS - lumaM;
- lumaNN = lumaN + lumaM;
- lumaSS = lumaS + lumaM;
- pairN = (ABS(gradientN)) >= (ABS(gradientS)) ? 1:0;
- gradient = MAX2(ABS(gradientN), ABS(gradientS));
- if(pairN) {
- lengthSign = -lengthSign;
- }
- subpixC = MAX2(MIN2(ABS(subpixB) * subpixRcpRange,1.0f),0.0f);
-
- posB_x = posM_x;
- posB_y = posM_y;
- offNP_x = (!horzSpan) ? 0.0f:(1.0f / (float)(buf_x));
- offNP_y = (horzSpan) ? 0.0f:(1.0f / (float)(buf_y));
- if(!horzSpan) {
- posB_x += lengthSign * 0.5f;
- }
- else {
- posB_y += lengthSign * 0.5f;
- }
-
- posN_x = posB_x - offNP_x * p0;
- posN_y = posB_y - offNP_y * p0;
- posP_x = posB_x + offNP_x * p0;
- posP_y = posB_y + offNP_y * p0;
- subpixD = ((-2.0f)*subpixC) + 3.0f;
- //may need bilinear filtered get_pixel_intensity() here...done
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- subpixE = subpixC * subpixC;
- //may need bilinear filtered get_pixel_intensity() here...done
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
-
- if(!pairN) {
- lumaNN = lumaSS;
- }
- gradientScaled = gradient * 1.0f/4.0f;
- lumaMM =lumaM - lumaNN * 0.5f;
- subpixF = subpixD * subpixE;
- lumaMLTZero = lumaMM < 0.0f ? 1:0;
-
- lumaEndN -= lumaNN * 0.5f;
- lumaEndP -= lumaNN * 0.5f;
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p1;
- posN_y -= offNP_y * p1;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p1;
- posP_y += offNP_y * p1;
- }
-
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x, posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p2;
- posN_y -= offNP_y * p2;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p2;
- posP_y += offNP_y * p2;
- }
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p3;
- posN_y -= offNP_y * p3;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p3;
- posP_y += offNP_y * p3;
- }
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p4;
- posN_y -= offNP_y * p4;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p4;
- posP_y += offNP_y * p4;
- }
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p5;
- posN_y -= offNP_y * p5;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p5;
- posP_y += offNP_y * p5;
- }
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p6;
- posN_y -= offNP_y * p6;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p6;
- posP_y += offNP_y * p6;
- }
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p7;
- posN_y -= offNP_y * p7;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p7;
- posP_y += offNP_y * p7;
- }
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p8;
- posN_y -= offNP_y * p8;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p8;
- posP_y += offNP_y * p8;
- }
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p9;
- posN_y -= offNP_y * p9;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p9;
- posP_y += offNP_y * p9;
- }
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p10;
- posN_y -= offNP_y * p10;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p10;
- posP_y += offNP_y * p10;
- }
- if(doneNP) {
- if(!doneN) {
- lumaEndN = get_pixel_intensity_bilinear(buf, buf_x, buf_y,posN_x,posN_y);
- }
- if(!doneP) {
- lumaEndP = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posP_x,posP_y);
- }
- if(!doneN) {
- lumaEndN = lumaEndN - lumaNN * 0.5;
- }
- if(!doneP) {
- lumaEndP = lumaEndP - lumaNN * 0.5;
- }
- doneN = (ABS(lumaEndN)) >= gradientScaled ? 1:0;
- doneP = (ABS(lumaEndP)) >= gradientScaled ? 1:0;
- if(!doneN) {
- posN_x -= offNP_x * p11;
- posN_y -= offNP_y * p11;
- }
- doneNP = (!doneN) || (!doneP) ? 1:0;
- if(!doneP) {
- posP_x += offNP_x * p11;
- posP_y += offNP_y * p11;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- dstN = posM_x - posN_x;
- dstP = posP_x - posM_x;
- if(!horzSpan) {
- dstN = posM_y - posN_y;
- dstP = posP_y - posM_y;
- }
-
- goodSpanN = ((lumaEndN < 0.0f) ? 1:0) != lumaMLTZero ? 1:0;
- spanLength = (dstP + dstN);
- goodSpanP = ((lumaEndP < 0.0f) ? 1:0) != lumaMLTZero ? 1:0;
- spanLengthRcp = 1.0f/spanLength;
-
- directionN = dstN < dstP ? 1:0;
- dst = MIN2(dstN, dstP);
- goodSpan = (directionN==1) ? goodSpanN:goodSpanP;
- subpixG = subpixF * subpixF;
- pixelOffset = (dst * (-spanLengthRcp)) + 0.5f;
- subpixH = subpixG * quality_subpix;
-
- pixelOffsetGood = (goodSpan==1) ? pixelOffset : 0.0f;
- pixelOffsetSubpix = MAX2(pixelOffsetGood, subpixH);
- if(!horzSpan) {
- posM_x += pixelOffsetSubpix * lengthSign;
- }
- else {
- posM_y += pixelOffsetSubpix * lengthSign;
- }
- //may need bilinear filtered get_pixel_intensity() here...
- set_pixel_intensity(buf,buf_x,buf_y,curr_x,curr_y,get_pixel_intensity_bilinear(buf, buf_x, buf_y, posM_x,posM_y)* lumaM);
-
- }
- }
- return 1;
+ const float jump01 = 1.0f;
+ const float jump02 = 1.0f;
+ const float jump03 = 1.0f;
+ const float jump04 = 1.0f;
+ const float jump05 = 1.0f;
+ const float jump06 = 1.5f;
+ const float jump07 = 2.0f;
+ const float jump08 = 2.0f;
+ const float jump09 = 2.0f;
+ const float jump10 = 2.0f;
+ const float jump11 = 4.0f;
+ const float jump12 = 8.0f;
+
+ const float edge_threshold = 0.063f;
+ const float edge_threshold_min = 0.0312f;
+ const float quality_subpix = 1.0f;
+
+ float fpcx,fpcy;
+ float fpsqx,fpsqy;
+ float fprevx,fprevy;
+ float fpfowx,fpfowy;
+ float offset_dgx,offset_dgy;
+ float pci;
+ float pdi;
+ float pri;
+ float pui;
+ float pli;
+ float uli;
+ float dri;
+ float uri;
+ float dli;
+ float udi;
+ float lri;
+ float fsi;
+ float ti;
+ float cdi;
+ float bi;
+ float uui;
+ float ddi;
+ float eri;
+ float efi;
+ float cci;
+ float ltz;
+ float spX;
+ float inv_r;
+ float spP;
+ float gdc;
+ float sdc;
+ float gedc;
+ float sedc;
+ float glu;
+ float slu;
+ float gr;
+ float sr;
+ float grexp;
+ float r;
+ float grc;
+ float lre;
+ float ude;
+ float lre0;
+ float ude0;
+ float lre1;
+ float ude1;
+ float lre2;
+ float ude2;
+ float lre3;
+ float ude3;
+ float sdst;
+ float tg0;
+ float tg1;
+ float tg2;
+ float tg3;
+ float tg4;
+ float tg5;
+ float tg6;
+ float tg7;
+ float ugrad;
+ float dgrad;
+ float grad;
+ float gradexp;
+ float revdst;
+ float fowdst;
+ float dst;
+ float dsts;
+ float inv_dsts;
+ float pxOff;
+ float gpxOff;
+ float tgpxOff;
+ float opx;
+ float opy;
+ int uls;
+ int sph;
+ int revsph;
+ int fowsph;
+ int lrsp;
+ int done;
+ int revpp;
+ int revdone;
+ int fowdone;
+ int tug_of_war;
+ int curr_x=0;
+ int curr_y=0;
+ opx = (1.0f / (float)(buf_x));
+ opy = (1.0f / (float)(buf_y));
+ for(curr_y=0; curr_y < buf_y; curr_y++) {
+ for(curr_x=0; curr_x < buf_x; curr_x++) {
+ fpcx = ((float)(curr_x) + 0.5f) * opx;
+ fpcy = ((float)(curr_y) + 0.5f) * opy;
+//#define __PLX_BILINEAR_INITIAL_SAMPLES__ 1
+#ifdef __PLX_BILINEAR_INITIAL_SAMPLES__
+ lumaM = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posM_x, posM_y);
+ lumaS = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posM_x, posM_y + opy);
+ lumaE = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posM_x + opx, posM_y);
+ lumaN = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posM_x, posM_y - opy);
+ lumaW = get_pixel_intensity_bilinear(buf, buf_x, buf_y, posM_x - opx, posM_y);
+#else
+ pci = get_pixel_intensity(buf, buf_x, buf_y, curr_x, curr_y);
+ pdi = get_pixel_intensity(buf, buf_x, buf_y, curr_x, curr_y + 1);
+ pri = get_pixel_intensity(buf, buf_x, buf_y, curr_x + 1, curr_y);
+ pui = get_pixel_intensity(buf, buf_x, buf_y, curr_x, curr_y - 1);
+ pli = get_pixel_intensity(buf, buf_x, buf_y, curr_x - 1, curr_y);
+#endif
+ gdc = MAX2(pdi, pci);
+ sdc = MIN2(pdi, pci);
+ gedc = MAX2(pri, gdc);
+ sedc = MIN2(pri, sdc);
+ glu = MAX2(pui, pli);
+ slu = MIN2(pui, pli);
+ gr = MAX2(glu, gedc);
+ sr = MIN2(slu, sedc);
+ grexp = gr * edge_threshold;
+ r = gr - sr;
+ grc = MAX2(edge_threshold_min, grexp);
+
+ done = r < grc ? 1:0;
+ if(done) {
+ set_pixel_intensity(buf, buf_x, buf_y, curr_x, curr_y, pci);
+ } else {
+
+ uli = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpcx - opx, fpcy - opy);
+ dri = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpcx + opx, fpcy + opy);
+ uri = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpcx + opx, fpcy - opy);
+ dli = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpcx - opx, fpcy + opy);
+
+ udi = pui + pdi;
+ lri = pli + pri;
+ inv_r = 1.0f/r;
+ spP = udi + lri;
+ lre0 = (-2.0f * pci) + udi;
+ ude0 = (-2.0f * pci) + lri;
+
+ fsi = uri + dri;
+ ti = uli + uri;
+ lre1 = (-2.0f * pri) + fsi;
+ ude1 = (-2.0f * pui) + ti;
+
+ cdi = uli + dli;
+ bi = dli + dri;
+ lre3 = (ABS(lre0) * 2.0f) + ABS(lre1);
+ ude3 = (ABS(ude0) * 2.0f) + ABS(ude1);
+ lre2 = (-2.0f * pli) + cdi;
+ ude2 = (-2.0f * pdi) + bi;
+ lre = ABS(lre2) + lre3;
+ ude = ABS(ude2) + ude3;
+
+ spX = cdi + fsi;
+ sdst = 1.0f / (float)(buf_x);
+ lrsp = lre >= ude ? 1:0;
+ tg0 = spP * 2.0f + spX;
+
+ if(!lrsp) {
+ pui = pli;
+ pdi = pri;
+ } else {
+ sdst = 1.0f / (float)(buf_y);
+ }
+ tg1 = (tg0 * (1.0f/12.0f)) - pci;
+
+ ugrad = pui - pci;
+ dgrad = pdi - pci;
+ uui = pui + pci;
+ ddi = pdi + pci;
+ revpp = (ABS(ugrad)) >= (ABS(dgrad)) ? 1:0;
+ grad = MAX2(ABS(ugrad), ABS(dgrad));
+ if(revpp) {
+ sdst = -sdst;
+ }
+ tg2 = MAX2(MIN2(ABS(tg1) * inv_r,1.0f),0.0f);
+
+ fpsqx = fpcx;
+ fpsqy = fpcy;
+ offset_dgx = (!lrsp) ? 0.0f:(1.0f / (float)(buf_x));
+ offset_dgy = (lrsp) ? 0.0f:(1.0f / (float)(buf_y));
+ if(!lrsp) {
+ fpsqx += sdst * 0.5f;
+ } else {
+ fpsqy += sdst * 0.5f;
+ }
+
+ fprevx = fpsqx - offset_dgx * jump01;
+ fprevy = fpsqy - offset_dgy * jump01;
+ fpfowx = fpsqx + offset_dgx * jump01;
+ fpfowy = fpsqy + offset_dgy * jump01;
+ tg3 = ((-2.0f)*tg2) + 3.0f;
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ tg4 = tg2 * tg2;
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+
+ if(!revpp) {
+ uui = ddi;
+ }
+ gradexp = grad * 1.0f/4.0f;
+ cci =pci - uui * 0.5f;
+ tg5 = tg3 * tg4;
+ ltz = cci < 0.0f ? 1:0;
+
+ eri -= uui * 0.5f;
+ efi -= uui * 0.5f;
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump02;
+ fprevy -= offset_dgy * jump02;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump02;
+ fpfowy += offset_dgy * jump02;
+ }
+
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx, fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump03;
+ fprevy -= offset_dgy * jump03;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump03;
+ fpfowy += offset_dgy * jump03;
+ }
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump04;
+ fprevy -= offset_dgy * jump04;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump04;
+ fpfowy += offset_dgy * jump04;
+ }
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump05;
+ fprevy -= offset_dgy * jump05;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump05;
+ fpfowy += offset_dgy * jump05;
+ }
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump06;
+ fprevy -= offset_dgy * jump06;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump06;
+ fpfowy += offset_dgy * jump06;
+ }
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump07;
+ fprevy -= offset_dgy * jump07;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump07;
+ fpfowy += offset_dgy * jump07;
+ }
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump08;
+ fprevy -= offset_dgy * jump08;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump08;
+ fpfowy += offset_dgy * jump08;
+ }
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump09;
+ fprevy -= offset_dgy * jump09;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump09;
+ fpfowy += offset_dgy * jump09;
+ }
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump10;
+ fprevy -= offset_dgy * jump10;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump10;
+ fpfowy += offset_dgy * jump10;
+ }
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump11;
+ fprevy -= offset_dgy * jump11;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump11;
+ fpfowy += offset_dgy * jump11;
+ }
+ if(tug_of_war) {
+ if(!revdone) {
+ eri = get_pixel_intensity_bilinear(buf, buf_x, buf_y,fprevx,fprevy);
+ }
+ if(!fowdone) {
+ efi = get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpfowx,fpfowy);
+ }
+ if(!revdone) {
+ eri = eri - uui * 0.5;
+ }
+ if(!fowdone) {
+ efi = efi - uui * 0.5;
+ }
+ revdone = (ABS(eri)) >= gradexp ? 1:0;
+ fowdone = (ABS(efi)) >= gradexp ? 1:0;
+ if(!revdone) {
+ fprevx -= offset_dgx * jump12;
+ fprevy -= offset_dgy * jump12;
+ }
+ tug_of_war = (!revdone) || (!fowdone) ? 1:0;
+ if(!fowdone) {
+ fpfowx += offset_dgx * jump12;
+ fpfowy += offset_dgy * jump12;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ revdst = fpcx - fprevx;
+ fowdst = fpfowx - fpcx;
+ if(!lrsp) {
+ revdst = fpcy - fprevy;
+ fowdst = fpfowy - fpcy;
+ }
+
+ revsph = ((eri < 0.0f) ? 1:0) != ltz ? 1:0;
+ dsts = (fowdst + revdst);
+ fowsph = ((efi < 0.0f) ? 1:0) != ltz ? 1:0;
+ inv_dsts = 1.0f/dsts;
+
+ uls = revdst < fowdst ? 1:0;
+ dst = MIN2(revdst, fowdst);
+ sph = (uls==1) ? revsph:fowsph;
+ tg6 = tg5 * tg5;
+ pxOff = (dst * (-inv_dsts)) + 0.5f;
+ tg7 = tg6 * quality_subpix;
+
+ gpxOff = (sph==1) ? pxOff : 0.0f;
+ tgpxOff = MAX2(gpxOff, tg7);
+ if(!lrsp) {
+ fpcx += tgpxOff * sdst;
+ } else {
+ fpcy += tgpxOff * sdst;
+ }
+ set_pixel_intensity(buf,buf_x,buf_y,curr_x,curr_y,get_pixel_intensity_bilinear(buf, buf_x, buf_y, fpcx,fpcy));
+ }
+ }
+ }
+ return 1;
#endif
}
+#define SWAP_POLYVERT(a,b) point_temp[0]=(a)[0]; point_temp[1]=(a)[1]; (a)[0]=(b)[0]; (a)[1]=(b)[1]; (b)[0]=point_temp[0]; (b)[1]=point_temp[1];
+#define __PLX_SMALL_COUNT__ 13
+void plx_floatsort(float(*f)[2], unsigned int n, int sortby) {
+ unsigned int a;
+ unsigned int b;
+ unsigned int c;
+ unsigned int d=1;
+ unsigned int hold;
+ unsigned int index_list[50];
+ int index_offset=0;
+ float t[2];
+ float point_temp[2];
+
+ hold=n;
+ for(;;) {
+ if(hold-d < __PLX_SMALL_COUNT__) {
+ for(b=d+1; b<=hold; b++) {
+ t[1]=f[b][1];
+ t[0]=f[b][0];
+ for(a=b-1; a>=d; a--) {
+ if(f[a][sortby] <= t[sortby]) {
+ break;
+ }
+ f[a+1][1]=f[a][1];
+ f[a+1][0]=f[a][0];
+ }
+ f[a+1][1]=t[1];
+ f[a+1][0]=t[0];
+ }
+ if(index_offset < 0) {
+ break;
+ }
+ hold=index_list[index_offset--];
+ d=index_list[index_offset--];
+ } else {
+ c=(d+hold) >> 1;
+ SWAP_POLYVERT(f[c],f[d+1])
+ if(f[d][sortby] > f[hold][sortby]) {
+ SWAP_POLYVERT(f[d],f[hold])
+ }
+ if(f[d+1][sortby] > f[hold][sortby]) {
+ SWAP_POLYVERT(f[d+1],f[hold])
+ }
+ if(f[d][sortby] > f[d+1][sortby]) {
+ SWAP_POLYVERT(f[d],f[d+1])
+ }
+ a=d+1;
+ b=hold;
+ t[0]=f[d+1][0];
+ t[1]=f[d+1][1];
+ for(;;) {
+ do a++;
+ while(f[a][sortby] < t[sortby]);
+ do b--;
+ while(f[b][sortby] > t[sortby]);
+ if(b < a) {
+ break;
+ }
+ SWAP_POLYVERT(f[a],f[b])
+ }
+ f[d+1][0]=f[b][0];
+ f[d+1][1]=f[b][1];
+ f[b][0]=t[0];
+ f[b][1]=t[1];
+ index_offset+=2;
+ if(index_offset > __PLX_SMALL_COUNT__) {
+ return;
+ }
+ if(hold-a+1 >= b-d) {
+ index_list[index_offset]=hold;
+ index_list[index_offset-1]=a;
+ hold=b-1;
+ } else {
+ index_list[index_offset]=b-1;
+ index_list[index_offset-1]=d;
+ d=a;
+ }
+ }
+ }
+}
+
+int plx_find_lower_bound(float v, float(*a)[2], int num_feather_verts) {
+ int x;
+ int l;
+ int r;
+ l=1;
+ r=num_feather_verts;
+ for(;;) {
+ // interpolation style search
+ //x=l+(v-a[l][1])*(r-l) / (a[r][1]-a[l][1]);
+
+ // binary search
+ x=(l+r) / 2;
+ if(v<a[x][1]) {
+ r=x-1;
+ } else {
+ l=x+1;
+ }
+ if((v>a[x-1][1] && v <= a[x][1]) || l>r) {
+ break;
+ }
+ }
+ if(v>a[x-1][1] && v <= a[x][1]) {
+ return x;
+ } else {
+ return num_feather_verts;
+ }
+}
+
+int plx_find_upper_bound(float v, float(*a)[2], int num_feather_verts) {
+ int x;
+ int l;
+ int r;
+ l=1;
+ r=num_feather_verts;
+ for(;;) {
+ // interpolation style search
+ //x=l+(v-a[l][1])*(r-l) / (a[r][1]-a[l][1]);
+
+ // binary search
+ x=(l+r) / 2;
+ if(v<a[x][1]) {
+ r=x-1;
+ } else {
+ l=x+1;
+ }
+ if((v>=a[x-1][1] && v < a[x][1]) || l>r) {
+ break;
+ }
+ }
+ if(v>=a[x-1][1] && v < a[x][1]) {
+ return x-1;
+ } else {
+ return num_feather_verts;
+ }
+}
+
diff --git a/intern/raskter/raskter.h b/intern/raskter/raskter.h
index e078b0d26be..cf679dd37c0 100644
--- a/intern/raskter/raskter.h
+++ b/intern/raskter/raskter.h
@@ -27,27 +27,74 @@
/** \file raskter.h
* \ingroup RASKTER
*/
+/* from BLI_utildefines.h */
+#define MIN2(x, y) ( (x) < (y) ? (x) : (y) )
+#define MAX2(x, y) ( (x) > (y) ? (x) : (y) )
+#define ABS(a) ( (a) < 0 ? (-(a)) : (a) )
struct poly_vert {
- int x;
- int y;
+ int x;
+ int y;
};
struct scan_line {
- int xstart;
- int xend;
+ int xstart;
+ int xend;
};
struct scan_line_batch {
- int num;
- int ystart;
- struct scan_line *slines;
+ int num;
+ int ystart;
+ struct scan_line *slines;
+};
+
+struct e_status {
+ int x;
+ int ybeg;
+ int xshift;
+ int xdir;
+ int drift;
+ int drift_inc;
+ int drift_dec;
+ int num;
+ struct e_status *e_next;
+};
+
+struct r_buffer_stats {
+ float *buf;
+ int sizex;
+ int sizey;
+ int ymin;
+ int ymax;
+ int xmin;
+ int xmax;
+};
+
+struct r_fill_context {
+ struct e_status *all_edges, *possible_edges;
+ struct r_buffer_stats rb;
+ struct scan_line *bounds;
+ void *kdo; //only used with kd tree
+ void *kdi; //only used with kd tree
+ int *bound_indexes;
+ int bounds_length;
+};
+
+struct layer_init_data {
+ struct poly_vert *imask;
+ struct poly_vert *omask;
+ struct scan_line *bounds;
+ int *bound_indexes;
+ int bounds_length;
};
#ifdef __cplusplus
extern "C" {
#endif
+void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, struct e_status *open_edge);
+int PLX_init_base_data(struct layer_init_data *mlayer_data, float(*base_verts)[2], int num_base_verts,
+ float *buf, int buf_x, int buf_y);
int PLX_raskterize(float (*base_verts)[2], int num_base_verts,
float *buf, int buf_x, int buf_y, int do_mask_AA);
int PLX_raskterize_feather(float (*base_verts)[2], int num_base_verts,
diff --git a/intern/raskter/raskter_kdtree.c b/intern/raskter/raskter_kdtree.c
new file mode 100644
index 00000000000..06fbc5dccd0
--- /dev/null
+++ b/intern/raskter/raskter_kdtree.c
@@ -0,0 +1,836 @@
+/*
+This file is part of ``kdtree'', a library for working with kd-trees.
+Copyright (C) 2007-2011 John Tsiombikas <nuclear@member.fsf.org>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGE.
+*/
+/* single nearest neighbor search written by Tamas Nepusz <tamas@cs.rhul.ac.uk> */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "raskter_kdtree.h"
+
+#if defined(WIN32) || defined(__WIN32__)
+#include <malloc.h>
+#endif
+
+#ifdef USE_LIST_NODE_ALLOCATOR
+
+#ifndef NO_PTHREADS
+#include <pthread.h>
+#else
+
+#ifndef I_WANT_THREAD_BUGS
+#error "You are compiling with the fast list node allocator, with pthreads disabled! This WILL break if used from multiple threads."
+#endif /* I want thread bugs */
+
+#endif /* pthread support */
+#endif /* use list node allocator */
+
+struct kdhyperrect {
+ int dim;
+ double *min, *max; /* minimum/maximum coords */
+};
+
+struct kdnode {
+ double *pos;
+ int dir;
+ void *data;
+
+ struct kdnode *left, *right; /* negative/positive side */
+};
+
+struct res_node {
+ struct kdnode *item;
+ double dist_sq;
+ struct res_node *next;
+};
+
+struct kdtree {
+ int dim;
+ struct kdnode *root;
+ struct kdhyperrect *rect;
+ void (*destr)(void*);
+};
+
+struct kdres {
+ struct kdtree *tree;
+ struct res_node *rlist, *riter;
+ int size;
+};
+
+#define SQ(x) ((x) * (x))
+
+
+static void clear_rec(struct kdnode *node, void (*destr)(void*));
+static int insert_rec(struct kdnode **node, const double *pos, void *data, int dir, int dim);
+static int rlist_insert(struct res_node *list, struct kdnode *item, double dist_sq);
+static void clear_results(struct kdres *set);
+
+static struct kdhyperrect* hyperrect_create(int dim, const double *min, const double *max);
+static void hyperrect_free(struct kdhyperrect *rect);
+static struct kdhyperrect* hyperrect_duplicate(const struct kdhyperrect *rect);
+static void hyperrect_extend(struct kdhyperrect *rect, const double *pos);
+static double hyperrect_dist_sq(struct kdhyperrect *rect, const double *pos);
+
+#ifdef USE_LIST_NODE_ALLOCATOR
+static struct res_node *alloc_resnode(void);
+static void free_resnode(struct res_node*);
+#else
+#define alloc_resnode() malloc(sizeof(struct res_node))
+#define free_resnode(n) free(n)
+#endif
+
+
+
+struct kdtree *kd_create(int k)
+{
+ struct kdtree *tree;
+
+ if(!(tree = malloc(sizeof *tree))) {
+ return 0;
+ }
+
+ tree->dim = k;
+ tree->root = 0;
+ tree->destr = 0;
+ tree->rect = 0;
+
+ return tree;
+}
+
+void kd_free(struct kdtree *tree)
+{
+ if(tree) {
+ kd_clear(tree);
+ free(tree);
+ }
+}
+
+static void clear_rec(struct kdnode *node, void (*destr)(void*))
+{
+ if(!node) return;
+
+ clear_rec(node->left, destr);
+ clear_rec(node->right, destr);
+
+ if(destr) {
+ destr(node->data);
+ }
+ free(node->pos);
+ free(node);
+}
+
+void kd_clear(struct kdtree *tree)
+{
+ clear_rec(tree->root, tree->destr);
+ tree->root = 0;
+
+ if (tree->rect) {
+ hyperrect_free(tree->rect);
+ tree->rect = 0;
+ }
+}
+
+void kd_data_destructor(struct kdtree *tree, void (*destr)(void*))
+{
+ tree->destr = destr;
+}
+
+
+static int insert_rec(struct kdnode **nptr, const double *pos, void *data, int dir, int dim)
+{
+ int new_dir;
+ struct kdnode *node;
+
+ if(!*nptr) {
+ if(!(node = malloc(sizeof *node))) {
+ return -1;
+ }
+ if(!(node->pos = malloc(dim * sizeof *node->pos))) {
+ free(node);
+ return -1;
+ }
+ memcpy(node->pos, pos, dim * sizeof *node->pos);
+ node->data = data;
+ node->dir = dir;
+ node->left = node->right = 0;
+ *nptr = node;
+ return 0;
+ }
+
+ node = *nptr;
+ new_dir = (node->dir + 1) % dim;
+ if(pos[node->dir] < node->pos[node->dir]) {
+ return insert_rec(&(*nptr)->left, pos, data, new_dir, dim);
+ }
+ return insert_rec(&(*nptr)->right, pos, data, new_dir, dim);
+}
+
+int kd_insert(struct kdtree *tree, const double *pos, void *data)
+{
+ if (insert_rec(&tree->root, pos, data, 0, tree->dim)) {
+ return -1;
+ }
+
+ if (tree->rect == 0) {
+ tree->rect = hyperrect_create(tree->dim, pos, pos);
+ } else {
+ hyperrect_extend(tree->rect, pos);
+ }
+
+ return 0;
+}
+
+int kd_insertf(struct kdtree *tree, const float *pos, void *data)
+{
+ static double sbuf[16];
+ double *bptr, *buf = 0;
+ int res, dim = tree->dim;
+
+ if(dim > 16) {
+#ifndef NO_ALLOCA
+ if(dim <= 256)
+ bptr = buf = alloca(dim * sizeof *bptr);
+ else
+#endif
+ if(!(bptr = buf = malloc(dim * sizeof *bptr))) {
+ return -1;
+ }
+ } else {
+ bptr = buf = sbuf;
+ }
+
+ while(dim-- > 0) {
+ *bptr++ = *pos++;
+ }
+
+ res = kd_insert(tree, buf, data);
+#ifndef NO_ALLOCA
+ if(tree->dim > 256)
+#else
+ if(tree->dim > 16)
+#endif
+ free(buf);
+ return res;
+}
+
+int kd_insert3(struct kdtree *tree, double x, double y, double z, void *data)
+{
+ double buf[3];
+ buf[0] = x;
+ buf[1] = y;
+ buf[2] = z;
+ return kd_insert(tree, buf, data);
+}
+
+int kd_insert3f(struct kdtree *tree, float x, float y, float z, void *data)
+{
+ double buf[3];
+ buf[0] = x;
+ buf[1] = y;
+ buf[2] = z;
+ return kd_insert(tree, buf, data);
+}
+
+static int find_nearest(struct kdnode *node, const double *pos, double range, struct res_node *list, int ordered, int dim)
+{
+ double dist_sq, dx;
+ int i, ret, added_res = 0;
+
+ if(!node) return 0;
+
+ dist_sq = 0;
+ for(i=0; i<dim; i++) {
+ dist_sq += SQ(node->pos[i] - pos[i]);
+ }
+ if(dist_sq <= SQ(range)) {
+ if(rlist_insert(list, node, ordered ? dist_sq : -1.0) == -1) {
+ return -1;
+ }
+ added_res = 1;
+ }
+
+ dx = pos[node->dir] - node->pos[node->dir];
+
+ ret = find_nearest(dx <= 0.0 ? node->left : node->right, pos, range, list, ordered, dim);
+ if(ret >= 0 && fabs(dx) < range) {
+ added_res += ret;
+ ret = find_nearest(dx <= 0.0 ? node->right : node->left, pos, range, list, ordered, dim);
+ }
+ if(ret == -1) {
+ return -1;
+ }
+ added_res += ret;
+
+ return added_res;
+}
+
+#if 0
+static int find_nearest_n(struct kdnode *node, const double *pos, double range, int num, struct rheap *heap, int dim)
+{
+ double dist_sq, dx;
+ int i, ret, added_res = 0;
+
+ if(!node) return 0;
+
+ /* if the photon is close enough, add it to the result heap */
+ dist_sq = 0;
+ for(i=0; i<dim; i++) {
+ dist_sq += SQ(node->pos[i] - pos[i]);
+ }
+ if(dist_sq <= range_sq) {
+ if(heap->size >= num) {
+ /* get furthest element */
+ struct res_node *maxelem = rheap_get_max(heap);
+
+ /* and check if the new one is closer than that */
+ if(maxelem->dist_sq > dist_sq) {
+ rheap_remove_max(heap);
+
+ if(rheap_insert(heap, node, dist_sq) == -1) {
+ return -1;
+ }
+ added_res = 1;
+
+ range_sq = dist_sq;
+ }
+ } else {
+ if(rheap_insert(heap, node, dist_sq) == -1) {
+ return =1;
+ }
+ added_res = 1;
+ }
+ }
+
+
+ /* find signed distance from the splitting plane */
+ dx = pos[node->dir] - node->pos[node->dir];
+
+ ret = find_nearest_n(dx <= 0.0 ? node->left : node->right, pos, range, num, heap, dim);
+ if(ret >= 0 && fabs(dx) < range) {
+ added_res += ret;
+ ret = find_nearest_n(dx <= 0.0 ? node->right : node->left, pos, range, num, heap, dim);
+ }
+
+}
+#endif
+
+static void kd_nearest_i(struct kdnode *node, const double *pos, struct kdnode **result, double *result_dist_sq, struct kdhyperrect* rect)
+{
+ int dir = node->dir;
+ int i;
+ double dummy, dist_sq;
+ struct kdnode *nearer_subtree, *farther_subtree;
+ double *nearer_hyperrect_coord, *farther_hyperrect_coord;
+
+ /* Decide whether to go left or right in the tree */
+ dummy = pos[dir] - node->pos[dir];
+ if (dummy <= 0) {
+ nearer_subtree = node->left;
+ farther_subtree = node->right;
+ nearer_hyperrect_coord = rect->max + dir;
+ farther_hyperrect_coord = rect->min + dir;
+ } else {
+ nearer_subtree = node->right;
+ farther_subtree = node->left;
+ nearer_hyperrect_coord = rect->min + dir;
+ farther_hyperrect_coord = rect->max + dir;
+ }
+
+ if (nearer_subtree) {
+ /* Slice the hyperrect to get the hyperrect of the nearer subtree */
+ dummy = *nearer_hyperrect_coord;
+ *nearer_hyperrect_coord = node->pos[dir];
+ /* Recurse down into nearer subtree */
+ kd_nearest_i(nearer_subtree, pos, result, result_dist_sq, rect);
+ /* Undo the slice */
+ *nearer_hyperrect_coord = dummy;
+ }
+
+ /* Check the distance of the point at the current node, compare it
+ * with our best so far */
+ dist_sq = 0;
+ for(i=0; i < rect->dim; i++) {
+ dist_sq += SQ(node->pos[i] - pos[i]);
+ }
+ if (dist_sq < *result_dist_sq) {
+ *result = node;
+ *result_dist_sq = dist_sq;
+ }
+
+ if (farther_subtree) {
+ /* Get the hyperrect of the farther subtree */
+ dummy = *farther_hyperrect_coord;
+ *farther_hyperrect_coord = node->pos[dir];
+ /* Check if we have to recurse down by calculating the closest
+ * point of the hyperrect and see if it's closer than our
+ * minimum distance in result_dist_sq. */
+ if (hyperrect_dist_sq(rect, pos) < *result_dist_sq) {
+ /* Recurse down into farther subtree */
+ kd_nearest_i(farther_subtree, pos, result, result_dist_sq, rect);
+ }
+ /* Undo the slice on the hyperrect */
+ *farther_hyperrect_coord = dummy;
+ }
+}
+
+struct kdres *kd_nearest(struct kdtree *kd, const double *pos)
+{
+ struct kdhyperrect *rect;
+ struct kdnode *result;
+ struct kdres *rset;
+ double dist_sq;
+ int i;
+
+ if (!kd) return 0;
+ if (!kd->rect) return 0;
+
+ /* Allocate result set */
+ if(!(rset = malloc(sizeof *rset))) {
+ return 0;
+ }
+ if(!(rset->rlist = alloc_resnode())) {
+ free(rset);
+ return 0;
+ }
+ rset->rlist->next = 0;
+ rset->tree = kd;
+
+ /* Duplicate the bounding hyperrectangle, we will work on the copy */
+ if (!(rect = hyperrect_duplicate(kd->rect))) {
+ kd_res_free(rset);
+ return 0;
+ }
+
+ /* Our first guesstimate is the root node */
+ result = kd->root;
+ dist_sq = 0;
+ for (i = 0; i < kd->dim; i++)
+ dist_sq += SQ(result->pos[i] - pos[i]);
+
+ /* Search for the nearest neighbour recursively */
+ kd_nearest_i(kd->root, pos, &result, &dist_sq, rect);
+
+ /* Free the copy of the hyperrect */
+ hyperrect_free(rect);
+
+ /* Store the result */
+ if (result) {
+ if (rlist_insert(rset->rlist, result, -1.0) == -1) {
+ kd_res_free(rset);
+ return 0;
+ }
+ rset->size = 1;
+ kd_res_rewind(rset);
+ return rset;
+ } else {
+ kd_res_free(rset);
+ return 0;
+ }
+}
+
+struct kdres *kd_nearestf(struct kdtree *tree, const float *pos)
+{
+ static double sbuf[16];
+ double *bptr, *buf = 0;
+ int dim = tree->dim;
+ struct kdres *res;
+
+ if(dim > 16) {
+#ifndef NO_ALLOCA
+ if(dim <= 256)
+ bptr = buf = alloca(dim * sizeof *bptr);
+ else
+#endif
+ if(!(bptr = buf = malloc(dim * sizeof *bptr))) {
+ return 0;
+ }
+ } else {
+ bptr = buf = sbuf;
+ }
+
+ while(dim-- > 0) {
+ *bptr++ = *pos++;
+ }
+
+ res = kd_nearest(tree, buf);
+#ifndef NO_ALLOCA
+ if(tree->dim > 256)
+#else
+ if(tree->dim > 16)
+#endif
+ free(buf);
+ return res;
+}
+
+struct kdres *kd_nearest3(struct kdtree *tree, double x, double y, double z)
+{
+ double pos[3];
+ pos[0] = x;
+ pos[1] = y;
+ pos[2] = z;
+ return kd_nearest(tree, pos);
+}
+
+struct kdres *kd_nearest3f(struct kdtree *tree, float x, float y, float z)
+{
+ double pos[3];
+ pos[0] = x;
+ pos[1] = y;
+ pos[2] = z;
+ return kd_nearest(tree, pos);
+}
+
+/* ---- nearest N search ---- */
+/*
+static kdres *kd_nearest_n(struct kdtree *kd, const double *pos, int num)
+{
+ int ret;
+ struct kdres *rset;
+
+ if(!(rset = malloc(sizeof *rset))) {
+ return 0;
+ }
+ if(!(rset->rlist = alloc_resnode())) {
+ free(rset);
+ return 0;
+ }
+ rset->rlist->next = 0;
+ rset->tree = kd;
+
+ if((ret = find_nearest_n(kd->root, pos, range, num, rset->rlist, kd->dim)) == -1) {
+ kd_res_free(rset);
+ return 0;
+ }
+ rset->size = ret;
+ kd_res_rewind(rset);
+ return rset;
+}*/
+
+struct kdres *kd_nearest_range(struct kdtree *kd, const double *pos, double range)
+{
+ int ret;
+ struct kdres *rset;
+
+ if(!(rset = malloc(sizeof *rset))) {
+ return 0;
+ }
+ if(!(rset->rlist = alloc_resnode())) {
+ free(rset);
+ return 0;
+ }
+ rset->rlist->next = 0;
+ rset->tree = kd;
+
+ if((ret = find_nearest(kd->root, pos, range, rset->rlist, 0, kd->dim)) == -1) {
+ kd_res_free(rset);
+ return 0;
+ }
+ rset->size = ret;
+ kd_res_rewind(rset);
+ return rset;
+}
+
+struct kdres *kd_nearest_rangef(struct kdtree *kd, const float *pos, float range)
+{
+ static double sbuf[16];
+ double *bptr, *buf = 0;
+ int dim = kd->dim;
+ struct kdres *res;
+
+ if(dim > 16) {
+#ifndef NO_ALLOCA
+ if(dim <= 256)
+ bptr = buf = alloca(dim * sizeof *bptr);
+ else
+#endif
+ if(!(bptr = buf = malloc(dim * sizeof *bptr))) {
+ return 0;
+ }
+ } else {
+ bptr = buf = sbuf;
+ }
+
+ while(dim-- > 0) {
+ *bptr++ = *pos++;
+ }
+
+ res = kd_nearest_range(kd, buf, range);
+#ifndef NO_ALLOCA
+ if(kd->dim > 256)
+#else
+ if(kd->dim > 16)
+#endif
+ free(buf);
+ return res;
+}
+
+struct kdres *kd_nearest_range3(struct kdtree *tree, double x, double y, double z, double range)
+{
+ double buf[3];
+ buf[0] = x;
+ buf[1] = y;
+ buf[2] = z;
+ return kd_nearest_range(tree, buf, range);
+}
+
+struct kdres *kd_nearest_range3f(struct kdtree *tree, float x, float y, float z, float range)
+{
+ double buf[3];
+ buf[0] = x;
+ buf[1] = y;
+ buf[2] = z;
+ return kd_nearest_range(tree, buf, range);
+}
+
+void kd_res_free(struct kdres *rset)
+{
+ clear_results(rset);
+ free_resnode(rset->rlist);
+ free(rset);
+}
+
+int kd_res_size(struct kdres *set)
+{
+ return (set->size);
+}
+
+void kd_res_rewind(struct kdres *rset)
+{
+ rset->riter = rset->rlist->next;
+}
+
+int kd_res_end(struct kdres *rset)
+{
+ return rset->riter == 0;
+}
+
+int kd_res_next(struct kdres *rset)
+{
+ rset->riter = rset->riter->next;
+ return rset->riter != 0;
+}
+
+void *kd_res_item(struct kdres *rset, double *pos)
+{
+ if(rset->riter) {
+ if(pos) {
+ memcpy(pos, rset->riter->item->pos, rset->tree->dim * sizeof *pos);
+ }
+ return rset->riter->item->data;
+ }
+ return 0;
+}
+
+void *kd_res_itemf(struct kdres *rset, float *pos)
+{
+ if(rset->riter) {
+ if(pos) {
+ int i;
+ for(i=0; i<rset->tree->dim; i++) {
+ pos[i] = rset->riter->item->pos[i];
+ }
+ }
+ return rset->riter->item->data;
+ }
+ return 0;
+}
+
+void *kd_res_item3(struct kdres *rset, double *x, double *y, double *z)
+{
+ if(rset->riter) {
+ if(*x) *x = rset->riter->item->pos[0];
+ if(*y) *y = rset->riter->item->pos[1];
+ if(*z) *z = rset->riter->item->pos[2];
+ }
+ return 0;
+}
+
+void *kd_res_item3f(struct kdres *rset, float *x, float *y, float *z)
+{
+ if(rset->riter) {
+ if(*x) *x = rset->riter->item->pos[0];
+ if(*y) *y = rset->riter->item->pos[1];
+ if(*z) *z = rset->riter->item->pos[2];
+ }
+ return 0;
+}
+
+void *kd_res_item_data(struct kdres *set)
+{
+ return kd_res_item(set, 0);
+}
+
+/* ---- hyperrectangle helpers ---- */
+static struct kdhyperrect* hyperrect_create(int dim, const double *min, const double *max)
+{
+ size_t size = dim * sizeof(double);
+ struct kdhyperrect* rect = 0;
+
+ if (!(rect = malloc(sizeof(struct kdhyperrect)))) {
+ return 0;
+ }
+
+ rect->dim = dim;
+ if (!(rect->min = malloc(size))) {
+ free(rect);
+ return 0;
+ }
+ if (!(rect->max = malloc(size))) {
+ free(rect->min);
+ free(rect);
+ return 0;
+ }
+ memcpy(rect->min, min, size);
+ memcpy(rect->max, max, size);
+
+ return rect;
+}
+
+static void hyperrect_free(struct kdhyperrect *rect)
+{
+ free(rect->min);
+ free(rect->max);
+ free(rect);
+}
+
+static struct kdhyperrect* hyperrect_duplicate(const struct kdhyperrect *rect)
+{
+ return hyperrect_create(rect->dim, rect->min, rect->max);
+}
+
+static void hyperrect_extend(struct kdhyperrect *rect, const double *pos)
+{
+ int i;
+
+ for (i=0; i < rect->dim; i++) {
+ if (pos[i] < rect->min[i]) {
+ rect->min[i] = pos[i];
+ }
+ if (pos[i] > rect->max[i]) {
+ rect->max[i] = pos[i];
+ }
+ }
+}
+
+static double hyperrect_dist_sq(struct kdhyperrect *rect, const double *pos)
+{
+ int i;
+ double result = 0;
+
+ for (i=0; i < rect->dim; i++) {
+ if (pos[i] < rect->min[i]) {
+ result += SQ(rect->min[i] - pos[i]);
+ } else if (pos[i] > rect->max[i]) {
+ result += SQ(rect->max[i] - pos[i]);
+ }
+ }
+
+ return result;
+}
+
+/* ---- static helpers ---- */
+
+#ifdef USE_LIST_NODE_ALLOCATOR
+/* special list node allocators. */
+static struct res_node *free_nodes;
+
+#ifndef NO_PTHREADS
+static pthread_mutex_t alloc_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+static struct res_node *alloc_resnode(void)
+{
+ struct res_node *node;
+
+#ifndef NO_PTHREADS
+ pthread_mutex_lock(&alloc_mutex);
+#endif
+
+ if(!free_nodes) {
+ node = malloc(sizeof *node);
+ } else {
+ node = free_nodes;
+ free_nodes = free_nodes->next;
+ node->next = 0;
+ }
+
+#ifndef NO_PTHREADS
+ pthread_mutex_unlock(&alloc_mutex);
+#endif
+
+ return node;
+}
+
+static void free_resnode(struct res_node *node)
+{
+#ifndef NO_PTHREADS
+ pthread_mutex_lock(&alloc_mutex);
+#endif
+
+ node->next = free_nodes;
+ free_nodes = node;
+
+#ifndef NO_PTHREADS
+ pthread_mutex_unlock(&alloc_mutex);
+#endif
+}
+#endif /* list node allocator or not */
+
+
+/* inserts the item. if dist_sq is >= 0, then do an ordered insert */
+/* TODO make the ordering code use heapsort */
+static int rlist_insert(struct res_node *list, struct kdnode *item, double dist_sq)
+{
+ struct res_node *rnode;
+
+ if(!(rnode = alloc_resnode())) {
+ return -1;
+ }
+ rnode->item = item;
+ rnode->dist_sq = dist_sq;
+
+ if(dist_sq >= 0.0) {
+ while(list->next && list->next->dist_sq < dist_sq) {
+ list = list->next;
+ }
+ }
+ rnode->next = list->next;
+ list->next = rnode;
+ return 0;
+}
+
+static void clear_results(struct kdres *rset)
+{
+ struct res_node *tmp, *node = rset->rlist->next;
+
+ while(node) {
+ tmp = node;
+ node = node->next;
+ free_resnode(tmp);
+ }
+
+ rset->rlist->next = 0;
+}
diff --git a/intern/raskter/raskter_kdtree.h b/intern/raskter/raskter_kdtree.h
new file mode 100644
index 00000000000..da80e422a80
--- /dev/null
+++ b/intern/raskter/raskter_kdtree.h
@@ -0,0 +1,129 @@
+/*
+This file is part of ``kdtree'', a library for working with kd-trees.
+Copyright (C) 2007-2011 John Tsiombikas <nuclear@member.fsf.org>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGE.
+*/
+#ifndef _KDTREE_H_
+#define _KDTREE_H_
+#define USE_LIST_NODE_ALLOCATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct kdtree;
+struct kdres;
+
+
+/* create a kd-tree for "k"-dimensional data */
+struct kdtree *kd_create(int k);
+
+/* free the struct kdtree */
+void kd_free(struct kdtree *tree);
+
+/* remove all the elements from the tree */
+void kd_clear(struct kdtree *tree);
+
+/* if called with non-null 2nd argument, the function provided
+ * will be called on data pointers (see kd_insert) when nodes
+ * are to be removed from the tree.
+ */
+void kd_data_destructor(struct kdtree *tree, void (*destr)(void*));
+
+/* insert a node, specifying its position, and optional data */
+int kd_insert(struct kdtree *tree, const double *pos, void *data);
+int kd_insertf(struct kdtree *tree, const float *pos, void *data);
+int kd_insert3(struct kdtree *tree, double x, double y, double z, void *data);
+int kd_insert3f(struct kdtree *tree, float x, float y, float z, void *data);
+
+/* Find the nearest node from a given point.
+ *
+ * This function returns a pointer to a result set with at most one element.
+ */
+struct kdres *kd_nearest(struct kdtree *tree, const double *pos);
+struct kdres *kd_nearestf(struct kdtree *tree, const float *pos);
+struct kdres *kd_nearest3(struct kdtree *tree, double x, double y, double z);
+struct kdres *kd_nearest3f(struct kdtree *tree, float x, float y, float z);
+
+/* Find the N nearest nodes from a given point.
+ *
+ * This function returns a pointer to a result set, with at most N elements,
+ * which can be manipulated with the kd_res_* functions.
+ * The returned pointer can be null as an indication of an error. Otherwise
+ * a valid result set is always returned which may contain 0 or more elements.
+ * The result set must be deallocated with kd_res_free after use.
+ */
+/*
+struct kdres *kd_nearest_n(struct kdtree *tree, const double *pos, int num);
+struct kdres *kd_nearest_nf(struct kdtree *tree, const float *pos, int num);
+struct kdres *kd_nearest_n3(struct kdtree *tree, double x, double y, double z);
+struct kdres *kd_nearest_n3f(struct kdtree *tree, float x, float y, float z);
+*/
+
+/* Find any nearest nodes from a given point within a range.
+ *
+ * This function returns a pointer to a result set, which can be manipulated
+ * by the kd_res_* functions.
+ * The returned pointer can be null as an indication of an error. Otherwise
+ * a valid result set is always returned which may contain 0 or more elements.
+ * The result set must be deallocated with kd_res_free after use.
+ */
+struct kdres *kd_nearest_range(struct kdtree *tree, const double *pos, double range);
+struct kdres *kd_nearest_rangef(struct kdtree *tree, const float *pos, float range);
+struct kdres *kd_nearest_range3(struct kdtree *tree, double x, double y, double z, double range);
+struct kdres *kd_nearest_range3f(struct kdtree *tree, float x, float y, float z, float range);
+
+/* frees a result set returned by kd_nearest_range() */
+void kd_res_free(struct kdres *set);
+
+/* returns the size of the result set (in elements) */
+int kd_res_size(struct kdres *set);
+
+/* rewinds the result set iterator */
+void kd_res_rewind(struct kdres *set);
+
+/* returns non-zero if the set iterator reached the end after the last element */
+int kd_res_end(struct kdres *set);
+
+/* advances the result set iterator, returns non-zero on success, zero if
+ * there are no more elements in the result set.
+ */
+int kd_res_next(struct kdres *set);
+
+/* returns the data pointer (can be null) of the current result set item
+ * and optionally sets its position to the pointers(s) if not null.
+ */
+void *kd_res_item(struct kdres *set, double *pos);
+void *kd_res_itemf(struct kdres *set, float *pos);
+void *kd_res_item3(struct kdres *set, double *x, double *y, double *z);
+void *kd_res_item3f(struct kdres *set, float *x, float *y, float *z);
+
+/* equivalent to kd_res_item(set, 0) */
+void *kd_res_item_data(struct kdres *set);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _KDTREE_H_ */
diff --git a/intern/raskter/raskter_mt.c b/intern/raskter/raskter_mt.c
new file mode 100644
index 00000000000..feda624d668
--- /dev/null
+++ b/intern/raskter/raskter_mt.c
@@ -0,0 +1,290 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Peter Larabell.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+/** \file raskter_mt.c
+ * \ingroup RASKTER
+ */
+#include <stdlib.h>
+
+#include "raskter.h"
+static int rast_scan_init(struct layer_init_data *mlayer_data, struct r_fill_context *ctx, struct poly_vert *verts, int num_verts) {
+ int x_curr; /* current pixel position in X */
+ int y_curr; /* current scan line being drawn */
+ int yp; /* y-pixel's position in frame buffer */
+ int swixd = 0; /* whether or not edges switched position in X */
+ int i=0; /* counter */
+ float *cpxl; /* pixel pointers... */
+ float *mpxl;
+ float *spxl;
+ struct e_status *e_curr; /* edge pointers... */
+ struct e_status *e_temp;
+ struct e_status *edgbuf;
+ struct e_status **edgec;
+
+
+ if(num_verts < 3) {
+ return(1);
+ }
+
+ if((edgbuf = (struct e_status *)(malloc(sizeof(struct e_status) * num_verts))) == NULL) {
+ return(0);
+ }
+
+ /* set initial bounds length to 0 */
+ mlayer_data->bounds_length=0;
+
+ /* round 1, count up all the possible spans in the base buffer */
+ preprocess_all_edges(ctx, verts, num_verts, edgbuf);
+
+ /* can happen with a zero area mask */
+ if (ctx->all_edges == NULL) {
+ free(edgbuf);
+ return(1);
+ }
+ ctx->possible_edges = NULL;
+
+ for(y_curr = ctx->all_edges->ybeg; (ctx->all_edges || ctx->possible_edges); y_curr++) {
+
+ for(edgec = &ctx->possible_edges; ctx->all_edges && (ctx->all_edges->ybeg == y_curr);) {
+ x_curr = ctx->all_edges->x; /* Set current X position. */
+ for(;;) { /* Start looping edges. Will break when edges run out. */
+ e_curr = *edgec; /* Set up a current edge pointer. */
+ if(!e_curr || (e_curr->x >= x_curr)) { /* If we have an no edge, or we need to skip some X-span, */
+ e_temp = ctx->all_edges->e_next; /* set a temp "next" edge to test. */
+ *edgec = ctx->all_edges; /* Add this edge to the list to be scanned. */
+ ctx->all_edges->e_next = e_curr; /* Set up the next edge. */
+ edgec = &ctx->all_edges->e_next; /* Set our list to the next edge's location in memory. */
+ ctx->all_edges = e_temp; /* Skip the NULL or bad X edge, set pointer to next edge. */
+ break; /* Stop looping edges (since we ran out or hit empty X span. */
+ } else {
+ edgec = &e_curr->e_next; /* Set the pointer to the edge list the "next" edge. */
+ }
+ }
+ }
+
+ yp = y_curr * ctx->rb.sizex;
+ spxl = ctx->rb.buf + (yp);
+
+ for(e_curr = ctx->possible_edges; e_curr; e_curr = e_curr->e_next) {
+
+ /* set up xmin and xmax bounds on this scan line */
+ cpxl = spxl + MAX2(e_curr->x, 0);
+ e_curr = e_curr->e_next;
+ mpxl = spxl + MIN2(e_curr->x, ctx->rb.sizex) - 1;
+
+ if((y_curr >= 0) && (y_curr < ctx->rb.sizey)) {
+ mlayer_data->bounds_length++;
+ }
+ }
+
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec);) {
+ if(!(--(e_curr->num))) {
+ *edgec = e_curr->e_next;
+ } else {
+ e_curr->x += e_curr->xshift;
+ if((e_curr->drift += e_curr->drift_inc) > 0) {
+ e_curr->x += e_curr->xdir;
+ e_curr->drift -= e_curr->drift_dec;
+ }
+ edgec = &e_curr->e_next;
+ }
+ }
+ if(ctx->possible_edges) {
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
+ /* if the current edge hits scan line at greater X than the next edge, we need to exchange the edges */
+ if(e_curr->x > e_curr->e_next->x) {
+ *edgec = e_curr->e_next;
+ /* exchange the pointers */
+ e_temp = e_curr->e_next->e_next;
+ e_curr->e_next->e_next = e_curr;
+ e_curr->e_next = e_temp;
+ /* set flag that we had at least one switch */
+ swixd = 1;
+ }
+ }
+ /* if we did have a switch, look for more (there will more if there was one) */
+ for(;;) {
+ /* reset exchange flag so it's only set if we encounter another one */
+ swixd = 0;
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
+ /* again, if current edge hits scan line at higher X than next edge, exchange the edges and set flag */
+ if(e_curr->x > e_curr->e_next->x) {
+ *edgec = e_curr->e_next;
+ /* exchange the pointers */
+ e_temp = e_curr->e_next->e_next;
+ e_curr->e_next->e_next = e_curr;
+ e_curr->e_next = e_temp;
+ /* flip the exchanged flag */
+ swixd = 1;
+ }
+ }
+ /* if we had no exchanges, we're done reshuffling the pointers */
+ if(!swixd) {
+ break;
+ }
+ }
+ }
+ }
+
+
+/*initialize index buffer and bounds buffers*/
+ //gets the +1 for dummy at the end
+ if((mlayer_data->bound_indexes = (int *)(malloc(sizeof(int) * ctx->rb.sizey+1)))==NULL) {
+ return(0);
+ }
+ //gets the +1 for dummy at the start
+ if((mlayer_data->bounds = (struct scan_line *)(malloc(sizeof(struct scan_line) * mlayer_data->bounds_length+1)))==NULL){
+ return(0);
+ }
+ //init all the indexes to zero (are they already zeroed from malloc???)
+ for(i=0;i<ctx->rb.sizey+1;i++){
+ mlayer_data->bound_indexes[i]=0;
+ }
+ /* round 2, fill in the full list of bounds, and create indexes to the list... */
+ preprocess_all_edges(ctx, verts, num_verts, edgbuf);
+
+ /* can happen with a zero area mask */
+ if (ctx->all_edges == NULL) {
+ free(edgbuf);
+ return(1);
+ }
+ ctx->possible_edges = NULL;
+
+ /* restart i as a counter for total span placement in buffer */
+ i=1;
+ for(y_curr = ctx->all_edges->ybeg; (ctx->all_edges || ctx->possible_edges); y_curr++) {
+
+ for(edgec = &ctx->possible_edges; ctx->all_edges && (ctx->all_edges->ybeg == y_curr);) {
+ x_curr = ctx->all_edges->x; /* Set current X position. */
+ for(;;) { /* Start looping edges. Will break when edges run out. */
+ e_curr = *edgec; /* Set up a current edge pointer. */
+ if(!e_curr || (e_curr->x >= x_curr)) { /* If we have an no edge, or we need to skip some X-span, */
+ e_temp = ctx->all_edges->e_next; /* set a temp "next" edge to test. */
+ *edgec = ctx->all_edges; /* Add this edge to the list to be scanned. */
+ ctx->all_edges->e_next = e_curr; /* Set up the next edge. */
+ edgec = &ctx->all_edges->e_next; /* Set our list to the next edge's location in memory. */
+ ctx->all_edges = e_temp; /* Skip the NULL or bad X edge, set pointer to next edge. */
+ break; /* Stop looping edges (since we ran out or hit empty X span. */
+ } else {
+ edgec = &e_curr->e_next; /* Set the pointer to the edge list the "next" edge. */
+ }
+ }
+ }
+
+ yp = y_curr * ctx->rb.sizex;
+ spxl = ctx->rb.buf + (yp);
+ if((y_curr >=0) && (y_curr < ctx->rb.sizey)){
+ ctx->bound_indexes[y_curr]=i;
+ }
+ for(e_curr = ctx->possible_edges; e_curr; e_curr = e_curr->e_next) {
+
+ /* set up xmin and xmax bounds on this scan line */
+ cpxl = spxl + MAX2(e_curr->x, 0);
+ e_curr = e_curr->e_next;
+ mpxl = spxl + MIN2(e_curr->x, ctx->rb.sizex) - 1;
+
+ if((y_curr >= 0) && (y_curr < ctx->rb.sizey)) {
+ mlayer_data->bounds[i].xstart=cpxl-spxl;
+ mlayer_data->bounds[i].xend=mpxl-spxl;
+ i++;
+ }
+ }
+
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec);) {
+ if(!(--(e_curr->num))) {
+ *edgec = e_curr->e_next;
+ } else {
+ e_curr->x += e_curr->xshift;
+ if((e_curr->drift += e_curr->drift_inc) > 0) {
+ e_curr->x += e_curr->xdir;
+ e_curr->drift -= e_curr->drift_dec;
+ }
+ edgec = &e_curr->e_next;
+ }
+ }
+ if(ctx->possible_edges) {
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
+ /* if the current edge hits scan line at greater X than the next edge, we need to exchange the edges */
+ if(e_curr->x > e_curr->e_next->x) {
+ *edgec = e_curr->e_next;
+ /* exchange the pointers */
+ e_temp = e_curr->e_next->e_next;
+ e_curr->e_next->e_next = e_curr;
+ e_curr->e_next = e_temp;
+ /* set flag that we had at least one switch */
+ swixd = 1;
+ }
+ }
+ /* if we did have a switch, look for more (there will more if there was one) */
+ for(;;) {
+ /* reset exchange flag so it's only set if we encounter another one */
+ swixd = 0;
+ for(edgec = &ctx->possible_edges; (e_curr = *edgec)->e_next; edgec = &(*edgec)->e_next) {
+ /* again, if current edge hits scan line at higher X than next edge, exchange the edges and set flag */
+ if(e_curr->x > e_curr->e_next->x) {
+ *edgec = e_curr->e_next;
+ /* exchange the pointers */
+ e_temp = e_curr->e_next->e_next;
+ e_curr->e_next->e_next = e_curr;
+ e_curr->e_next = e_temp;
+ /* flip the exchanged flag */
+ swixd = 1;
+ }
+ }
+ /* if we had no exchanges, we're done reshuffling the pointers */
+ if(!swixd) {
+ break;
+ }
+ }
+ }
+ }
+
+ free(edgbuf);
+ return 1;
+}
+
+/* static */ int PLX_init_base_data(struct layer_init_data *mlayer_data, float(*base_verts)[2], int num_base_verts,
+ float *buf, int buf_x, int buf_y) {
+ int i; /* i: Loop counter. */
+ struct poly_vert *ply; /* ply: Pointer to a list of integer buffer-space vertex coordinates. */
+ struct r_fill_context ctx = {0};
+ const float buf_x_f = (float)(buf_x);
+ const float buf_y_f = (float)(buf_y);
+ if((ply = (struct poly_vert *)(malloc(sizeof(struct poly_vert) * num_base_verts))) == NULL) {
+ return(0);
+ }
+ ctx.rb.buf = buf; /* Set the output buffer pointer. */
+ ctx.rb.sizex = buf_x; /* Set the output buffer size in X. (width) */
+ ctx.rb.sizey = buf_y; /* Set the output buffer size in Y. (height) */
+ for(i = 0; i < num_base_verts; i++) { /* Loop over all base_verts. */
+ ply[i].x = (int)((base_verts[i][0] * buf_x_f) + 0.5f); /* Range expand normalized X to integer buffer-space X. */
+ ply[i].y = (int)((base_verts[i][1] * buf_y_f) + 0.5f); /* Range expand normalized Y to integer buffer-space Y. */
+ }
+ i = rast_scan_init(mlayer_data, &ctx, ply, num_base_verts); /* Call our rasterizer, passing in the integer coords for each vert. */
+ free(ply); /* Free the memory allocated for the integer coordinate table. */
+ return(i); /* Return the value returned by the rasterizer. */
+}
+
diff --git a/release/scripts/modules/bl_i18n_utils/merge_po.py b/release/scripts/modules/bl_i18n_utils/merge_po.py
index b09e4daefbc..51e587ca4c8 100755
--- a/release/scripts/modules/bl_i18n_utils/merge_po.py
+++ b/release/scripts/modules/bl_i18n_utils/merge_po.py
@@ -31,16 +31,17 @@
import sys
try:
+ import settings
import utils
except:
- from . import utils
+ from . import (settings, utils)
def main():
import argparse
parser = argparse.ArgumentParser(description="" \
"Merge one or more .po files into the first dest one.\n" \
- "If a msgkey (msgid, msgctxt) is present in more than " \
+ "If a msgkey (msgctxt, msgid) is present in more than " \
"one merged po, the one in the first file wins, unless " \
"it’s marked as fuzzy and one later is not.\n" \
"The fuzzy flag is removed if necessary.\n" \
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py
index 7b54af944ad..f1313b583f7 100644
--- a/release/scripts/modules/bpy/path.py
+++ b/release/scripts/modules/bpy/path.py
@@ -133,9 +133,6 @@ def display_name(name):
mixed case names are kept as is. Intended for use with
filenames and module names.
"""
-
- name = _os.path.splitext(name)[0]
-
# string replacements
name = name.replace("_colon_", ":")
@@ -154,7 +151,6 @@ def display_name_from_filepath(name):
ensured to be utf8 compatible.
"""
- name = _os.path.splitext(basename(name))[0]
name = _clean_utf8(name)
return name
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 75c5ef849ad..18450ebe316 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -36,6 +36,10 @@ class MESH_OT_delete_edgeloop(Operator):
bl_idname = "mesh.delete_edgeloop"
bl_label = "Delete Edge Loop"
+ @classmethod
+ def poll(cls, context):
+ return bpy.ops.transform.edge_slide.poll()
+
def execute(self, context):
if 'FINISHED' in bpy.ops.transform.edge_slide(value=1.0):
bpy.ops.mesh.select_more()
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 7ca464ce055..4f3be914e66 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -151,6 +151,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="")
col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="")
if group:
+ col.separator()
col.operator("object.vertex_group_move", icon='TRIA_UP', text="").direction = 'UP'
col.operator("object.vertex_group_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 374588939e2..ac724518e85 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -677,26 +677,37 @@ class CLIP_PT_mask_layers(Panel):
sc = context.space_data
mask = sc.mask
+ active_layer = mask.layers.active
+
+ rows = 5 if active_layer else 2
row = layout.row()
row.template_list(mask, "layers",
- mask, "active_layer_index", rows=3)
+ mask, "active_layer_index", rows=rows)
sub = row.column(align=True)
sub.operator("mask.layer_new", icon='ZOOMIN', text="")
sub.operator("mask.layer_remove", icon='ZOOMOUT', text="")
- active = mask.layers.active
- if active:
- layout.prop(active, "name")
+ if active_layer:
+ sub.separator()
+
+ props = sub.operator("mask.layer_move", icon='TRIA_UP', text="")
+ props.direction = 'UP'
+
+ props = sub.operator("mask.layer_move", icon='TRIA_DOWN', text="")
+ props.direction = 'DOWN'
+
+ layout.prop(active_layer, "name")
# blending
row = layout.row(align=True)
- row.prop(active, "alpha")
- row.prop(active, "invert", text="", icon='IMAGE_ALPHA')
+ row.prop(active_layer, "alpha")
+ row.prop(active_layer, "invert", text="", icon='IMAGE_ALPHA')
- layout.prop(active, "blend")
+ layout.prop(active_layer, "blend")
+ layout.prop(active_layer, "falloff")
class CLIP_PT_active_mask_spline(Panel):
@@ -723,7 +734,9 @@ class CLIP_PT_active_mask_spline(Panel):
col = layout.column()
col.prop(spline, "weight_interpolation")
- col.prop(spline, "use_cyclic")
+ rowsub = col.row()
+ rowsub.prop(spline, "use_cyclic")
+ rowsub.prop(spline, "use_fill")
class CLIP_PT_active_mask_point(Panel):
@@ -1291,6 +1304,17 @@ class CLIP_MT_mask(Menu):
layout.menu("CLIP_MT_mask_animation")
+class CLIP_MT_select_mode(Menu):
+ bl_label = "Select Mode"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.operator_enum("clip.mode_set", "mode")
+
+
class CLIP_MT_mask_visibility(Menu):
bl_label = "Show/Hide"
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 8ddb2df352a..04ea6b818ac 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -372,7 +372,7 @@ class INFO_MT_help(Menu):
layout = self.layout
layout.operator("wm.url_open", text="Manual", icon='HELP').url = "http://wiki.blender.org/index.php/Doc:2.6/Manual"
- layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-263"
+ layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-264"
layout.separator()
layout.operator("wm.url_open", text="Blender Website", icon='URL').url = "http://www.blender.org"
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 55cc47d98d5..a876c607cd3 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1826,15 +1826,9 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
layout.separator()
- layout.operator("TRANSFORM_OT_edge_slide")
- layout.operator("TRANSFORM_OT_edge_crease")
+ layout.operator("transform.edge_slide")
layout.operator("mesh.loop_multi_select", text="Edge Loop").ring = False
-
- #~ uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
- #~ uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
-
layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
-
layout.operator("mesh.loop_to_region")
layout.operator("mesh.region_to_loop")
@@ -1869,9 +1863,6 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
layout.separator()
- # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
- # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
-
layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
layout.separator()
diff --git a/release/text/readme.html b/release/text/readme.html
index 78ee25bb3ee..512ba32bac0 100644
--- a/release/text/readme.html
+++ b/release/text/readme.html
@@ -12,18 +12,18 @@
</style>
</head>
<body>
-<p class="title"><b>Blender 2.63</b></p>
+<p class="title"><b>Blender 2.64</b></p>
<p><br></p>
<p class="header"><b>About</b></p>
<p class="body">Welcome to Blender, the free, open source 3D application for modeling, animation, rendering, compositing, video editing and game creation. Blender is available for Linux, Mac OS X, Windows and FreeBSD and has a large world-wide community.</p>
<p class="body">Blender can be used freely for any purpose, including commercial use and distribution. It's free and open-source software, released under the GNU GPL licence. The entire source code is available on our website.</p>
<p class="body">For more information, visit <a href="http://www.blender.org">blender.org</a>.</p>
<p><br></p>
-<p class="header"><b>2.63</b></p>
-<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.63. This release is the fourth official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features. <a href="http://www.blender.org/development/release-logs/blender-263/">More information about this release</a>.</p>
+<p class="header"><b>2.64</b></p>
+<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.64. This release is the fifth official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features. <a href="http://www.blender.org/development/release-logs/blender-263/">More information about this release</a>.</p>
<p><br></p>
<p class="header"><b>Bugs</b></p>
-<p class="body">Although Blender 2.63 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
+<p class="body">Although Blender 2.64 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
<p><br></p>
<p class="header"><b>Package Contents</b></p>
<p class="body">The downloaded Blender package includes:</p>
@@ -47,7 +47,7 @@
<p class="header"><b>Links</b></p>
<p class="body">Users:</p>
<p class="body"> General information <a href="http://www.blender.org">www.blender.org</a> <br>
- Full release log <a href="http://www.blender.org/development/release-logs/blender-263/">www.blender.org/development/release-logs/blender-263/</a><br>
+ Full release log <a href="http://www.blender.org/development/release-logs/blender-264/">www.blender.org/development/release-logs/blender-264/</a><br>
Tutorials <a href="http://www.blender.org/education-help/">www.blender.org/education-help/</a> <br>
Manual <a href="http://wiki.blender.org/index.php/Doc:2.6/Manual">wiki.blender.org/index.php/Doc:2.6/Manual</a><br>
User Forum <a href="http://www.blenderartists.org">www.blenderartists.org</a><br>
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 171b62461a0..48c7103d8fd 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
-#define BLENDER_SUBVERSION 13
+#define BLENDER_SUBVERSION 14
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index 37763003099..eeebcdafe48 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -66,7 +66,7 @@ struct DerivedMesh *CDDM_from_curve(struct Object *ob);
/* creates a CDDerivedMesh from the given curve object and specified dispbase */
/* useful for OrcoDM creation for curves with constructive modifiers */
-DerivedMesh *CDDM_from_curve_customDB(struct Object *ob, struct ListBase *dispbase);
+DerivedMesh *CDDM_from_curve_displist(struct Object *ob, struct ListBase *dispbase);
/* Copies the given DerivedMesh with verts, faces & edges stored as
* custom element data.
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index ee7c13ba7cb..9a4f30c853f 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -64,12 +64,20 @@ void BKE_mask_layer_copy_list(struct ListBase *masklayers_new, struct ListBase *
/* splines */
struct MaskSpline *BKE_mask_spline_add(struct MaskLayer *masklay);
+int BKE_mask_spline_resolution(struct MaskSpline *spline, int width, int height);
+int BKE_mask_spline_feather_resolution(struct MaskSpline *spline, int width, int height);
+
+int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, const int resol);
+
float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point))[2];
float (*BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, int *tot_feather_point))[2];
+float (*BKE_mask_spline_differentiate_with_resolution_ex(struct MaskSpline *spline, int *tot_diff_point,
+ const int resol))[2];
float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_diff_point))[2];
-float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline,
- int width, int height, int *tot_feather_point))[2];
+float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(struct MaskSpline *spline, int *tot_feather_point,
+ const int resol, const int do_collapse))[2];
+float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_feather_point))[2];
float (*BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2];
@@ -184,6 +192,12 @@ void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer,
const short do_aspect_correct, const short do_mask_aa,
const short do_feather);
+/* initialization for tiling */
+#ifdef __PLX_RASKTER_MT__
+void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int width, int height,
+ const short do_aspect_correct);
+#endif
+
#define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT)
#define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT)
#define MASKPOINT_ISSEL_HANDLE_ONLY(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) && (((p)->bezt.f2 & SELECT) == 0) )
@@ -196,4 +210,21 @@ void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer,
#define MASKPOINT_SEL_HANDLE(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0
#define MASKPOINT_DESEL_HANDLE(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0
-#endif
+/* disable to test alternate rasterizer */
+/* #define USE_RASKTER */
+
+/* mask_rasterize.c */
+#ifndef USE_RASKTER
+struct MaskRasterHandle;
+typedef struct MaskRasterHandle MaskRasterHandle;
+
+MaskRasterHandle *BKE_maskrasterize_handle_new(void);
+void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle);
+void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask,
+ const int width, const int height,
+ const short do_aspect_correct, const short do_mask_aa,
+ const short do_feather);
+float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2]);
+#endif /* USE_RASKTER */
+
+#endif /* __BKE_MASK_H__ */
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index abd0c4d96db..6fac915d520 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -141,10 +141,11 @@ void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me);
int BKE_mesh_nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert,
struct MEdge **alledge, int *totedge, struct MLoop **allloop, struct MPoly **allpoly,
int *totloop, int *totpoly);
-int BKE_mesh_nurbs_to_mdata_customdb(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert,
+int BKE_mesh_nurbs_displist_to_mdata(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert,
struct MEdge **alledge, int *_totedge, struct MLoop **allloop, struct MPoly **allpoly,
int *_totloop, int *_totpoly);
void BKE_mesh_from_nurbs(struct Object *ob);
+void BKE_mesh_from_nurbs_displist(struct Object *ob, struct ListBase *dispbase);
void BKE_mesh_from_curve(struct Scene *scene, struct Object *ob);
void free_dverts(struct MDeformVert *dvert, int totvert);
void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert); /* __NLA */
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index b3f17c06d5c..7bd9f75b2dd 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -660,6 +660,7 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMaterial *mat);
#define CMP_NODE_MASK 268
#define CMP_NODE_KEYINGSCREEN 269
#define CMP_NODE_KEYING 270
+#define CMP_NODE_TRACKPOS 271
#define CMP_NODE_GLARE 301
#define CMP_NODE_TONEMAP 302
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index b8ba3095905..3aa7148d821 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -177,6 +177,8 @@ typedef enum eObjectSet {
} eObjectSet;
struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter);
+struct LinkNode *BKE_object_groups(struct Object *ob);
+void BKE_object_groups_clear(struct Scene *scene, struct Base *base, struct Object *object);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 02f7467f06e..8ae705fa3eb 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -101,6 +101,7 @@ set(SRC
intern/lamp.c
intern/lattice.c
intern/library.c
+ intern/mask_rasterize.c
intern/mask.c
intern/material.c
intern/mball.c
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index af6583fd726..6a8ddd8e00a 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1438,9 +1438,9 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
if (strip->flag & ACTSTRIP_CYCLIC_USEZ) pose->cyclic_offset[2] = time * min[2];
}
else {
- if (fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2]))
+ if (fabsf(min[0]) >= fabsf(min[1]) && fabsf(min[0]) >= fabsf(min[2]))
pose->cyclic_offset[0] = time * min[0];
- else if (fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2]))
+ else if (fabsf(min[1]) >= fabsf(min[0]) && fabsf(min[1]) >= fabsf(min[2]))
pose->cyclic_offset[1] = time * min[1];
else
pose->cyclic_offset[2] = time * min[2];
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index e5e73061d52..b19b9db8749 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1709,10 +1709,10 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *UNUSED(ob))
DerivedMesh *CDDM_from_curve(Object *ob)
{
- return CDDM_from_curve_customDB(ob, &ob->disp);
+ return CDDM_from_curve_displist(ob, &ob->disp);
}
-DerivedMesh *CDDM_from_curve_customDB(Object *ob, ListBase *dispbase)
+DerivedMesh *CDDM_from_curve_displist(Object *ob, ListBase *dispbase)
{
DerivedMesh *dm;
CDDerivedMesh *cddm;
@@ -1722,7 +1722,7 @@ DerivedMesh *CDDM_from_curve_customDB(Object *ob, ListBase *dispbase)
MPoly *allpoly;
int totvert, totedge, totloop, totpoly;
- if (BKE_mesh_nurbs_to_mdata_customdb(ob, dispbase, &allvert, &totvert, &alledge,
+ if (BKE_mesh_nurbs_displist_to_mdata(ob, dispbase, &allvert, &totvert, &alledge,
&totedge, &allloop, &allpoly, &totloop, &totpoly) != 0)
{
/* Error initializing mdata. This often happens when curve is empty */
@@ -2110,7 +2110,7 @@ void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals
/* No tessellation on this mesh yet, need to calculate one.
*
* Important not to update face normals from polys since it
- * interfears with assigning the new normal layer in the following code.
+ * interferes with assigning the new normal layer in the following code.
*/
CDDM_recalc_tessellation_ex(dm, FALSE);
}
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 516de35fab3..af9bb971d05 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -414,8 +414,9 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
collpair->bp2 = face2->v2;
collpair->bp3 = face2->v3;
}
- else
+ else {
i++;
+ }
}
if ( i == 2 ) {
if ( face2->v4 ) {
@@ -429,8 +430,9 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
collpair->bp2 = face2->v4;
collpair->bp3 = face2->v3;
}
- else
+ else {
break;
+ }
}
else if ( i == 3 ) {
if ( face1->v4 && face2->v4 ) {
@@ -444,8 +446,9 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
collpair->bp2 = face2->v3;
collpair->bp3 = face2->v4;
}
- else
+ else {
break;
+ }
}
#ifdef USE_BULLET
@@ -464,8 +467,7 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
collpair->flag = 0;
collpair++;
}/*
- else
- {
+ else {
float w1, w2, w3, u1, u2, u3;
float v1[3], v2[3], relativeVelocity[3];
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 6879ec506f0..31ad4d0380a 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -71,7 +71,7 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa
clipmaxx = MAX2(minx, maxx);
clipmaxy = MAX2(miny, maxy);
- BLI_init_rctf(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy);
+ BLI_rctf_init(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy);
cumap->clipr = cumap->curr;
cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 674a2d98d07..e7dc825accd 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1588,7 +1588,7 @@ static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], c
float *labda, float *mu, float vec[3])
{
/* return:
- * -1: colliniar
+ * -1: collinear
* 0: no intersection of segments
* 1: exact intersection of segments
* 2: cross-intersection of segments
@@ -1712,7 +1712,7 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
y2 /= t02;
t02 = x1 * x2 + y1 * y2;
- if (fabs(t02) >= 1.0)
+ if (fabsf(t02) >= 1.0f)
t02 = 0.5 * M_PI;
else
t02 = (saacos(t02)) / 2.0f;
@@ -2366,9 +2366,9 @@ void BKE_curve_bevelList_make(Object *ob)
bevp0 = bevp1 + (nr - 1);
nr--;
while (nr--) {
- if (fabs(bevp0->vec[0] - bevp1->vec[0]) < 0.00001) {
- if (fabs(bevp0->vec[1] - bevp1->vec[1]) < 0.00001) {
- if (fabs(bevp0->vec[2] - bevp1->vec[2]) < 0.00001) {
+ if (fabsf(bevp0->vec[0] - bevp1->vec[0]) < 0.00001f) {
+ if (fabsf(bevp0->vec[1] - bevp1->vec[1]) < 0.00001f) {
+ if (fabsf(bevp0->vec[2] - bevp1->vec[2]) < 0.00001f) {
bevp0->dupe_tag = TRUE;
bl->dupe_nr++;
}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 1092f877283..4026d3f06d3 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -365,10 +365,10 @@ static void dag_add_material_nodetree_driver_relations(DagForest *dag, DagNode *
/* nodetree's nodes... */
for (n = ntree->nodes.first; n; n = n->next) {
if (n->id && GS(n->id->name) == ID_MA) {
- ma = (Material *)n->id;
- if (ma != rootma) {
- dag_add_material_driver_relations(dag, node, ma);
- }
+ ma = (Material *)n->id;
+ if (ma != rootma) {
+ dag_add_material_driver_relations(dag, node, ma);
+ }
}
else if (n->type == NODE_GROUP && n->id) {
dag_add_material_nodetree_driver_relations(dag, node, (bNodeTree *)n->id, rootma);
@@ -672,7 +672,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
* engine instancing assumes particular ordering of objects in list */
dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualization");
if (part->dup_ob->type == OB_MBALL)
- dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Object Visualization");
+ dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA, "Particle Object Visualization");
}
if (part->ren_as == PART_DRAW_GR && part->dup_group) {
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 6e5d6ffb0e9..8011efebaac 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -499,16 +499,14 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
/* vert data */
f1 = dlnew->verts;
totvert = 0;
- sf_vert = sf_ctx.fillvertbase.first;
- while (sf_vert) {
+
+ for (sf_vert = sf_ctx.fillvertbase.first; sf_vert; sf_vert = sf_vert->next) {
copy_v3_v3(f1, sf_vert->co);
f1 += 3;
/* index number */
sf_vert->tmp.l = totvert;
totvert++;
-
- sf_vert = sf_vert->next;
}
/* index data */
@@ -950,7 +948,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
curve_to_filledpoly(cu, nurb, dispbase);
}
- dm = CDDM_from_curve_customDB(ob, dispbase);
+ dm = CDDM_from_curve_displist(ob, dispbase);
CDDM_calc_normals_mapping(dm);
}
@@ -1040,7 +1038,7 @@ static DerivedMesh *create_orco_dm(Scene *scene, Object *ob)
/* OrcoDM should be created from underformed disp lists */
BKE_displist_make_curveTypes_forOrco(scene, ob, &disp);
- dm = CDDM_from_curve_customDB(ob, &disp);
+ dm = CDDM_from_curve_displist(ob, &disp);
BKE_displist_free(&disp);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index a4e7676c602..4f4bafd00b4 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -29,7 +29,6 @@
* \ingroup bke
*/
-
#include <stddef.h>
#include <math.h>
@@ -98,8 +97,6 @@
#include <string.h>
#endif // WITH_MOD_FLUID
-//XXX #include "BIF_screen.h"
-
EffectorWeights *BKE_add_effector_weights(Group *group)
{
EffectorWeights *weights = MEM_callocN(sizeof(EffectorWeights), "EffectorWeights");
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 38c1709d79a..97b245bd067 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -285,12 +285,12 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix,
for (fcu = src->first; fcu; fcu = fcu->next) {
/* check if quoted string matches the path */
if ((fcu->rna_path) && strstr(fcu->rna_path, dataPrefix)) {
- char *quotedName = BLI_getQuotedStr(fcu->rna_path, dataPrefix);
+ char *quotedName = BLI_str_quoted_substrN(fcu->rna_path, dataPrefix);
if (quotedName) {
/* check if the quoted name matches the required name */
if (strcmp(quotedName, dataName) == 0) {
- LinkData *ld = MEM_callocN(sizeof(LinkData), "list_find_data_fcurves");
+ LinkData *ld = MEM_callocN(sizeof(LinkData), __func__);
ld->data = fcu;
BLI_addtail(dst, ld);
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index cefcbdd2762..438188b1e2a 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -1298,7 +1298,7 @@ float evaluate_time_fmodifiers(ListBase *modifiers, FCurve *fcu, float cvalue, f
return evaltime;
}
-/* Evalautes the given set of F-Curve Modifiers using the given data
+/* Evaluates the given set of F-Curve Modifiers using the given data
* Should only be called after evaluate_time_fmodifiers() has been called...
*/
void evaluate_value_fmodifiers(ListBase *modifiers, FCurve *fcu, float *cvalue, float evaltime)
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 0725b1732d3..89341845615 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -345,7 +345,7 @@ void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group
#if 0 /* warning, isn't clearing the recalc flag on the object which causes it to run all the time,
* not just on frame change.
- * This isn't working because the animation data is only re-evalyated on frame change so commenting for now
+ * This isn't working because the animation data is only re-evaluated on frame change so commenting for now
* but when its enabled at some point it will need to be changed so as not to update so much - campbell */
/* if animated group... */
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 5b3e823f050..8a573aaa676 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -185,7 +185,7 @@ DO_INLINE void print_lfvector(float (*fLongVector)[3], unsigned int verts)
/* create long vector */
DO_INLINE lfVector *create_lfvector(unsigned int verts)
{
- /* TODO: check if memory allocation was successfull */
+ /* TODO: check if memory allocation was successful */
return (lfVector *)MEM_callocN(verts * sizeof(lfVector), "cloth_implicit_alloc_vector");
// return (lfVector *)cloth_aligned_malloc(&MEMORY_BASE, verts * sizeof(lfVector));
}
@@ -513,7 +513,7 @@ static void print_bfmatrix(fmatrix3x3 *m3)
/* create big matrix */
DO_INLINE fmatrix3x3 *create_bfmatrix(unsigned int verts, unsigned int springs)
{
- // TODO: check if memory allocation was successfull */
+ // TODO: check if memory allocation was successful */
fmatrix3x3 *temp = (fmatrix3x3 *)MEM_callocN(sizeof(fmatrix3x3) * (verts + springs), "cloth_implicit_alloc_matrix");
temp[0].vcount = verts;
temp[0].scount = springs;
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index d5b1d3c98c8..0e73d10fa5f 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -29,8 +29,6 @@
* \ingroup bke
*/
-
-
#include <stdio.h>
#include <string.h>
#include <math.h>
@@ -65,7 +63,6 @@
#include "BKE_deform.h"
-//XXX #include "BIF_editdeform.h"
void calc_lat_fudu(int flag, int res, float *fu, float *du)
{
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index b400332db81..6fe838666c5 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -110,7 +110,7 @@ static BezTriple *mask_spline_point_prev_bezt(MaskSpline *spline, MaskSplinePoin
if (spline->flag & MASK_SPLINE_CYCLIC) {
return &(points_array[0].bezt);
}
- else {
+ else {
return NULL;
}
}
@@ -239,14 +239,14 @@ MaskSpline *BKE_mask_spline_add(MaskLayer *masklay)
/* cyclic shapes are more usually used */
// spline->flag |= MASK_SPLINE_CYCLIC; // disable because its not so nice for drawing. could be done differently
- spline->weight_interp = MASK_SPLINE_INTERP_LINEAR;
+ spline->weight_interp = MASK_SPLINE_INTERP_EASE;
BKE_mask_parent_init(&spline->parent);
return spline;
}
-static int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
+int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
{
float max_segment = 0.01f;
int i, resol = 1;
@@ -284,7 +284,7 @@ static int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height)
return resol;
}
-static int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height)
+int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height)
{
const float max_segment = 0.005;
int resol = BKE_mask_spline_resolution(spline, width, height);
@@ -314,14 +314,34 @@ static int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int
return resol;
}
-float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int width, int height,
- int *tot_diff_point))[2]
+int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const int resol)
+{
+ int len;
+
+ /* count */
+ len = (spline->tot_point - 1) * resol;
+
+ if (spline->flag & MASK_SPLINE_CYCLIC) {
+ len += resol;
+ }
+ else {
+ len++;
+ }
+
+ return len;
+}
+
+float (*BKE_mask_spline_differentiate_with_resolution_ex(MaskSpline *spline,
+ int *tot_diff_point,
+ const int resol
+ ))[2]
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
MaskSplinePoint *point, *prev;
float (*diff_points)[2], (*fp)[2];
- int a, len, resol = BKE_mask_spline_resolution(spline, width, height);
+ const int tot = BKE_mask_spline_differentiate_calc_total(spline, resol);
+ int a;
if (spline->tot_point <= 1) {
/* nothing to differentiate */
@@ -329,17 +349,9 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int wi
return NULL;
}
- /* count */
- len = (spline->tot_point - 1) * resol;
-
- if (spline->flag & MASK_SPLINE_CYCLIC)
- len += resol;
- else
- len++;
-
/* len+1 because of 'forward_diff_bezier' function */
- *tot_diff_point = len;
- diff_points = fp = MEM_mallocN((len + 1) * sizeof(*diff_points), "mask spline vets");
+ *tot_diff_point = tot;
+ diff_points = fp = MEM_mallocN((tot + 1) * sizeof(*diff_points), "mask spline vets");
a = spline->tot_point - 1;
if (spline->flag & MASK_SPLINE_CYCLIC)
@@ -378,24 +390,322 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int wi
return diff_points;
}
+float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int width, int height,
+ int *tot_diff_point
+ ))[2]
+{
+ int resol = BKE_mask_spline_resolution(spline, width, height);
+
+ return BKE_mask_spline_differentiate_with_resolution_ex(spline, tot_diff_point, resol);
+}
+
float (*BKE_mask_spline_differentiate(MaskSpline *spline, int *tot_diff_point))[2]
{
return BKE_mask_spline_differentiate_with_resolution(spline, 0, 0, tot_diff_point);
}
-float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, int width, int height,
- int *tot_feather_point))[2]
+/* ** feather points self-intersection collapse routine ** */
+
+typedef struct FeatherEdgesBucket {
+ int tot_segment;
+ int (*segments)[2];
+ int alloc_segment;
+} FeatherEdgesBucket;
+
+static void feather_bucket_add_edge(FeatherEdgesBucket *bucket, int start, int end)
{
- MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
+ const int alloc_delta = 256;
+
+ if (bucket->tot_segment >= bucket->alloc_segment) {
+ if (!bucket->segments) {
+ bucket->segments = MEM_callocN(alloc_delta * sizeof(*bucket->segments), "feather bucket segments");
+ }
+ else {
+ bucket->segments = MEM_reallocN(bucket->segments,
+ (alloc_delta + bucket->tot_segment) * sizeof(*bucket->segments));
+ }
+
+ bucket->alloc_segment += alloc_delta;
+ }
+
+ bucket->segments[bucket->tot_segment][0] = start;
+ bucket->segments[bucket->tot_segment][1] = end;
+
+ bucket->tot_segment++;
+}
+
+static void feather_bucket_check_intersect(float (*feather_points)[2], int tot_feather_point, FeatherEdgesBucket *bucket,
+ int cur_a, int cur_b)
+{
+ int i;
+
+ float *v1 = (float *) feather_points[cur_a];
+ float *v2 = (float *) feather_points[cur_b];
+
+ for (i = 0; i < bucket->tot_segment; i++) {
+ int check_a = bucket->segments[i][0];
+ int check_b = bucket->segments[i][1];
+
+ float *v3 = (float *) feather_points[check_a];
+ float *v4 = (float *) feather_points[check_b];
+
+ if (check_a >= cur_a - 1 || cur_b == check_a)
+ continue;
+
+ if (isect_seg_seg_v2(v1, v2, v3, v4)) {
+ int k, len;
+ float p[2];
+
+ isect_seg_seg_v2_point(v1, v2, v3, v4, p);
+
+ /* TODO: for now simply choose the shortest loop, could be made smarter in some way */
+ len = cur_a - check_b;
+ if (len < tot_feather_point - len) {
+ for (k = check_b; k <= cur_a; k++) {
+ copy_v2_v2(feather_points[k], p);
+ }
+ }
+ else {
+ for (k = 0; k <= check_a; k++) {
+ copy_v2_v2(feather_points[k], p);
+ }
+
+ if (cur_b != 0) {
+ for (k = cur_b; k < tot_feather_point; k++) {
+ copy_v2_v2(feather_points[k], p);
+ }
+ }
+ }
+ }
+ }
+}
+
+static int feather_bucket_index_from_coord(float co[2], const float min[2], const float bucket_scale[2],
+ const int buckets_per_side)
+{
+ int x = (int) ((co[0] - min[0]) * bucket_scale[0]);
+ int y = (int) ((co[1] - min[1]) * bucket_scale[1]);
+
+ if (x == buckets_per_side)
+ x--;
+
+ if (y == buckets_per_side)
+ y--;
+
+ return y * buckets_per_side + x;
+}
+
+static void feather_bucket_get_diagonal(FeatherEdgesBucket *buckets, int start_bucket_index, int end_bucket_index,
+ int buckets_per_side, FeatherEdgesBucket **diagonal_bucket_a_r,
+ FeatherEdgesBucket **diagonal_bucket_b_r)
+{
+ int start_bucket_x = start_bucket_index % buckets_per_side;
+ int start_bucket_y = start_bucket_index / buckets_per_side;
+
+ int end_bucket_x = end_bucket_index % buckets_per_side;
+ int end_bucket_y = end_bucket_index / buckets_per_side;
+
+ int diagonal_bucket_a_index = start_bucket_y * buckets_per_side + end_bucket_x;
+ int diagonal_bucket_b_index = end_bucket_y * buckets_per_side + start_bucket_x;
+
+ *diagonal_bucket_a_r = &buckets[diagonal_bucket_a_index];
+ *diagonal_bucket_b_r = &buckets[diagonal_bucket_b_index];
+}
+
+static void spline_feather_collapse_inner_loops(MaskSpline *spline, float (*feather_points)[2], int tot_feather_point)
+{
+#define BUCKET_INDEX(co) \
+ feather_bucket_index_from_coord(co, min, bucket_scale, buckets_per_side)
+
+ int buckets_per_side, tot_bucket;
+ float bucket_size, bucket_scale[2];
+
+ FeatherEdgesBucket *buckets;
+
+ int i;
+ float min[2], max[2];
+ float max_delta_x = -1.0f, max_delta_y = -1.0f, max_delta;
+
+ if (tot_feather_point < 4) {
+ /* self-intersection works only for quads at least,
+ * in other cases polygon can't be self-intersecting anyway
+ */
+
+ return;
+ }
+
+ /* find min/max corners of mask to build buckets in that space */
+ INIT_MINMAX2(min, max);
+
+ for (i = 0; i < tot_feather_point; i++) {
+ int next = i + 1;
+ float delta;
+
+ DO_MINMAX2(feather_points[i], min, max);
+
+ if (next == tot_feather_point) {
+ if (spline->flag & MASK_SPLINE_CYCLIC)
+ next = 0;
+ else
+ break;
+ }
+
+ delta = fabsf(feather_points[i][0] - feather_points[next][0]);
+ if (delta > max_delta_x)
+ max_delta_x = delta;
+
+ delta = fabsf(feather_points[i][1] - feather_points[next][1]);
+ if (delta > max_delta_y)
+ max_delta_y = delta;
+ }
+
+ /* prevent divisionsby zero by ensuring bounding box is not collapsed */
+ if (max[0] - min[0] < FLT_EPSILON) {
+ max[0] += 0.01f;
+ min[0] -= 0.01f;
+ }
+
+ if (max[1] - min[1] < FLT_EPSILON) {
+ max[1] += 0.01f;
+ min[1] -= 0.01f;
+ }
+
+ /* use dynamically calculated buckets per side, so we likely wouldn't
+ * run into a situation when segment doesn't fit two buckets which is
+ * pain collecting candidates for intersection
+ */
+
+ max_delta_x /= max[0] - min[0];
+ max_delta_y /= max[1] - min[1];
+
+ max_delta = MAX2(max_delta_x, max_delta_y);
+
+ buckets_per_side = MIN2(512, 0.9f / max_delta);
+
+ if (buckets_per_side == 0) {
+ /* happens when some segment fills the whole bounding box across some of dimension */
+
+ buckets_per_side = 1;
+ }
+
+ tot_bucket = buckets_per_side * buckets_per_side;
+ bucket_size = 1.0f / buckets_per_side;
+
+ /* pre-compute multipliers, to save mathematical operations in loops */
+ bucket_scale[0] = 1.0f / ((max[0] - min[0]) * bucket_size);
+ bucket_scale[1] = 1.0f / ((max[1] - min[1]) * bucket_size);
+
+ /* fill in buckets' edges */
+ buckets = MEM_callocN(sizeof(FeatherEdgesBucket) * tot_bucket, "feather buckets");
+
+ for (i = 0; i < tot_feather_point; i++) {
+ int start = i, end = i + 1;
+ int start_bucket_index, end_bucket_index;
+
+ if (end == tot_feather_point) {
+ if (spline->flag & MASK_SPLINE_CYCLIC)
+ end = 0;
+ else
+ break;
+ }
+
+ start_bucket_index = BUCKET_INDEX(feather_points[start]);
+ end_bucket_index = BUCKET_INDEX(feather_points[end]);
+
+ feather_bucket_add_edge(&buckets[start_bucket_index], start, end);
+
+ if (start_bucket_index != end_bucket_index) {
+ FeatherEdgesBucket *end_bucket = &buckets[end_bucket_index];
+ FeatherEdgesBucket *diagonal_bucket_a, *diagonal_bucket_b;
+
+ feather_bucket_get_diagonal(buckets, start_bucket_index, end_bucket_index, buckets_per_side,
+ &diagonal_bucket_a, &diagonal_bucket_b);
+
+ feather_bucket_add_edge(end_bucket, start, end);
+ feather_bucket_add_edge(diagonal_bucket_a, start, end);
+ feather_bucket_add_edge(diagonal_bucket_a, start, end);
+ }
+ }
+ /* check all edges for intersection with edges from their buckets */
+ for (i = 0; i < tot_feather_point; i++) {
+ int cur_a = i, cur_b = i + 1;
+ int start_bucket_index, end_bucket_index;
+
+ FeatherEdgesBucket *start_bucket;
+
+ if (cur_b == tot_feather_point)
+ cur_b = 0;
+
+ start_bucket_index = BUCKET_INDEX(feather_points[cur_a]);
+ end_bucket_index = BUCKET_INDEX(feather_points[cur_b]);
+
+ start_bucket = &buckets[start_bucket_index];
+
+ feather_bucket_check_intersect(feather_points, tot_feather_point, start_bucket, cur_a, cur_b);
+
+ if (start_bucket_index != end_bucket_index) {
+ FeatherEdgesBucket *end_bucket = &buckets[end_bucket_index];
+ FeatherEdgesBucket *diagonal_bucket_a, *diagonal_bucket_b;
+
+ feather_bucket_get_diagonal(buckets, start_bucket_index, end_bucket_index, buckets_per_side,
+ &diagonal_bucket_a, &diagonal_bucket_b);
+
+ feather_bucket_check_intersect(feather_points, tot_feather_point, end_bucket, cur_a, cur_b);
+ feather_bucket_check_intersect(feather_points, tot_feather_point, diagonal_bucket_a, cur_a, cur_b);
+ feather_bucket_check_intersect(feather_points, tot_feather_point, diagonal_bucket_b, cur_a, cur_b);
+ }
+ }
+
+ /* free buckets */
+ for (i = 0; i < tot_bucket; i++) {
+ if (buckets[i].segments)
+ MEM_freeN(buckets[i].segments);
+ }
+
+ MEM_freeN(buckets);
+
+#undef BUCKET_INDEX
+}
+
+/**
+ * values align with #BKE_mask_spline_differentiate_with_resolution_ex
+ * when \a resol arguments match.
+ */
+float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpline *spline,
+ int *tot_feather_point,
+ const int resol,
+ const int do_collapse
+ ))[2]
+{
+ MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
+ MaskSplinePoint *point, *prev;
float (*feather)[2], (*fp)[2];
- int i, j, tot, resol = BKE_mask_spline_feather_resolution(spline, width, height);
- tot = resol * spline->tot_point;
- feather = fp = MEM_mallocN(tot * sizeof(*feather), "mask spline feather diff points");
+ const int tot = BKE_mask_spline_differentiate_calc_total(spline, resol);
+ int a;
- for (i = 0; i < spline->tot_point; i++) {
- MaskSplinePoint *point = &points_array[i];
+ /* tot+1 because of 'forward_diff_bezier' function */
+ feather = fp = MEM_mallocN((tot + 1) * sizeof(*feather), "mask spline feather diff points");
+
+ a = spline->tot_point - 1;
+ if (spline->flag & MASK_SPLINE_CYCLIC)
+ a++;
+
+ prev = points_array;
+ point = prev + 1;
+
+ while (a--) {
+ /* BezTriple *prevbezt; */ /* UNUSED */
+ /* BezTriple *bezt; */ /* UNUSED */
+ int j;
+
+ if (a == 0 && (spline->flag & MASK_SPLINE_CYCLIC))
+ point = points_array;
+
+
+ /* prevbezt = &prev->bezt; */
+ /* bezt = &point->bezt; */
for (j = 0; j < resol; j++, fp++) {
float u = (float) j / resol, weight;
@@ -403,19 +713,46 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline
/* TODO - these calls all calculate similar things
* could be unified for some speed */
- BKE_mask_point_segment_co(spline, point, u, co);
- BKE_mask_point_normal(spline, point, u, n);
- weight = BKE_mask_point_weight(spline, point, u);
+ BKE_mask_point_segment_co(spline, prev, u, co);
+ BKE_mask_point_normal(spline, prev, u, n);
+ weight = BKE_mask_point_weight(spline, prev, u);
+
+ madd_v2_v2v2fl(*fp, co, n, weight);
+ }
+
+ if (a == 0 && (spline->flag & MASK_SPLINE_CYCLIC) == 0) {
+ float u = 1.0f, weight;
+ float co[2], n[2];
+
+ BKE_mask_point_segment_co(spline, prev, u, co);
+ BKE_mask_point_normal(spline, prev, u, n);
+ weight = BKE_mask_point_weight(spline, prev, u);
madd_v2_v2v2fl(*fp, co, n, weight);
}
+
+ prev = point;
+ point++;
}
*tot_feather_point = tot;
+ /* this is slow! - don't do on draw */
+ if (do_collapse) {
+ spline_feather_collapse_inner_loops(spline, feather, tot);
+ }
+
return feather;
}
+float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, int width, int height,
+ int *tot_feather_point))[2]
+{
+ int resol = BKE_mask_spline_feather_resolution(spline, width, height);
+
+ return BKE_mask_spline_feather_differentiated_points_with_resolution_ex(spline, tot_feather_point, resol, FALSE);
+}
+
float (*BKE_mask_spline_feather_differentiated_points(MaskSpline *spline, int *tot_feather_point))[2]
{
return BKE_mask_spline_feather_differentiated_points_with_resolution(spline, 0, 0, tot_feather_point);
@@ -2219,7 +2556,7 @@ void BKE_mask_rasterize_layers(ListBase *masklayers, int width, int height, floa
if (tot_diff_point) {
PLX_raskterize(diff_points, tot_diff_point,
- buffer_tmp, width, height, do_mask_aa);
+ buffer_tmp, width, height,do_mask_aa);
if (tot_diff_feather_points) {
PLX_raskterize_feather(diff_points, tot_diff_point,
@@ -2273,13 +2610,87 @@ void BKE_mask_rasterize_layers(ListBase *masklayers, int width, int height, floa
}
}
+ if (do_mask_aa) {
+ //PLX_antialias_buffer(buffer,width,height);
+ }
/* clamp at the end */
clamp_vn_vn(buffer, buffer_size);
}
-
MEM_freeN(buffer_tmp);
}
+#ifdef __PLX_RASKTER_MT__
+void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int width, int height, const short do_aspect_correct)
+{
+ MaskLayer *masklay;
+ int numLayers=0;
+ int currLayer=0;
+ for (masklay = mask->masklayers->first; masklay; masklay = masklay->next) {
+ numLayers++;
+ }
+ mlayer_data = MEM_mallocN(sizeof(struct layer_init_data) * numLayers, __func__); //size correct?
+
+
+ for (masklay = mask->masklayers->first; masklay; masklay = masklay->next) {
+ MaskSpline *spline;
+ for (spline = masklay->splines.first; spline; spline = spline->next) {
+ float (*diff_points)[2];
+ int tot_diff_point;
+
+ float (*diff_feather_points)[2];
+ int tot_diff_feather_points;
+
+ diff_points = BKE_mask_spline_differentiate_with_resolution(spline, width, height,
+ &tot_diff_point);
+
+ if (tot_diff_point) {
+ if (do_feather) {
+ diff_feather_points =
+ BKE_mask_spline_feather_differentiated_points_with_resolution(spline, width, height,
+ &tot_diff_feather_points);
+ }
+ else {
+ tot_diff_feather_points = 0;
+ diff_feather_points = NULL;
+ }
+
+ if (do_aspect_correct) {
+ if (width != height) {
+ float *fp;
+ float *ffp;
+ int i;
+ float asp;
+
+ if (width < height) {
+ fp = &diff_points[0][0];
+ ffp = tot_diff_feather_points ? &diff_feather_points[0][0] : NULL;
+ asp = (float)width / (float)height;
+ }
+ else {
+ fp = &diff_points[0][1];
+ ffp = tot_diff_feather_points ? &diff_feather_points[0][1] : NULL;
+ asp = (float)height / (float)width;
+ }
+
+ for (i = 0; i < tot_diff_point; i++, fp += 2) {
+ (*fp) = (((*fp) - 0.5f) / asp) + 0.5f;
+ }
+
+ if (tot_diff_feather_points) {
+ for (i = 0; i < tot_diff_feather_points; i++, ffp += 2) {
+ (*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f;
+ }
+ }
+ }
+ }
+ PLX_init_base_data(mlayer_data[currLayer], diff_points, tot_diff_points, width, height);
+ currLayer++;
+ }
+ }
+ }
+}
+#endif
+
void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
const short do_aspect_correct, const short do_mask_aa,
const short do_feather)
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
new file mode 100644
index 00000000000..b05c1ad4eaa
--- /dev/null
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -0,0 +1,1289 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation,
+ * Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/mask_rasterize.c
+ * \ingroup bke
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_vec_types.h"
+#include "DNA_mask_types.h"
+#include "DNA_scene_types.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_scanfill.h"
+#include "BLI_memarena.h"
+
+#include "BLI_math.h"
+#include "BLI_rect.h"
+#include "BLI_listbase.h"
+#include "BLI_linklist.h"
+
+#include "BKE_mask.h"
+
+#ifndef USE_RASKTER
+
+/* this is rather and annoying hack, use define to isolate it.
+ * problem is caused by scanfill removing edges on us. */
+#define USE_SCANFILL_EDGE_WORKAROUND
+
+#define SPLINE_RESOL_CAP_PER_PIXEL 2
+#define SPLINE_RESOL_CAP_MIN 8
+#define SPLINE_RESOL_CAP_MAX 64
+
+/* found this gives best performance for high detail masks, values between 2 and 8 work best */
+#define BUCKET_PIXELS_PER_CELL 4
+
+#define SF_EDGE_IS_BOUNDARY 0xff
+#define SF_KEYINDEX_TEMP_ID ((unsigned int) -1)
+
+#define TRI_TERMINATOR_ID ((unsigned int) -1)
+#define TRI_VERT ((unsigned int) -1)
+
+/* for debugging add... */
+#ifndef NDEBUG
+/* printf("%u %u %u %u\n", _t[0], _t[1], _t[2], _t[3]); \ */
+# define FACE_ASSERT(face, vert_max) \
+{ \
+ unsigned int *_t = face; \
+ BLI_assert(_t[0] < vert_max); \
+ BLI_assert(_t[1] < vert_max); \
+ BLI_assert(_t[2] < vert_max); \
+ BLI_assert(_t[3] < vert_max || _t[3] == TRI_VERT); \
+} (void)0
+#else
+ /* do nothing */
+# define FACE_ASSERT(face, vert_max)
+#endif
+
+static void rotate_point_v2(float r_p[2], const float p[2], const float cent[2], const float angle, const float asp[2])
+{
+ const float s = sinf(angle);
+ const float c = cosf(angle);
+ float p_new[2];
+
+ /* translate point back to origin */
+ r_p[0] = (p[0] - cent[0]) / asp[0];
+ r_p[1] = (p[1] - cent[1]) / asp[1];
+
+ /* rotate point */
+ p_new[0] = ((r_p[0] * c) - (r_p[1] * s)) * asp[0];
+ p_new[1] = ((r_p[0] * s) + (r_p[1] * c)) * asp[1];
+
+ /* translate point back */
+ r_p[0] = p_new[0] + cent[0];
+ r_p[1] = p_new[1] + cent[1];
+}
+
+BLI_INLINE unsigned int clampis_uint(const unsigned int v, const unsigned int min, const unsigned int max)
+{
+ return v < min ? min : (v > max ? max : v);
+}
+
+/* --------------------------------------------------------------------- */
+/* local structs for mask rasterizeing */
+/* --------------------------------------------------------------------- */
+
+/**
+ * A single #MaskRasterHandle contains multiple #MaskRasterLayer's,
+ * each #MaskRasterLayer does its own lookup which contributes to
+ * the final pixel with its own blending mode and the final pixel
+ * is blended between these.
+ */
+
+/* internal use only */
+typedef struct MaskRasterLayer {
+ /* geometry */
+ unsigned int face_tot;
+ unsigned int (*face_array)[4]; /* access coords tri/quad */
+ float (*face_coords)[3]; /* xy, z 0-1 (1.0 == filled) */
+
+
+ /* 2d bounds (to quickly skip bucket lookup) */
+ rctf bounds;
+
+
+ /* buckets */
+ unsigned int **buckets_face;
+ /* cache divide and subtract */
+ float buckets_xy_scalar[2]; /* (1.0 / (buckets_width + FLT_EPSILON)) * buckets_x */
+ unsigned int buckets_x;
+ unsigned int buckets_y;
+
+
+ /* copied direct from #MaskLayer.--- */
+ /* blending options */
+ float alpha;
+ char blend;
+ char blend_flag;
+ char falloff;
+
+} MaskRasterLayer;
+
+typedef struct MaskRasterSplineInfo {
+ /* body of the spline */
+ unsigned int vertex_offset;
+ unsigned int vertex_total;
+
+ /* capping for non-filled, non cyclic splines */
+ unsigned int vertex_total_cap_head;
+ unsigned int vertex_total_cap_tail;
+
+ unsigned int is_cyclic;
+} MaskRasterSplineInfo;
+
+/**
+ * opaque local struct for mask pixel lookup, each MaskLayer needs one of these
+ */
+struct MaskRasterHandle {
+ MaskRasterLayer *layers;
+ unsigned int layers_tot;
+
+ /* 2d bounds (to quickly skip bucket lookup) */
+ rctf bounds;
+};
+
+/* --------------------------------------------------------------------- */
+/* alloc / free functions */
+/* --------------------------------------------------------------------- */
+
+MaskRasterHandle *BKE_maskrasterize_handle_new(void)
+{
+ MaskRasterHandle *mr_handle;
+
+ mr_handle = MEM_callocN(sizeof(MaskRasterHandle), STRINGIFY(MaskRasterHandle));
+
+ return mr_handle;
+}
+
+void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
+{
+ const unsigned int layers_tot = mr_handle->layers_tot;
+ unsigned int i;
+ MaskRasterLayer *layer = mr_handle->layers;
+
+ for (i = 0; i < layers_tot; i++, layer++) {
+
+ if (layer->face_array) {
+ MEM_freeN(layer->face_array);
+ }
+
+ if (layer->face_coords) {
+ MEM_freeN(layer->face_coords);
+ }
+
+ if (layer->buckets_face) {
+ const unsigned int bucket_tot = layer->buckets_x * layer->buckets_y;
+ unsigned int bucket_index;
+ for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) {
+ unsigned int *face_index = layer->buckets_face[bucket_index];
+ if (face_index) {
+ MEM_freeN(face_index);
+ }
+ }
+
+ MEM_freeN(layer->buckets_face);
+ }
+ }
+
+ MEM_freeN(mr_handle->layers);
+ MEM_freeN(mr_handle);
+}
+
+
+void maskrasterize_spline_differentiate_point_outset(float (*diff_feather_points)[2], float (*diff_points)[2],
+ const unsigned int tot_diff_point, const float ofs,
+ const short do_test)
+{
+ unsigned int k_prev = tot_diff_point - 2;
+ unsigned int k_curr = tot_diff_point - 1;
+ unsigned int k_next = 0;
+
+ unsigned int k;
+
+ float d_prev[2];
+ float d_next[2];
+ float d[2];
+
+ const float *co_prev;
+ const float *co_curr;
+ const float *co_next;
+
+ const float ofs_squared = ofs * ofs;
+
+ co_prev = diff_points[k_prev];
+ co_curr = diff_points[k_curr];
+ co_next = diff_points[k_next];
+
+ /* precalc */
+ sub_v2_v2v2(d_prev, co_prev, co_curr);
+ normalize_v2(d_prev);
+
+ for (k = 0; k < tot_diff_point; k++) {
+
+ /* co_prev = diff_points[k_prev]; */ /* precalc */
+ co_curr = diff_points[k_curr];
+ co_next = diff_points[k_next];
+
+ /* sub_v2_v2v2(d_prev, co_prev, co_curr); */ /* precalc */
+ sub_v2_v2v2(d_next, co_curr, co_next);
+
+ /* normalize_v2(d_prev); */ /* precalc */
+ normalize_v2(d_next);
+
+ if ((do_test == FALSE) ||
+ (len_squared_v2v2(diff_feather_points[k], diff_points[k]) < ofs_squared))
+ {
+
+ add_v2_v2v2(d, d_prev, d_next);
+
+ normalize_v2(d);
+
+ diff_feather_points[k][0] = diff_points[k][0] + ( d[1] * ofs);
+ diff_feather_points[k][1] = diff_points[k][1] + (-d[0] * ofs);
+ }
+
+ /* use next iter */
+ copy_v2_v2(d_prev, d_next);
+
+ /* k_prev = k_curr; */ /* precalc */
+ k_curr = k_next;
+ k_next++;
+ }
+}
+
+/* this function is not exact, sometimes it returns false positives,
+ * the main point of it is to clear out _almost_ all bucket/face non-intersections,
+ * returning TRUE in corner cases is ok but missing an intersection is NOT.
+ *
+ * method used
+ * - check if the center of the buckets bounding box is intersecting the face
+ * - if not get the max radius to a corner of the bucket and see how close we
+ * are to any of the triangle edges.
+ */
+static int layer_bucket_isect_test(MaskRasterLayer *layer, unsigned int face_index,
+ const unsigned int bucket_x, const unsigned int bucket_y,
+ const float bucket_size_x, const float bucket_size_y,
+ const float bucket_max_rad_squared)
+{
+ unsigned int *face = layer->face_array[face_index];
+ float (*cos)[3] = layer->face_coords;
+
+ const float xmin = layer->bounds.xmin + (bucket_size_x * bucket_x);
+ const float ymin = layer->bounds.ymin + (bucket_size_y * bucket_y);
+ const float xmax = xmin + bucket_size_x;
+ const float ymax = ymin + bucket_size_y;
+
+ const float cent[2] = {(xmin + xmax) * 0.5f,
+ (ymin + ymax) * 0.5f};
+
+ if (face[3] == TRI_VERT) {
+ const float *v1 = cos[face[0]];
+ const float *v2 = cos[face[1]];
+ const float *v3 = cos[face[2]];
+
+ if (isect_point_tri_v2(cent, v1, v2, v3)) {
+ return TRUE;
+ }
+ else {
+ if ((dist_squared_to_line_segment_v2(cent, v1, v2) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v2, v3) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v3, v1) < bucket_max_rad_squared))
+ {
+ return TRUE;
+ }
+ else {
+ // printf("skip tri\n");
+ return FALSE;
+ }
+ }
+
+ }
+ else {
+ const float *v1 = cos[face[0]];
+ const float *v2 = cos[face[1]];
+ const float *v3 = cos[face[2]];
+ const float *v4 = cos[face[3]];
+
+ if (isect_point_tri_v2(cent, v1, v2, v3)) {
+ return TRUE;
+ }
+ else if (isect_point_tri_v2(cent, v1, v3, v4)) {
+ return TRUE;
+ }
+ else {
+ if ((dist_squared_to_line_segment_v2(cent, v1, v2) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v2, v3) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v3, v4) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v4, v1) < bucket_max_rad_squared))
+ {
+ return TRUE;
+ }
+ else {
+ // printf("skip quad\n");
+ return FALSE;
+ }
+ }
+ }
+}
+
+static void layer_bucket_init_dummy(MaskRasterLayer *layer)
+{
+ layer->face_tot = 0;
+ layer->face_coords = NULL;
+ layer->face_array = NULL;
+
+ layer->buckets_x = 0;
+ layer->buckets_y = 0;
+
+ layer->buckets_xy_scalar[0] = 0.0f;
+ layer->buckets_xy_scalar[1] = 0.0f;
+
+ layer->buckets_face = NULL;
+
+ BLI_rctf_init(&layer->bounds, -1.0f, -1.0f, -1.0f, -1.0f);
+}
+
+static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
+{
+ MemArena *arena = BLI_memarena_new(1 << 16, __func__);
+
+ const float bucket_dim_x = layer->bounds.xmax - layer->bounds.xmin;
+ const float bucket_dim_y = layer->bounds.ymax - layer->bounds.ymin;
+
+ layer->buckets_x = (bucket_dim_x / pixel_size) / (float)BUCKET_PIXELS_PER_CELL;
+ layer->buckets_y = (bucket_dim_y / pixel_size) / (float)BUCKET_PIXELS_PER_CELL;
+
+// printf("bucket size %ux%u\n", layer->buckets_x, layer->buckets_y);
+
+ CLAMP(layer->buckets_x, 8, 512);
+ CLAMP(layer->buckets_y, 8, 512);
+
+ layer->buckets_xy_scalar[0] = (1.0f / (bucket_dim_x + FLT_EPSILON)) * layer->buckets_x;
+ layer->buckets_xy_scalar[1] = (1.0f / (bucket_dim_y + FLT_EPSILON)) * layer->buckets_y;
+
+ {
+ /* width and height of each bucket */
+ const float bucket_size_x = (bucket_dim_x + FLT_EPSILON) / layer->buckets_x;
+ const float bucket_size_y = (bucket_dim_y + FLT_EPSILON) / layer->buckets_y;
+ const float bucket_max_rad = (maxf(bucket_size_x, bucket_size_y) * M_SQRT2) + FLT_EPSILON;
+ const float bucket_max_rad_squared = bucket_max_rad * bucket_max_rad;
+
+ unsigned int *face = &layer->face_array[0][0];
+ float (*cos)[3] = layer->face_coords;
+
+ const unsigned int bucket_tot = layer->buckets_x * layer->buckets_y;
+ LinkNode **bucketstore = MEM_callocN(bucket_tot * sizeof(LinkNode *), __func__);
+ unsigned int *bucketstore_tot = MEM_callocN(bucket_tot * sizeof(unsigned int), __func__);
+
+ unsigned int face_index;
+
+ for (face_index = 0; face_index < layer->face_tot; face_index++, face += 4) {
+ float xmin;
+ float xmax;
+ float ymin;
+ float ymax;
+
+ if (face[3] == TRI_VERT) {
+ const float *v1 = cos[face[0]];
+ const float *v2 = cos[face[1]];
+ const float *v3 = cos[face[2]];
+
+ xmin = minf(v1[0], minf(v2[0], v3[0]));
+ xmax = maxf(v1[0], maxf(v2[0], v3[0]));
+ ymin = minf(v1[1], minf(v2[1], v3[1]));
+ ymax = maxf(v1[1], maxf(v2[1], v3[1]));
+ }
+ else {
+ const float *v1 = cos[face[0]];
+ const float *v2 = cos[face[1]];
+ const float *v3 = cos[face[2]];
+ const float *v4 = cos[face[3]];
+
+ xmin = minf(v1[0], minf(v2[0], minf(v3[0], v4[0])));
+ xmax = maxf(v1[0], maxf(v2[0], maxf(v3[0], v4[0])));
+ ymin = minf(v1[1], minf(v2[1], minf(v3[1], v4[1])));
+ ymax = maxf(v1[1], maxf(v2[1], maxf(v3[1], v4[1])));
+ }
+
+
+ /* not essential but may as will skip any faces outside the view */
+ if (!((xmax < 0.0f) || (ymax < 0.0f) || (xmin > 1.0f) || (ymin > 1.0f))) {
+
+ CLAMP(xmin, 0.0f, 1.0f);
+ CLAMP(ymin, 0.0f, 1.0f);
+ CLAMP(xmax, 0.0f, 1.0f);
+ CLAMP(ymax, 0.0f, 1.0f);
+
+ {
+ unsigned int xi_min = (unsigned int) ((xmin - layer->bounds.xmin) * layer->buckets_xy_scalar[0]);
+ unsigned int xi_max = (unsigned int) ((xmax - layer->bounds.xmin) * layer->buckets_xy_scalar[0]);
+ unsigned int yi_min = (unsigned int) ((ymin - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
+ unsigned int yi_max = (unsigned int) ((ymax - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
+ void *face_index_void = SET_UINT_IN_POINTER(face_index);
+
+ unsigned int xi, yi;
+
+ /* this should _almost_ never happen but since it can in extreme cases,
+ * we have to clamp the values or we overrun the buffer and crash */
+ CLAMP(xi_min, 0, layer->buckets_x - 1);
+ CLAMP(xi_max, 0, layer->buckets_x - 1);
+ CLAMP(yi_min, 0, layer->buckets_y - 1);
+ CLAMP(yi_max, 0, layer->buckets_y - 1);
+
+ for (yi = yi_min; yi <= yi_max; yi++) {
+ unsigned int bucket_index = (layer->buckets_x * yi) + xi_min;
+ for (xi = xi_min; xi <= xi_max; xi++, bucket_index++) {
+ // unsigned int bucket_index = (layer->buckets_x * yi) + xi; /* correct but do in outer loop */
+
+ BLI_assert(xi < layer->buckets_x);
+ BLI_assert(yi < layer->buckets_y);
+ BLI_assert(bucket_index < bucket_tot);
+
+ /* check if the bucket intersects with the face */
+ /* note: there is a tradeoff here since checking box/tri intersections isn't
+ * as optimal as it could be, but checking pixels against faces they will never intersect
+ * with is likely the greater slowdown here - so check if the cell intersects the face */
+ if (layer_bucket_isect_test(layer, face_index,
+ xi, yi,
+ bucket_size_x, bucket_size_y,
+ bucket_max_rad_squared))
+ {
+ BLI_linklist_prepend_arena(&bucketstore[bucket_index], face_index_void, arena);
+ bucketstore_tot[bucket_index]++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (1) {
+ /* now convert linknodes into arrays for faster per pixel access */
+ unsigned int **buckets_face = MEM_mallocN(bucket_tot * sizeof(unsigned int **), __func__);
+ unsigned int bucket_index;
+
+ for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) {
+ if (bucketstore_tot[bucket_index]) {
+ unsigned int *bucket = MEM_mallocN((bucketstore_tot[bucket_index] + 1) * sizeof(unsigned int),
+ __func__);
+ LinkNode *bucket_node;
+
+ buckets_face[bucket_index] = bucket;
+
+ for (bucket_node = bucketstore[bucket_index]; bucket_node; bucket_node = bucket_node->next) {
+ *bucket = GET_UINT_FROM_POINTER(bucket_node->link);
+ bucket++;
+ }
+ *bucket = TRI_TERMINATOR_ID;
+ }
+ else {
+ buckets_face[bucket_index] = NULL;
+ }
+ }
+
+ layer->buckets_face = buckets_face;
+ }
+
+ MEM_freeN(bucketstore);
+ MEM_freeN(bucketstore_tot);
+ }
+
+ BLI_memarena_free(arena);
+}
+
+void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask,
+ const int width, const int height,
+ const short do_aspect_correct, const short do_mask_aa,
+ const short do_feather)
+{
+ const rctf default_bounds = {0.0f, 1.0f, 0.0f, 1.0f};
+ const float pixel_size = 1.0f / MIN2(width, height);
+ const float asp_xy[2] = {(do_aspect_correct && width > height) ? (float)height / (float)width : 1.0f,
+ (do_aspect_correct && width < height) ? (float)width / (float)height : 1.0f};
+
+ const float zvec[3] = {0.0f, 0.0f, 1.0f};
+ MaskLayer *masklay;
+ unsigned int masklay_index;
+
+ mr_handle->layers_tot = BLI_countlist(&mask->masklayers);
+ mr_handle->layers = MEM_mallocN(sizeof(MaskRasterLayer) * mr_handle->layers_tot, STRINGIFY(MaskRasterLayer));
+ BLI_rctf_init_minmax(&mr_handle->bounds);
+
+ for (masklay = mask->masklayers.first, masklay_index = 0; masklay; masklay = masklay->next, masklay_index++) {
+
+ /* we need to store vertex ranges for open splines for filling */
+ unsigned int tot_splines;
+ MaskRasterSplineInfo *open_spline_ranges;
+ unsigned int open_spline_index = 0;
+
+ MaskSpline *spline;
+
+ /* scanfill */
+ ScanFillContext sf_ctx;
+ ScanFillVert *sf_vert = NULL;
+ ScanFillVert *sf_vert_next = NULL;
+ ScanFillFace *sf_tri;
+
+ unsigned int sf_vert_tot = 0;
+ unsigned int tot_feather_quads = 0;
+
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+ unsigned int tot_boundary_used = 0;
+ unsigned int tot_boundary_found = 0;
+#endif
+
+ if (masklay->restrictflag & MASK_RESTRICT_RENDER) {
+ /* skip the layer */
+ mr_handle->layers_tot--;
+ masklay_index--;
+ continue;
+ }
+
+ tot_splines = BLI_countlist(&masklay->splines);
+ open_spline_ranges = MEM_callocN(sizeof(*open_spline_ranges) * tot_splines, __func__);
+
+ BLI_scanfill_begin(&sf_ctx);
+
+ for (spline = masklay->splines.first; spline; spline = spline->next) {
+ const unsigned int is_cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0;
+ const unsigned int is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0;
+
+ float (*diff_points)[2];
+ int tot_diff_point;
+
+ float (*diff_feather_points)[2];
+ int tot_diff_feather_points;
+
+ const int resol_a = BKE_mask_spline_resolution(spline, width, height) / 4;
+ const int resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4;
+ const int resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512);
+
+ diff_points = BKE_mask_spline_differentiate_with_resolution_ex(
+ spline, &tot_diff_point, resol);
+
+ if (do_feather) {
+ diff_feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution_ex(
+ spline, &tot_diff_feather_points, resol, TRUE);
+ BLI_assert(diff_feather_points);
+ }
+ else {
+ tot_diff_feather_points = 0;
+ diff_feather_points = NULL;
+ }
+
+ if (tot_diff_point > 3) {
+ ScanFillVert *sf_vert_prev;
+ int j;
+
+ float co[3];
+ co[2] = 0.0f;
+
+ if (do_aspect_correct) {
+ if (width != height) {
+ float *fp;
+ float *ffp;
+ int i;
+ float asp;
+
+ if (width < height) {
+ fp = &diff_points[0][0];
+ ffp = tot_diff_feather_points ? &diff_feather_points[0][0] : NULL;
+ asp = (float)width / (float)height;
+ }
+ else {
+ fp = &diff_points[0][1];
+ ffp = tot_diff_feather_points ? &diff_feather_points[0][1] : NULL;
+ asp = (float)height / (float)width;
+ }
+
+ for (i = 0; i < tot_diff_point; i++, fp += 2) {
+ (*fp) = (((*fp) - 0.5f) / asp) + 0.5f;
+ }
+
+ if (tot_diff_feather_points) {
+ for (i = 0; i < tot_diff_feather_points; i++, ffp += 2) {
+ (*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f;
+ }
+ }
+ }
+ }
+
+ /* fake aa, using small feather */
+ if (do_mask_aa == TRUE) {
+ if (do_feather == FALSE) {
+ tot_diff_feather_points = tot_diff_point;
+ diff_feather_points = MEM_mallocN(sizeof(*diff_feather_points) * tot_diff_feather_points,
+ __func__);
+ /* add single pixel feather */
+ maskrasterize_spline_differentiate_point_outset(diff_feather_points, diff_points,
+ tot_diff_point, pixel_size, FALSE);
+ }
+ else {
+ /* ensure single pixel feather, on any zero feather areas */
+ maskrasterize_spline_differentiate_point_outset(diff_feather_points, diff_points,
+ tot_diff_point, pixel_size, TRUE);
+ }
+ }
+
+ if (is_fill) {
+ copy_v2_v2(co, diff_points[0]);
+ sf_vert_prev = BLI_scanfill_vert_add(&sf_ctx, co);
+ sf_vert_prev->tmp.u = sf_vert_tot;
+ sf_vert_prev->keyindex = sf_vert_tot + tot_diff_point; /* absolute index of feather vert */
+ sf_vert_tot++;
+
+ /* TODO, an alternate functions so we can avoid double vector copy! */
+ for (j = 1; j < tot_diff_point; j++) {
+ copy_v2_v2(co, diff_points[j]);
+ sf_vert = BLI_scanfill_vert_add(&sf_ctx, co);
+ sf_vert->tmp.u = sf_vert_tot;
+ sf_vert->keyindex = sf_vert_tot + tot_diff_point; /* absolute index of feather vert */
+ sf_vert_tot++;
+ }
+
+ sf_vert = sf_vert_prev;
+ sf_vert_prev = sf_ctx.fillvertbase.last;
+
+ for (j = 0; j < tot_diff_point; j++) {
+ ScanFillEdge *sf_edge = BLI_scanfill_edge_add(&sf_ctx, sf_vert_prev, sf_vert);
+
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+ if (diff_feather_points) {
+ sf_edge->tmp.c = SF_EDGE_IS_BOUNDARY;
+ tot_boundary_used++;
+ }
+#else
+ (void)sf_edge;
+#endif
+ sf_vert_prev = sf_vert;
+ sf_vert = sf_vert->next;
+ }
+
+ if (diff_feather_points) {
+ float co_feather[3];
+ co_feather[2] = 1.0f;
+
+ BLI_assert(tot_diff_feather_points == tot_diff_point);
+
+ /* note: only added for convenience, we don't infact use these to scanfill,
+ * only to create feather faces after scanfill */
+ for (j = 0; j < tot_diff_feather_points; j++) {
+ copy_v2_v2(co_feather, diff_feather_points[j]);
+ sf_vert = BLI_scanfill_vert_add(&sf_ctx, co_feather);
+
+ /* no need for these attrs */
+ #if 0
+ sf_vert->tmp.u = sf_vert_tot;
+ sf_vert->keyindex = sf_vert_tot + tot_diff_point; /* absolute index of feather vert */
+ #endif
+ sf_vert->keyindex = SF_KEYINDEX_TEMP_ID;
+ sf_vert_tot++;
+ }
+
+ tot_feather_quads += tot_diff_point;
+ }
+ }
+ else {
+ /* unfilled spline */
+ if (diff_feather_points) {
+
+ float co_diff[3];
+
+ float co_feather[3];
+ co_feather[2] = 1.0f;
+
+ open_spline_ranges[open_spline_index].vertex_offset = sf_vert_tot;
+ open_spline_ranges[open_spline_index].vertex_total = tot_diff_point;
+
+ /* TODO, an alternate functions so we can avoid double vector copy! */
+ for (j = 0; j < tot_diff_point; j++) {
+
+ /* center vert */
+ copy_v2_v2(co, diff_points[j]);
+ sf_vert = BLI_scanfill_vert_add(&sf_ctx, co);
+ sf_vert->tmp.u = sf_vert_tot;
+ sf_vert->keyindex = SF_KEYINDEX_TEMP_ID;
+ sf_vert_tot++;
+
+
+ /* feather vert A */
+ copy_v2_v2(co_feather, diff_feather_points[j]);
+ sf_vert = BLI_scanfill_vert_add(&sf_ctx, co_feather);
+ sf_vert->tmp.u = sf_vert_tot;
+ sf_vert->keyindex = SF_KEYINDEX_TEMP_ID;
+ sf_vert_tot++;
+
+
+ /* feather vert B */
+ sub_v2_v2v2(co_diff, co, co_feather);
+ add_v2_v2v2(co_feather, co, co_diff);
+ sf_vert = BLI_scanfill_vert_add(&sf_ctx, co_feather);
+ sf_vert->tmp.u = sf_vert_tot;
+ sf_vert->keyindex = SF_KEYINDEX_TEMP_ID;
+ sf_vert_tot++;
+
+ tot_feather_quads += 2;
+ }
+
+ if (!is_cyclic) {
+ tot_feather_quads -= 2;
+ }
+
+ /* cap ends */
+
+ /* dummy init value */
+ open_spline_ranges[open_spline_index].vertex_total_cap_head = 0;
+ open_spline_ranges[open_spline_index].vertex_total_cap_tail = 0;
+
+ if (!is_cyclic) {
+ float *fp_cent;
+ float *fp_turn;
+
+ unsigned int k;
+
+ fp_cent = diff_points[0];
+ fp_turn = diff_feather_points[0];
+
+#define CALC_CAP_RESOL \
+ clampis_uint((len_v2v2(fp_cent, fp_turn) / (pixel_size * SPLINE_RESOL_CAP_PER_PIXEL)), \
+ SPLINE_RESOL_CAP_MIN, \
+ SPLINE_RESOL_CAP_MAX)
+
+ {
+ const unsigned int vertex_total_cap = CALC_CAP_RESOL;
+
+ for (k = 1; k < vertex_total_cap; k++) {
+ const float angle = (float)k * (1.0f / vertex_total_cap) * (float)M_PI;
+ rotate_point_v2(co_feather, fp_turn, fp_cent, angle, asp_xy);
+
+ sf_vert = BLI_scanfill_vert_add(&sf_ctx, co_feather);
+ sf_vert->tmp.u = sf_vert_tot;
+ sf_vert->keyindex = SF_KEYINDEX_TEMP_ID;
+ sf_vert_tot++;
+ }
+ tot_feather_quads += vertex_total_cap;
+
+ open_spline_ranges[open_spline_index].vertex_total_cap_head = vertex_total_cap;
+ }
+
+ fp_cent = diff_points[tot_diff_point - 1];
+ fp_turn = diff_feather_points[tot_diff_point - 1];
+
+ {
+ const unsigned int vertex_total_cap = CALC_CAP_RESOL;
+
+ for (k = 1; k < vertex_total_cap; k++) {
+ const float angle = (float)k * (1.0f / vertex_total_cap) * (float)M_PI;
+ rotate_point_v2(co_feather, fp_turn, fp_cent, -angle, asp_xy);
+
+ sf_vert = BLI_scanfill_vert_add(&sf_ctx, co_feather);
+ sf_vert->tmp.u = sf_vert_tot;
+ sf_vert->keyindex = SF_KEYINDEX_TEMP_ID;
+ sf_vert_tot++;
+ }
+ tot_feather_quads += vertex_total_cap;
+
+ open_spline_ranges[open_spline_index].vertex_total_cap_tail = vertex_total_cap;
+ }
+ }
+
+ open_spline_ranges[open_spline_index].is_cyclic = is_cyclic;
+ open_spline_index++;
+
+#undef CALC_CAP_RESOL
+ /* end capping */
+
+ }
+ }
+ }
+
+ if (diff_points) {
+ MEM_freeN(diff_points);
+ }
+
+ if (diff_feather_points) {
+ MEM_freeN(diff_feather_points);
+ }
+ }
+
+ {
+ unsigned int (*face_array)[4], *face; /* access coords */
+ float (*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */
+ int sf_tri_tot;
+ rctf bounds;
+ int face_index;
+
+ /* now we have all the splines */
+ face_coords = MEM_mallocN((sizeof(float) * 3) * sf_vert_tot, "maskrast_face_coords");
+
+ /* init bounds */
+ BLI_rctf_init_minmax(&bounds);
+
+ /* coords */
+ cos = (float *)face_coords;
+ for (sf_vert = sf_ctx.fillvertbase.first; sf_vert; sf_vert = sf_vert_next) {
+ sf_vert_next = sf_vert->next;
+ copy_v3_v3(cos, sf_vert->co);
+
+ /* remove so as not to interfere with fill (called after) */
+ if (sf_vert->keyindex == SF_KEYINDEX_TEMP_ID) {
+ BLI_remlink(&sf_ctx.fillvertbase, sf_vert);
+ }
+
+ /* bounds */
+ BLI_rctf_do_minmax_v(&bounds, cos);
+
+ cos += 3;
+ }
+
+ /* main scan-fill */
+ sf_tri_tot = BLI_scanfill_calc_ex(&sf_ctx, FALSE, zvec);
+
+ face_array = MEM_mallocN(sizeof(*face_array) * (sf_tri_tot + tot_feather_quads), "maskrast_face_index");
+ face_index = 0;
+
+ /* faces */
+ face = (unsigned int *)face_array;
+ for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
+ *(face++) = sf_tri->v3->tmp.u;
+ *(face++) = sf_tri->v2->tmp.u;
+ *(face++) = sf_tri->v1->tmp.u;
+ *(face++) = TRI_VERT;
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+ }
+
+ /* start of feather faces... if we have this set,
+ * 'face_index' is kept from loop above */
+
+ BLI_assert(face_index == sf_tri_tot);
+
+ if (tot_feather_quads) {
+ ScanFillEdge *sf_edge;
+
+ for (sf_edge = sf_ctx.filledgebase.first; sf_edge; sf_edge = sf_edge->next) {
+ if (sf_edge->tmp.c == SF_EDGE_IS_BOUNDARY) {
+ *(face++) = sf_edge->v1->tmp.u;
+ *(face++) = sf_edge->v2->tmp.u;
+ *(face++) = sf_edge->v2->keyindex;
+ *(face++) = sf_edge->v1->keyindex;
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+ tot_boundary_found++;
+#endif
+ }
+ }
+ }
+
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+ if (tot_boundary_found != tot_boundary_used) {
+ BLI_assert(tot_boundary_found < tot_boundary_used);
+ }
+#endif
+
+ /* feather only splines */
+ while (open_spline_index > 0) {
+ const unsigned int vertex_offset = open_spline_ranges[--open_spline_index].vertex_offset;
+ unsigned int vertex_total = open_spline_ranges[ open_spline_index].vertex_total;
+ unsigned int vertex_total_cap_head = open_spline_ranges[ open_spline_index].vertex_total_cap_head;
+ unsigned int vertex_total_cap_tail = open_spline_ranges[ open_spline_index].vertex_total_cap_tail;
+ unsigned int k, j;
+
+ j = vertex_offset;
+
+ /* subtract one since we reference next vertex triple */
+ for (k = 0; k < vertex_total - 1; k++, j += 3) {
+
+ BLI_assert(j == vertex_offset + (k * 3));
+
+ *(face++) = j + 3; /* next span */ /* z 1 */
+ *(face++) = j + 0; /* z 1 */
+ *(face++) = j + 1; /* z 0 */
+ *(face++) = j + 4; /* next span */ /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+
+ *(face++) = j + 0; /* z 1 */
+ *(face++) = j + 3; /* next span */ /* z 1 */
+ *(face++) = j + 5; /* next span */ /* z 0 */
+ *(face++) = j + 2; /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+ }
+
+ if (open_spline_ranges[open_spline_index].is_cyclic) {
+ *(face++) = vertex_offset + 0; /* next span */ /* z 1 */
+ *(face++) = j + 0; /* z 1 */
+ *(face++) = j + 1; /* z 0 */
+ *(face++) = vertex_offset + 1; /* next span */ /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+
+ *(face++) = j + 0; /* z 1 */
+ *(face++) = vertex_offset + 0; /* next span */ /* z 1 */
+ *(face++) = vertex_offset + 2; /* next span */ /* z 0 */
+ *(face++) = j + 2; /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+ }
+ else {
+ unsigned int midvidx = vertex_offset;
+
+ /***************
+ * cap end 'a' */
+ j = midvidx + (vertex_total * 3);
+
+ for (k = 0; k < vertex_total_cap_head - 2; k++, j++) {
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = j + 0; /* z 0 */
+ *(face++) = j + 1; /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+ }
+
+ j = vertex_offset + (vertex_total * 3);
+
+ /* 2 tris that join the original */
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = midvidx + 1; /* z 0 */
+ *(face++) = j + 0; /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = j + vertex_total_cap_head - 2; /* z 0 */
+ *(face++) = midvidx + 2; /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+
+
+ /***************
+ * cap end 'b' */
+ /* ... same as previous but v 2-3 flipped, and different initial offsets */
+
+ j = vertex_offset + (vertex_total * 3) + (vertex_total_cap_head - 1);
+
+ midvidx = vertex_offset + (vertex_total * 3) - 3;
+
+ for (k = 0; k < vertex_total_cap_tail - 2; k++, j++) {
+ *(face++) = midvidx; /* z 1 */
+ *(face++) = midvidx; /* z 1 */
+ *(face++) = j + 1; /* z 0 */
+ *(face++) = j + 0; /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+ }
+
+ j = vertex_offset + (vertex_total * 3) + (vertex_total_cap_head - 1);
+
+ /* 2 tris that join the original */
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = j + 0; /* z 0 */
+ *(face++) = midvidx + 1; /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = midvidx + 0; /* z 1 */
+ *(face++) = midvidx + 2; /* z 0 */
+ *(face++) = j + vertex_total_cap_tail - 2; /* z 0 */
+ face_index++;
+ FACE_ASSERT(face - 4, sf_vert_tot);
+
+ }
+ }
+
+ MEM_freeN(open_spline_ranges);
+
+// fprintf(stderr, "%u %u (%u %u), %u\n", face_index, sf_tri_tot + tot_feather_quads, sf_tri_tot, tot_feather_quads, tot_boundary_used - tot_boundary_found);
+
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+ BLI_assert(face_index + (tot_boundary_used - tot_boundary_found) == sf_tri_tot + tot_feather_quads);
+#else
+ BLI_assert(face_index == sf_tri_tot + tot_feather_quads);
+#endif
+ {
+ MaskRasterLayer *layer = &mr_handle->layers[masklay_index];
+
+ if (BLI_rctf_isect(&default_bounds, &bounds, &bounds)) {
+#ifdef USE_SCANFILL_EDGE_WORKAROUND
+ layer->face_tot = (sf_tri_tot + tot_feather_quads) - (tot_boundary_used - tot_boundary_found);
+#else
+ layer->face_tot = (sf_tri_tot + tot_feather_quads);
+#endif
+ layer->face_coords = face_coords;
+ layer->face_array = face_array;
+ layer->bounds = bounds;
+
+ layer_bucket_init(layer, pixel_size);
+
+ BLI_rctf_union(&mr_handle->bounds, &bounds);
+ }
+ else {
+ MEM_freeN(face_coords);
+ MEM_freeN(face_array);
+
+ layer_bucket_init_dummy(layer);
+ }
+
+ /* copy as-is */
+ layer->alpha = masklay->alpha;
+ layer->blend = masklay->blend;
+ layer->blend_flag = masklay->blend_flag;
+ layer->falloff = masklay->falloff;
+ }
+
+ /* printf("tris %d, feather tris %d\n", sf_tri_tot, tot_feather_quads); */
+ }
+
+ /* add trianges */
+ BLI_scanfill_end(&sf_ctx);
+ }
+}
+
+
+/* --------------------------------------------------------------------- */
+/* functions that run inside the sampling thread (keep fast!) */
+/* --------------------------------------------------------------------- */
+
+/* 2D ray test */
+#if 0
+static float maskrasterize_layer_z_depth_tri(const float pt[2],
+ const float v1[3], const float v2[3], const float v3[3])
+{
+ float w[3];
+ barycentric_weights_v2(v1, v2, v3, pt, w);
+ return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]);
+}
+#endif
+
+#if 1
+static float maskrasterize_layer_z_depth_quad(const float pt[2],
+ const float v1[3], const float v2[3], const float v3[3], const float v4[3])
+{
+ float w[4];
+ barycentric_weights_v2_quad(v1, v2, v3, v4, pt, w);
+ //return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]) + (v4[2] * w[3]);
+ return w[2] + w[3]; /* we can make this assumption for small speedup */
+}
+#endif
+
+static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], const float dist_orig, const float xy[2])
+{
+ /* we always cast from same place only need xy */
+ if (face[3] == TRI_VERT) {
+ /* --- tri --- */
+
+#if 0
+ /* not essential but avoids unneeded extra lookups */
+ if ((cos[0][2] < dist_orig) ||
+ (cos[1][2] < dist_orig) ||
+ (cos[2][2] < dist_orig))
+ {
+ if (isect_point_tri_v2_cw(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
+ /* we know all tris are close for now */
+ return maskrasterize_layer_z_depth_tri(xy, cos[face[0]], cos[face[1]], cos[face[2]]);
+ }
+ }
+#else
+ /* we know all tris are close for now */
+ if (1) {
+ if (isect_point_tri_v2_cw(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
+ return 0.0f;
+ }
+ }
+#endif
+ }
+ else {
+ /* --- quad --- */
+
+ /* not essential but avoids unneeded extra lookups */
+ if ((cos[0][2] < dist_orig) ||
+ (cos[1][2] < dist_orig) ||
+ (cos[2][2] < dist_orig) ||
+ (cos[3][2] < dist_orig))
+ {
+
+ /* needs work */
+#if 1
+ /* quad check fails for bowtie, so keep using 2 tri checks */
+ //if (isect_point_quad_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]]))
+ if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]]) ||
+ isect_point_tri_v2(xy, cos[face[0]], cos[face[2]], cos[face[3]]))
+ {
+ return maskrasterize_layer_z_depth_quad(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]]);
+ }
+#elif 1
+ /* don't use isect_point_tri_v2_cw because we could have bowtie quads */
+
+ if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
+ return maskrasterize_layer_z_depth_tri(xy, cos[face[0]], cos[face[1]], cos[face[2]]);
+ }
+ else if (isect_point_tri_v2(xy, cos[face[0]], cos[face[2]], cos[face[3]])) {
+ return maskrasterize_layer_z_depth_tri(xy, cos[face[0]], cos[face[2]], cos[face[3]]);
+ }
+#else
+ /* cheat - we know first 2 verts are z0.0f and second 2 are z 1.0f */
+ /* ... worth looking into */
+#endif
+ }
+ }
+
+ return 1.0f;
+}
+
+BLI_INLINE unsigned int layer_bucket_index_from_xy(MaskRasterLayer *layer, const float xy[2])
+{
+ BLI_assert(BLI_in_rctf_v(&layer->bounds, xy));
+
+ return ( (unsigned int)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0])) +
+ (((unsigned int)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1])) * layer->buckets_x);
+}
+
+static float layer_bucket_depth_from_xy(MaskRasterLayer *layer, const float xy[2])
+{
+ unsigned int index = layer_bucket_index_from_xy(layer, xy);
+ unsigned int *face_index = layer->buckets_face[index];
+
+ if (face_index) {
+ unsigned int (*face_array)[4] = layer->face_array;
+ float (*cos)[3] = layer->face_coords;
+ float best_dist = 1.0f;
+ while (*face_index != TRI_TERMINATOR_ID) {
+ const float test_dist = maskrasterize_layer_isect(face_array[*face_index], cos, best_dist, xy);
+ if (test_dist < best_dist) {
+ best_dist = test_dist;
+ /* comparing with 0.0f is OK here because triangles are always zero depth */
+ if (best_dist == 0.0f) {
+ /* bail early, we're as close as possible */
+ return 0.0f;
+ }
+ }
+ face_index++;
+ }
+ return best_dist;
+ }
+ else {
+ return 1.0f;
+ }
+}
+
+float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2])
+{
+ /* can't do this because some layers may invert */
+ /* if (BLI_in_rctf_v(&mr_handle->bounds, xy)) */
+
+ const unsigned int layers_tot = mr_handle->layers_tot;
+ unsigned int i;
+ MaskRasterLayer *layer = mr_handle->layers;
+
+ /* return value */
+ float value = 0.0f;
+
+ for (i = 0; i < layers_tot; i++, layer++) {
+ float value_layer;
+
+ /* also used as signal for unused layer (when render is disabled) */
+ if (layer->alpha != 0.0f && BLI_in_rctf_v(&layer->bounds, xy)) {
+ value_layer = 1.0f - layer_bucket_depth_from_xy(layer, xy);
+
+ switch (layer->falloff) {
+ case PROP_SMOOTH:
+ /* ease - gives less hard lines for dilate/erode feather */
+ value_layer = (3.0f * value_layer * value_layer - 2.0f * value_layer * value_layer * value_layer);
+ break;
+ case PROP_SPHERE:
+ value_layer = sqrtf(2.0f * value_layer - value_layer * value_layer);
+ break;
+ case PROP_ROOT:
+ value_layer = sqrtf(value_layer);
+ break;
+ case PROP_SHARP:
+ value_layer = value_layer * value_layer;
+ break;
+ case PROP_LIN:
+ default:
+ /* nothing */
+ break;
+ }
+
+ if (layer->blend != MASK_BLEND_REPLACE) {
+ value_layer *= layer->alpha;
+ }
+ }
+ else {
+ value_layer = 0.0f;
+ }
+
+ if (layer->blend_flag & MASK_BLENDFLAG_INVERT) {
+ value_layer = 1.0f - value_layer;
+ }
+
+ switch (layer->blend) {
+ case MASK_BLEND_ADD:
+ value += value_layer;
+ break;
+ case MASK_BLEND_SUBTRACT:
+ value -= value_layer;
+ break;
+ case MASK_BLEND_LIGHTEN:
+ value = maxf(value, value_layer);
+ break;
+ case MASK_BLEND_DARKEN:
+ value = minf(value, value_layer);
+ break;
+ case MASK_BLEND_MUL:
+ value *= value_layer;
+ break;
+ case MASK_BLEND_REPLACE:
+ value = (value * (1.0f - layer->alpha)) + (value_layer * layer->alpha);
+ break;
+ case MASK_BLEND_DIFFERENCE:
+ value = fabsf(value - value_layer);
+ break;
+ default: /* same as add */
+ BLI_assert(0);
+ value += value_layer;
+ break;
+ }
+
+ /* clamp after applying each layer so we don't get
+ * issues subtracting after accumulating over 1.0f */
+ CLAMP(value, 0.0f, 1.0f);
+ }
+
+ return value;
+}
+
+#endif /* USE_RASKTER */
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index b5b03a8924f..f897543db18 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -2307,7 +2307,7 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
metaball_tree = NULL;
}
- /* if scene includes more then one MetaElem, then octal tree optimalisation is used */
+ /* if scene includes more then one MetaElem, then octal tree optimization is used */
if ((totelem > 1) && (totelem <= 64)) init_metaball_octal_tree(1);
if ((totelem > 64) && (totelem <= 128)) init_metaball_octal_tree(2);
if ((totelem > 128) && (totelem <= 512)) init_metaball_octal_tree(3);
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 8d81e7b595d..c5752e193df 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1230,7 +1230,7 @@ int BKE_mesh_nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert,
MEdge **alledge, int *totedge, MLoop **allloop, MPoly **allpoly,
int *totloop, int *totpoly)
{
- return BKE_mesh_nurbs_to_mdata_customdb(ob, &ob->disp,
+ return BKE_mesh_nurbs_displist_to_mdata(ob, &ob->disp,
allvert, totvert,
alledge, totedge,
allloop, allpoly,
@@ -1242,7 +1242,7 @@ int BKE_mesh_nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert,
/* Initialize mverts, medges and, faces for converting nurbs to mesh and derived mesh */
/* use specified dispbase */
-int BKE_mesh_nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase,
+int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase,
MVert **allvert, int *_totvert,
MEdge **alledge, int *_totedge,
MLoop **allloop, MPoly **allpoly,
@@ -1462,7 +1462,7 @@ int BKE_mesh_nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase,
}
/* this may fail replacing ob->data, be sure to check ob->type */
-void BKE_mesh_from_nurbs(Object *ob)
+void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase)
{
Main *bmain = G.main;
Object *ob1;
@@ -1478,9 +1478,9 @@ void BKE_mesh_from_nurbs(Object *ob)
cu = ob->data;
if (dm == NULL) {
- if (BKE_mesh_nurbs_to_mdata(ob, &allvert, &totvert,
- &alledge, &totedge, &allloop,
- &allpoly, &totloop, &totpoly) != 0)
+ if (BKE_mesh_nurbs_displist_to_mdata(ob, dispbase, &allvert, &totvert,
+ &alledge, &totedge, &allloop,
+ &allpoly, &totloop, &totpoly) != 0)
{
/* Error initializing */
return;
@@ -1534,6 +1534,11 @@ void BKE_mesh_from_nurbs(Object *ob)
}
}
+void BKE_mesh_from_nurbs(Object *ob)
+{
+ return BKE_mesh_from_nurbs_displist(ob, &ob->disp);
+}
+
typedef struct EdgeLink {
Link *next, *prev;
void *edge;
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 2d83a748767..de367b6b4d0 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -340,6 +340,10 @@ typedef struct MovieClipImBufCacheKey {
short render_flag;
} MovieClipImBufCacheKey;
+typedef struct MovieClipCachePriorityData {
+ int framenr;
+} MovieClipCachePriorityData;
+
static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags)
{
MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *)userkey;
@@ -380,6 +384,32 @@ static int moviecache_hashcmp(const void *av, const void *bv)
return 0;
}
+void *moviecache_getprioritydata(void *key_v)
+{
+ MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *) key_v;
+ MovieClipCachePriorityData *priority_data;
+
+ priority_data = MEM_callocN(sizeof(priority_data), "movie cache clip priority data");
+ priority_data->framenr = key->framenr;
+
+ return priority_data;
+}
+
+int moviecache_getitempriority(void *last_userkey_v, void *priority_data_v)
+{
+ MovieClipImBufCacheKey *last_userkey = (MovieClipImBufCacheKey *) last_userkey_v;
+ MovieClipCachePriorityData *priority_data = (MovieClipCachePriorityData *) priority_data_v;
+
+ return -abs(last_userkey->framenr - priority_data->framenr);
+}
+
+void moviecache_prioritydeleter(void *priority_data_v)
+{
+ MovieClipCachePriorityData *priority_data = (MovieClipCachePriorityData *) priority_data_v;
+
+ MEM_freeN(priority_data);
+}
+
static ImBuf *get_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag)
{
if (clip->cache) {
@@ -407,10 +437,20 @@ static void put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i
MovieClipImBufCacheKey key;
if (!clip->cache) {
+ struct MovieCache *moviecache;
+
+ // char cache_name[64];
+ // BLI_snprintf(cache_name, sizeof(cache_name), "movie %s", clip->id.name);
+
clip->cache = MEM_callocN(sizeof(MovieClipCache), "movieClipCache");
- clip->cache->moviecache = IMB_moviecache_create(sizeof(MovieClipImBufCacheKey), moviecache_hashhash,
- moviecache_hashcmp, moviecache_keydata);
+ moviecache = IMB_moviecache_create("movieclip", sizeof(MovieClipImBufCacheKey), moviecache_hashhash, moviecache_hashcmp);
+
+ IMB_moviecache_set_getdata_callback(moviecache, moviecache_keydata);
+ IMB_moviecache_set_priority_callback(moviecache, moviecache_getprioritydata, moviecache_getitempriority,
+ moviecache_prioritydeleter);
+
+ clip->cache->moviecache = moviecache;
}
key.framenr = user->framenr;
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 2bc5c37b41b..866194eea0e 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -992,6 +992,9 @@ static void grid_tangent_matrix(float mat[3][3], const CCGKey *key,
copy_v3_v3(mat[2], CCG_grid_elem_no(key, grid, x, y));
}
+/* XXX WARNING: subsurf elements from dm and oldGridData *must* be of the same format (size),
+ * because this code uses CCGKey's info from dm to access oldGridData's normals
+ * (through the call to grid_tangent_matrix())! */
static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm2, DispOp op, CCGElem **oldGridData, int totlvl)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
@@ -1064,9 +1067,12 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
/* if needed, reallocate multires paint mask */
if (gpm && gpm->level < key.level) {
gpm->level = key.level;
- if (gpm->data)
- MEM_freeN(gpm->data);
- gpm->data = MEM_callocN(sizeof(float) * key.grid_area, "gpm.data");
+ #pragma omp critical
+ {
+ if (gpm->data)
+ MEM_freeN(gpm->data);
+ gpm->data = MEM_callocN(sizeof(float) * key.grid_area, "gpm.data");
+ }
}
for (y = 0; y < gridSize; y++) {
@@ -2069,6 +2075,21 @@ void multires_load_old(Object *ob, Mesh *me)
me->mface[i].mat_nr = lvl->faces[i].mat_nr;
}
+ /* Copy the first-level data to the mesh */
+ /* XXX We must do this before converting tessfaces to polys/lopps! */
+ for (i = 0, l = me->mr->vdata.layers; i < me->mr->vdata.totlayer; ++i, ++l)
+ CustomData_add_layer(&me->vdata, l->type, CD_REFERENCE, l->data, me->totvert);
+ for (i = 0, l = me->mr->fdata.layers; i < me->mr->fdata.totlayer; ++i, ++l)
+ CustomData_add_layer(&me->fdata, l->type, CD_REFERENCE, l->data, me->totface);
+ memset(&me->mr->vdata, 0, sizeof(CustomData));
+ memset(&me->mr->fdata, 0, sizeof(CustomData));
+
+ multires_load_old_vcols(me);
+ multires_load_old_face_flags(me);
+
+ /* multiresModifier_subdivide (actually, multires_subdivide) expects polys, not tessfaces! */
+ BKE_mesh_convert_mfaces_to_mpolys(me);
+
/* Add a multires modifier to the object */
md = ob->modifiers.first;
while (md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform)
@@ -2081,31 +2102,25 @@ void multires_load_old(Object *ob, Mesh *me)
mmd->lvl = mmd->totlvl;
orig = CDDM_from_mesh(me, NULL);
- dm = multires_make_derived_from_derived(orig, mmd, ob, 0);
-
+ /* XXX We *must* alloc paint mask here, else we have some kind of mismatch in
+ * multires_modifier_update_mdisps() (called by dm->release(dm)), which always creates the
+ * reference subsurfed dm with this option, before calling multiresModifier_disp_run(),
+ * which implicitly expects both subsurfs from its first dm and oldGridData parameters to
+ * be of the same "format"! */
+ dm = multires_make_derived_from_derived(orig, mmd, ob, MULTIRES_ALLOC_PAINT_MASK);
+
multires_load_old_dm(dm, me, mmd->totlvl + 1);
multires_dm_mark_as_modified(dm, MULTIRES_COORDS_MODIFIED);
dm->release(dm);
orig->release(orig);
- /* Copy the first-level data to the mesh */
- for (i = 0, l = me->mr->vdata.layers; i < me->mr->vdata.totlayer; ++i, ++l)
- CustomData_add_layer(&me->vdata, l->type, CD_REFERENCE, l->data, me->totvert);
- for (i = 0, l = me->mr->fdata.layers; i < me->mr->fdata.totlayer; ++i, ++l)
- CustomData_add_layer(&me->fdata, l->type, CD_REFERENCE, l->data, me->totface);
- memset(&me->mr->vdata, 0, sizeof(CustomData));
- memset(&me->mr->fdata, 0, sizeof(CustomData));
-
- multires_load_old_vcols(me);
- multires_load_old_face_flags(me);
-
/* Remove the old multires */
multires_free(me->mr);
me->mr = NULL;
}
-/* If 'ob' and 'to_ob' both have multires modifiers, syncronize them
+/* If 'ob' and 'to_ob' both have multires modifiers, synchronize them
* such that 'ob' has the same total number of levels as 'to_ob'. */
static void multires_sync_levels(Scene *scene, Object *ob, Object *to_ob)
{
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 33df8e4b503..56b1c0a17e8 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -321,15 +321,18 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
node->color[0] = node->color[1] = node->color[2] = 0.608; /* default theme color */
node_add_sockets_from_type(ntree, node, ntype);
-
- /* initialize the node name with the node label */
- BLI_strncpy(node->name, nodeLabel(node), NODE_MAXSTR);
- nodeUniqueName(ntree, node);
-
+
BLI_addtail(&ntree->nodes, node);
if (ntype->initfunc!=NULL)
ntype->initfunc(ntree, node, ntemp);
+
+ /* initialize the node name with the node label.
+ * note: do this after the initfunc so nodes get
+ * their data set which may be used in naming
+ * (node groups for example) */
+ BLI_strncpy(node->name, nodeLabel(node), NODE_MAXSTR);
+ nodeUniqueName(ntree, node);
ntree->update |= NTREE_UPDATE_NODES;
@@ -1939,6 +1942,7 @@ static void registerCompositNodes(bNodeTreeType *ttype)
register_node_type_cmp_switch(ttype);
register_node_type_cmp_mask(ttype);
+ register_node_type_cmp_trackpos(ttype);
}
static void registerShaderNodes(bNodeTreeType *ttype)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 2ba2ad7bd6e..048560f3a83 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2300,14 +2300,21 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3])
}
if (change == FALSE) {
+ float size[3];
+
+ copy_v3_v3(size, ob->size);
+ if (ob->type == OB_EMPTY) {
+ mul_v3_fl(size, ob->empty_drawsize);
+ }
+
minmax_v3v3_v3(min_r, max_r, ob->obmat[3]);
copy_v3_v3(vec, ob->obmat[3]);
- add_v3_v3(vec, ob->size);
+ add_v3_v3(vec, size);
minmax_v3v3_v3(min_r, max_r, vec);
copy_v3_v3(vec, ob->obmat[3]);
- sub_v3_v3(vec, ob->size);
+ sub_v3_v3(vec, size);
minmax_v3v3_v3(min_r, max_r, vec);
}
}
@@ -3149,7 +3156,7 @@ static void obrel_list_add(LinkNode **links, Object *ob)
* If OB_SET_VISIBLE or OB_SET_SELECTED are collected,
* then also add related objects according to the given includeFilters.
*/
-struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter)
+LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter)
{
LinkNode *links = NULL;
@@ -3228,3 +3235,32 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
return links;
}
+
+/**
+ * return all groups this object is apart of, caller must free.
+ */
+struct LinkNode *BKE_object_groups(Object *ob)
+{
+ LinkNode *group_linknode = NULL;
+ Group *group = NULL;
+ while ((group = find_group(ob, group))) {
+ BLI_linklist_prepend(&group_linknode, group);
+ }
+
+ return group_linknode;
+}
+
+void BKE_object_groups_clear(Scene *scene, Base *base, Object *object)
+{
+ Group *group = NULL;
+
+ BLI_assert(base->object == object);
+
+ if (scene && base == NULL) {
+ base = BKE_scene_base_find(scene, object);
+ }
+
+ while ((group = find_group(base->object, group))) {
+ rem_from_group(group, object, scene, base);
+ }
+}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index dcd1a797a7a..c8b07e2ec11 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3400,6 +3400,12 @@ void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, Pa
{
float vec[3];
+ /* can happen when called from a different object's modifier */
+ if (!dm) {
+ unit_m4(hairmat);
+ return;
+ }
+
psys_face_mat(0, dm, pa, hairmat, 0);
psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0, 0);
copy_v3_v3(hairmat[3], vec);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 65f22ebc88f..0b3131f0a1c 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -1576,7 +1576,7 @@ static void initialize_all_particles(ParticleSimulationData *sim)
}
}
-static void get_angular_velocity_vector(short avemode, ParticleKey *state, float *vec)
+static void get_angular_velocity_vector(short avemode, ParticleKey *state, float vec[3])
{
switch (avemode) {
case PART_AVE_VELOCITY:
@@ -2159,7 +2159,9 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
break;
}
- copy_particle_key(states, &pa->state, 1);
+ for (i=0; i<steps; i++) {
+ copy_particle_key(states + i, &pa->state, 1);
+ }
states->time = 0.f;
@@ -2441,7 +2443,8 @@ static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr)
int i;
float flow[3], offset[3], dist;
- flow[0] = flow[1] = flow[2] = 0.0f;
+ zero_v3(flow);
+
dist = 0.0f;
if (pfr->tot_neighbors > 0) {
pa = pfr->pa;
@@ -2733,13 +2736,17 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
{
float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep, extrotfac;
- if ((part->flag & PART_ROTATIONS)==0) {
- pa->state.rot[0]=1.0f;
- pa->state.rot[1]=pa->state.rot[2]=pa->state.rot[3]=0;
+ if ((part->flag & PART_ROTATIONS) == 0) {
+ unit_qt(pa->state.rot);
return;
}
- extrotfac = len_v3(pa->state.ave);
+ if (part->flag & PART_ROT_DYN) {
+ extrotfac = len_v3(pa->state.ave);
+ }
+ else {
+ extrotfac = 0.0f;
+ }
if ((part->flag & PART_ROT_DYN) && ELEM3(part->avemode, PART_AVE_VELOCITY, PART_AVE_HORIZONTAL, PART_AVE_VERTICAL)) {
float angle;
@@ -2747,8 +2754,9 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
float len2 = len_v3(pa->state.vel);
float vec[3];
- if (len1==0.0f || len2==0.0f)
- pa->state.ave[0] = pa->state.ave[1] = pa->state.ave[2] = 0.0f;
+ if (len1 == 0.0f || len2 == 0.0f) {
+ zero_v3(pa->state.ave);
+ }
else {
cross_v3_v3v3(pa->state.ave, pa->prev_state.vel, pa->state.vel);
normalize_v3(pa->state.ave);
@@ -2761,9 +2769,8 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
}
rotfac = len_v3(pa->state.ave);
- if (rotfac == 0.0f || (part->flag & PART_ROT_DYN)==0 || extrotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
- rot1[0]=1.0f;
- rot1[1]=rot1[2]=rot1[3]=0;
+ if (rotfac == 0.0f || (part->flag & PART_ROT_DYN)==0 || extrotfac == 0.0f) {
+ unit_qt(rot1);
}
else {
axis_angle_to_quat(rot1,pa->state.ave,rotfac*dtime);
@@ -3750,8 +3757,10 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
pa->totkey++;
/* root is always in the origin of hair space so we set it to be so after the last key is saved*/
- if (pa->totkey == psys->part->hair_step + 1)
- root->co[0] = root->co[1] = root->co[2] = 0.0f;
+ if (pa->totkey == psys->part->hair_step + 1) {
+ zero_v3(root->co);
+ }
+
}
}
@@ -4130,9 +4139,8 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
pa->state.vel[j] = wrf;
}
- pa->state.ave[0] = pa->state.ave[1] = pa->state.ave[2] = 0.0f;
- pa->state.rot[0] = 1.0;
- pa->state.rot[1] = pa->state.rot[2] = pa->state.rot[3] = 0.0;
+ zero_v3(pa->state.ave);
+ unit_qt(pa->state.rot);
pa->time = 1.f;
pa->dietime = sim->scene->r.efra + 1;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index a3fa8f8be89..101f53fe94f 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -326,8 +326,7 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
/* default to no rotation */
if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
- pa->state.rot[0]=1.0f;
- pa->state.rot[1]=pa->state.rot[2]=pa->state.rot[3]=0;
+ unit_qt(pa->state.rot);
}
}
static void ptcache_particle_interpolate(int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, float *old_data)
@@ -2320,7 +2319,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
* - simulation time is scaled by result of bsystem_time
* - for offsetting time only time offset is taken into account, since
* that's always the same and can't be animated. a timeoffset which
- * varies over time is not simpe to support.
+ * varies over time is not simple to support.
* - field and motion blur offsets are currently ignored, proper solution
* is probably to interpolate results from two frames for that ..
*/
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 6f24eadd1b6..d9afd1eefb4 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -487,7 +487,7 @@ Scene *BKE_scene_add(const char *name)
BLI_strncpy(sce->r.pic, U.renderdir, sizeof(sce->r.pic));
- BLI_init_rctf(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
+ BLI_rctf_init(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
sce->r.osa = 8;
/* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c
index 582034ae623..0d91dcb7faa 100644
--- a/source/blender/blenkernel/intern/seqcache.c
+++ b/source/blender/blenkernel/intern/seqcache.c
@@ -98,8 +98,7 @@ void seq_stripelem_cache_cleanup(void)
{
if (moviecache) {
IMB_moviecache_free(moviecache);
- moviecache = IMB_moviecache_create(sizeof(SeqCacheKey), seqcache_hashhash,
- seqcache_hashcmp, NULL);
+ moviecache = IMB_moviecache_create("seqcache", sizeof(SeqCacheKey), seqcache_hashhash, seqcache_hashcmp);
}
}
@@ -133,8 +132,7 @@ void seq_stripelem_cache_put(
}
if (!moviecache) {
- moviecache = IMB_moviecache_create(sizeof(SeqCacheKey), seqcache_hashhash,
- seqcache_hashcmp, NULL);
+ moviecache = IMB_moviecache_create("seqcache", sizeof(SeqCacheKey), seqcache_hashhash, seqcache_hashcmp);
}
key.seq = seq;
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 2e2f0e54792..0532a019ecc 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -310,7 +310,7 @@ static void do_alphaunder_effect_byte(
/* rt = rt1 under rt2 (alpha from rt2) */
- /* this complex optimalisation is because the
+ /* this complex optimization is because the
* 'skybuf' can be crossed in
*/
if (rt2[3] == 0 && fac2 == 256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
@@ -379,7 +379,7 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
/* rt = rt1 under rt2 (alpha from rt2) */
- /* this complex optimalisation is because the
+ /* this complex optimization is because the
* 'skybuf' can be crossed in
*/
if (rt2[3] <= 0 && fac2 >= 1.0f) {
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 902eeefd934..b7f72ff86e2 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -464,7 +464,7 @@ void seq_end(SeqIterator *iter)
* **********************************************************************
* build_seqar
* *********************************************************************
- * Build a complete array of _all_ sequencies (including those
+ * Build a complete array of _all_ sequences (including those
* in metastrips!)
* *********************************************************************
*/
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 1d6895a8c71..2c105e4940d 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -78,9 +78,8 @@ variables on the UI for now
#include "BKE_DerivedMesh.h"
#include "BKE_pointcache.h"
#include "BKE_deform.h"
-#include "BKE_mesh.h"
-//XXX #include "BIF_editdeform.h"
-//XXX #include "BIF_graphics.h"
+#include "BKE_mesh.h"
+
#include "PIL_time.h"
// #include "ONL_opennl.h" remove linking to ONL for now
@@ -2914,7 +2913,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
aabbmin[0]=aabbmin[1]=aabbmin[2] = 1e20f;
aabbmax[0]=aabbmax[1]=aabbmax[2] = -1e20f;
- /* old one with homogenous masses */
+ /* old one with homogeneous masses */
/* claim a minimum mass for vertex */
/*
if (sb->nodemass > 0.009999f) timeovermass = forcetime/sb->nodemass;
@@ -3297,7 +3296,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
/* I'd like to have it .. if (sb->namedVG_Goal[0]) */
get_scalar_from_vertexgroup(ob, a, (short) (sb->vertgroup-1), &bp->goal);
- /* do this always, regardless successfull read from vertex group */
+ /* do this always, regardless successful read from vertex group */
/* this is where '2.5 every thing is animatable' goes wrong in the first place jow_go_for2_5 */
/* 1st coding action to take : move this to frame level */
/* reads: leave the bp->goal as it was read from vertex group / or default .. we will need it at per frame call */
@@ -3811,7 +3810,7 @@ static void softbody_update_positions(Object *ob, SoftBody *sb, float (*vertexCo
* that is:
* a precise position vector denoting the motion of the center of mass
* give a rotation/scale matrix using averaging method, that's why estimate and not calculate
- * see: this is kind of reverse engeneering: having to states of a point cloud and recover what happend
+ * see: this is kind of reverse engineering: having to states of a point cloud and recover what happend
* our advantage here we know the identity of the vertex
* there are others methods giving other results.
* lloc, lrot, lscale are allowed to be NULL, just in case you don't need it.
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index b5965838a30..a2028ff5fa1 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -383,7 +383,7 @@ int BKE_frameserver_append(RenderData *UNUSED(rd), int UNUSED(start_frame), int
connsock = -1;
}
- return 0;
+ return 1;
}
void BKE_frameserver_end(void)
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index 5ec8247c03a..a2957b32824 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -104,7 +104,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float *dir, float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata);
-float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float light_end[3], float pos[3]);
+float BLI_bvhtree_bb_raycast(const float *bv, const float light_start[3], const float light_end[3], float pos[3]);
/* range query */
int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata);
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 8ccc3159f78..107b688b36a 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -55,11 +55,13 @@ float area_quad_v3(const float a[3], const float b[3], const float c[3], const f
float area_poly_v3(int nr, float verts[][3], const float normal[3]);
int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
+int is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]);
/********************************* Distance **********************************/
float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2]);
-float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]);
+float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]);
+float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]);
void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2]);
float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3]);
@@ -85,11 +87,13 @@ void limit_dist_v3(float v1[3], float v2[3], const float dist);
#define ISECT_LINE_LINE_EXACT 1
#define ISECT_LINE_LINE_CROSS 2
+int isect_line_line_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]);
int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]);
int isect_line_line_v2_int(const int a1[2], const int a2[2], const int b1[2], const int b2[2]);
int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], const float r, float r_p1[3], float r_p2[3]);
int isect_line_sphere_v2(const float l1[2], const float l2[2], const float sp[2], const float r, float r_p1[2], float r_p2[2]);
int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]);
+int isect_seg_seg_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]);
/* Returns the number of point of interests
* 0 - lines are colinear
@@ -151,6 +155,7 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
int isect_point_quad_v2(const float p[2], const float a[2], const float b[2], const float c[2], const float d[2]);
int isect_point_tri_v2(const float v1[2], const float v2[2], const float v3[2], const float pt[2]);
+int isect_point_tri_v2_cw(const float pt[2], const float v1[2], const float v2[2], const float v3[2]);
int isect_point_tri_v2_int(const int x1, const int y1, const int x2, const int y2, const int a, const int b);
int isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3]);
@@ -187,7 +192,8 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
/* tri or quad, d can be NULL */
void interp_weights_face_v3(float w[4],
const float a[3], const float b[3], const float c[3], const float d[3], const float p[3]);
-void interp_weights_poly_v3(float w[], float v[][3], const int n, const float p[3]);
+void interp_weights_poly_v3(float w[], float v[][3], const int n, const float co[3]);
+void interp_weights_poly_v2(float w[], float v[][2], const int n, const float co[2]);
void interp_cubic_v3(float x[3], float v[3],
const float x1[3], const float v1[3], const float x2[3], const float v2[3], const float t);
@@ -200,6 +206,8 @@ void barycentric_transform(float pt_tar[3], float const pt_src[3],
void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2],
const float co[2], float w[3]);
+void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const float v3[2], const float v4[2],
+ const float co[2], float w[4]);
int barycentric_coords_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]);
int barycentric_inside_triangle_v2(const float w[3]);
diff --git a/source/blender/blenlib/BLI_memarena.h b/source/blender/blenlib/BLI_memarena.h
index abba03ece9d..2a2dd31b26f 100644
--- a/source/blender/blenlib/BLI_memarena.h
+++ b/source/blender/blenlib/BLI_memarena.h
@@ -50,16 +50,43 @@ extern "C" {
struct MemArena;
typedef struct MemArena MemArena;
+struct MemArena *BLI_memarena_new(const int bufsize, const char *name)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+__attribute__((nonnull(2)))
+#endif
+;
-struct MemArena *BLI_memarena_new(int bufsize, const char *name);
-void BLI_memarena_free(struct MemArena *ma);
+void BLI_memarena_free(struct MemArena *ma)
+#ifdef __GNUC__
+__attribute__((nonnull(1)))
+#endif
+;
-void BLI_memarena_use_malloc(struct MemArena *ma);
-void BLI_memarena_use_calloc(struct MemArena *ma);
+void BLI_memarena_use_malloc(struct MemArena *ma)
+#ifdef __GNUC__
+__attribute__((nonnull(1)))
+#endif
+;
+void BLI_memarena_use_calloc(struct MemArena *ma)
+#ifdef __GNUC__
+__attribute__((nonnull(1)))
+#endif
+;
-void BLI_memarena_use_align(struct MemArena *ma, int align);
+void BLI_memarena_use_align(struct MemArena *ma, const int align)
+#ifdef __GNUC__
+__attribute__((nonnull(1)))
+#endif
+;
-void *BLI_memarena_alloc(struct MemArena *ma, int size);
+void *BLI_memarena_alloc(struct MemArena *ma, int size)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+__attribute__((nonnull(1)))
+__attribute__((alloc_size(2)))
+#endif
+;
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h
index 9d7c7d496c8..8fd2166e6f8 100644
--- a/source/blender/blenlib/BLI_mempool.h
+++ b/source/blender/blenlib/BLI_mempool.h
@@ -31,7 +31,7 @@
/** \file BLI_mempool.h
* \ingroup bli
* \author Geoffrey Bantle
- * \brief Simple fast memory allocator.
+ * \brief Simple fast memory allocator for fixed size chunks.
*/
#ifdef __cplusplus
@@ -48,16 +48,47 @@ typedef struct BLI_mempool BLI_mempool;
* first four bytes of the elements never contain the character string
* 'free'. use with care.*/
-BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag);
-void *BLI_mempool_alloc(BLI_mempool *pool);
-void *BLI_mempool_calloc(BLI_mempool *pool);
-void BLI_mempool_free(BLI_mempool *pool, void *addr);
-void BLI_mempool_destroy(BLI_mempool *pool);
-int BLI_mempool_count(BLI_mempool *pool);
-void *BLI_mempool_findelem(BLI_mempool *pool, int index);
+BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+#endif
+;
+void *BLI_mempool_alloc(BLI_mempool *pool)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+__attribute__((nonnull(1)))
+#endif
+;
+void *BLI_mempool_calloc(BLI_mempool *pool)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+__attribute__((nonnull(1)))
+#endif
+;
+void BLI_mempool_free(BLI_mempool *pool, void *addr)
+#ifdef __GNUC__
+__attribute__((nonnull(1, 2)))
+#endif
+;
+void BLI_mempool_destroy(BLI_mempool *pool)
+#ifdef __GNUC__
+__attribute__((nonnull(1)))
+#endif
+;
+int BLI_mempool_count(BLI_mempool *pool)
+#ifdef __GNUC__
+__attribute__((nonnull(1)))
+#endif
+;
+void *BLI_mempool_findelem(BLI_mempool *pool, int index)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+__attribute__((nonnull(1)))
+#endif
+;
/** iteration stuff. note: this may easy to produce bugs with **/
-/*private structure*/
+/* private structure */
typedef struct BLI_mempool_iter {
BLI_mempool *pool;
struct BLI_mempool_chunk *curchunk;
@@ -70,11 +101,20 @@ enum {
BLI_MEMPOOL_ALLOW_ITER = (1 << 1)
};
-void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter);
-void *BLI_mempool_iterstep(BLI_mempool_iter *iter);
+void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
+#ifdef __GNUC__
+__attribute__((nonnull(1, 2)))
+#endif
+;
+void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+__attribute__((nonnull(1)))
+#endif
+;
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* __BLI_MEMPOOL_H__ */
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 0cf32eeb276..1c06e107c1f 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -40,34 +40,35 @@ struct rcti;
extern "C" {
#endif
-/* BLI_rct.c */
-/**
- * Determine if a rect is empty. An empty
- * rect is one with a zero (or negative)
- * width or height.
- *
- * \return True if \a rect is empty.
- */
-int BLI_rcti_is_empty(struct rcti *rect);
-int BLI_rctf_is_empty(struct rctf *rect);
-void BLI_init_rctf(struct rctf *rect, float xmin, float xmax, float ymin, float ymax);
-void BLI_init_rcti(struct rcti *rect, int xmin, int xmax, int ymin, int ymax);
-void BLI_translate_rctf(struct rctf *rect, float x, float y);
-void BLI_translate_rcti(struct rcti *rect, int x, int y);
-void BLI_resize_rcti(struct rcti *rect, int x, int y);
-void BLI_resize_rctf(struct rctf *rect, float x, float y);
-int BLI_in_rcti(struct rcti *rect, int x, int y);
-int BLI_in_rctf(struct rctf *rect, float x, float y);
-int BLI_segment_in_rcti(struct rcti *rect, int s1[2], int s2[2]);
-// int BLI_segment_in_rctf(struct rcti *rect, int s1[2], int s2[2]); // NOT NEEDED YET
-int BLI_isect_rctf(struct rctf *src1, struct rctf *src2, struct rctf *dest);
-int BLI_isect_rcti(struct rcti *src1, struct rcti *src2, struct rcti *dest);
-void BLI_union_rctf(struct rctf *rcta, struct rctf *rctb);
-void BLI_union_rcti(struct rcti *rcti1, struct rcti *rcti2);
-void BLI_copy_rcti_rctf(struct rcti *tar, const struct rctf *src);
+int BLI_rcti_is_empty(const struct rcti *rect);
+int BLI_rctf_is_empty(const struct rctf *rect);
+void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax);
+void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax);
+void BLI_rcti_init_minmax(struct rcti *rect);
+void BLI_rctf_init_minmax(struct rctf *rect);
+void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2]);
+void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2]);
+
+void BLI_rctf_translate(struct rctf *rect, float x, float y);
+void BLI_rcti_translate(struct rcti *rect, int x, int y);
+void BLI_rcti_resize(struct rcti *rect, int x, int y);
+void BLI_rctf_resize(struct rctf *rect, float x, float y);
+int BLI_in_rcti(const struct rcti *rect, const int x, const int y);
+int BLI_in_rcti_v(const struct rcti *rect, const int xy[2]);
+int BLI_in_rctf(const struct rctf *rect, const float x, const float y);
+int BLI_in_rctf_v(const struct rctf *rect, const float xy[2]);
+int BLI_rcti_isect_segment(const struct rcti *rect, const int s1[2], const int s2[2]);
+#if 0 /* NOT NEEDED YET */
+int BLI_rctf_isect_segment(struct rcti *rect, int s1[2], int s2[2]);
+#endif
+int BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest);
+int BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest);
+void BLI_rctf_union(struct rctf *rctf1, const struct rctf *rctf2);
+void BLI_rcti_union(struct rcti *rcti1, const struct rcti *rcti2);
+void BLI_rcti_rctf_copy(struct rcti *tar, const struct rctf *src);
-void print_rctf(const char *str, struct rctf *rect);
-void print_rcti(const char *str, struct rcti *rect);
+void print_rctf(const char *str, const struct rctf *rect);
+void print_rcti(const char *str, const struct rcti *rect);
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index ceef378358b..a6b1943cb4d 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -65,11 +65,12 @@ typedef struct ScanFillVert {
union {
struct ScanFillVert *v;
void *p;
- intptr_t l;
+ intptr_t l;
+ unsigned int u;
} tmp;
float co[3]; /* vertex location */
float xy[2]; /* 2D copy of vertex location (using dominant axis) */
- int keyindex; /* original index #, for restoring key information */
+ unsigned int keyindex; /* original index #, for restoring key information */
short poly_nr;
unsigned char f, h;
} ScanFillVert;
@@ -79,6 +80,9 @@ typedef struct ScanFillEdge {
struct ScanFillVert *v1, *v2;
short poly_nr;
unsigned char f;
+ union {
+ unsigned char c;
+ } tmp;
} ScanFillEdge;
typedef struct ScanFillFace {
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 8fde8fcf13f..a74629e589c 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -105,7 +105,7 @@ __attribute__((nonnull))
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
* data we want...
*/
-char *BLI_getQuotedStr(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *str, const char *prefix)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index fb8771722c1..902373bcd6b 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -31,6 +31,9 @@
/** \file BLI_threads.h
* \ingroup bli
*/
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <pthread.h>
@@ -67,7 +70,7 @@ int BLI_system_thread_count(void); /* gets the number of threads the system
* One custom lock available now. can be extended. */
#define LOCK_IMAGE 0
-#define LOCK_PREVIEW 1
+#define LOCK_DRAW_IMAGE 1
#define LOCK_VIEWER 2
#define LOCK_CUSTOM1 3
#define LOCK_RCACHE 4
@@ -139,5 +142,9 @@ int BLI_thread_queue_size(ThreadQueue *queue);
void BLI_thread_queue_wait_finish(ThreadQueue *queue);
void BLI_thread_queue_nowait(ThreadQueue *queue);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index f761f2edcba..536236c07ac 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -232,6 +232,10 @@
#define SET_INT_IN_POINTER(i) ((void *)(intptr_t)(i))
#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
+#define SET_UINT_IN_POINTER(i) ((void *)(uintptr_t)(i))
+#define GET_UINT_FROM_POINTER(i) ((unsigned int)(uintptr_t)(i))
+
+
/* Macro to convert a value to string in the preprocessor
* STRINGIFY_ARG: gives the argument as a string
* STRINGIFY_APPEND: appends any argument 'b' onto the string argument 'a',
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index d07f19e78e0..9a2b94b2c7e 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -687,7 +687,7 @@ static void split_leafs(BVHNode **leafs_array, int *nth, int partitions, int spl
* The reason is that we can build level N+1 from level N without any data dependencies.. thus it allows
* to use multithread building.
*
- * To archieve this is necessary to find how much leafs are accessible from a certain branch, BVHBuildHelper
+ * To archive this is necessary to find how much leafs are accessible from a certain branch, BVHBuildHelper
* implicit_needed_branches and implicit_leafs_index are auxiliary functions to solve that "optimal-split".
*/
static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array, BVHNode **leafs_array, int num_leafs)
@@ -748,7 +748,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
parent->main_axis = split_axis / 2;
/* Split the childs along the split_axis, note: its not needed to sort the whole leafs array
- * Only to assure that the elements are partioned on a way that each child takes the elements
+ * Only to assure that the elements are partitioned on a way that each child takes the elements
* it would take in case the whole array was sorted.
* Split_leafs takes care of that "sort" problem. */
nth_positions[0] = parent_leafs_begin;
@@ -982,7 +982,7 @@ void BLI_bvhtree_update_tree(BVHTree *tree)
{
/* Update bottom=>top
* TRICKY: the way we build the tree all the childs have an index greater than the parent
- * This allows us todo a bottom up update by starting on the biger numbered branch */
+ * This allows us todo a bottom up update by starting on the bigger numbered branch */
BVHNode **root = tree->nodes + tree->totleaf;
BVHNode **index = tree->nodes + tree->totleaf + tree->totbranch - 1;
@@ -1000,7 +1000,7 @@ float BLI_bvhtree_getepsilon(BVHTree *tree)
/*
* BLI_bvhtree_overlap
*
- * overlap - is it possbile for 2 bv's to collide ? */
+ * overlap - is it possible for 2 bv's to collide ? */
static int tree_overlap(BVHNode *node1, BVHNode *node2, int start_axis, int stop_axis)
{
float *bv1 = node1->bv;
@@ -1343,7 +1343,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
/* Determines the distance that the ray must travel to hit the bounding volume of the given node */
-static float ray_nearest_hit(BVHRayCastData *data, float *bv)
+static float ray_nearest_hit(BVHRayCastData *data, const float *bv)
{
int i;
@@ -1521,7 +1521,7 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
return data.hit.index;
}
-float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float light_end[3], float pos[3])
+float BLI_bvhtree_bb_raycast(const float *bv, const float light_start[3], const float light_end[3], float pos[3])
{
BVHRayCastData data;
float dist = 0.0;
diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c
index c8c2ad35380..53ae086782b 100644
--- a/source/blender/blenlib/intern/DLRB_tree.c
+++ b/source/blender/blenlib/intern/DLRB_tree.c
@@ -423,7 +423,7 @@ static void insert_check_2(DLRBT_Tree *tree, DLRBT_Node *node)
/* - make the grandparent red, so that we maintain alternating red/black property
* (it must exist, so no need to check for NULL here),
* - as the grandparent may now cause inconsistencies with the rest of the tree,
- * we must flush up the tree and perform checks/rebalancing/repainting, using the
+ * we must flush up the tree and perform checks/re-balancing/re-painting, using the
* grandparent as the node of interest
*/
gp->tree_col = DLRBT_RED;
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index a499f9a81ea..6ce8b9ecf91 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -52,11 +52,8 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-//XXX #include "BIF_toolbox.h"
-
#include "BKE_font.h"
-
#include "DNA_vfont_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_curve_types.h"
diff --git a/source/blender/blenlib/intern/lasso.c b/source/blender/blenlib/intern/lasso.c
index 29b967fcd37..7df4da80e16 100644
--- a/source/blender/blenlib/intern/lasso.c
+++ b/source/blender/blenlib/intern/lasso.c
@@ -95,7 +95,7 @@ int BLI_lasso_is_point_inside(int mcords[][2], short moves,
p2 = mcords[a + 1];
}
- if (fabs(angletot) > 4.0) return 1;
+ if (fabsf(angletot) > 4.0f) return 1;
return 0;
}
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index a7ffb95172e..de665686ea6 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -162,52 +162,57 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3])
/********************************* Distance **********************************/
-/* distance v1 to line v2-v3
+/* distance p to line v1-v2
* using Hesse formula, NO LINE PIECE! */
-float dist_to_line_v2(const float v1[2], const float v2[2], const float v3[2])
+float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2])
{
float a[2], deler;
- a[0] = v2[1] - v3[1];
- a[1] = v3[0] - v2[0];
+ a[0] = l1[1] - l2[1];
+ a[1] = l2[0] - l1[0];
deler = (float)sqrt(a[0] * a[0] + a[1] * a[1]);
if (deler == 0.0f) return 0;
- return fabsf((v1[0] - v2[0]) * a[0] + (v1[1] - v2[1]) * a[1]) / deler;
+ return fabsf((p[0] - l1[0]) * a[0] + (p[1] - l1[1]) * a[1]) / deler;
}
-/* distance v1 to line-piece v2-v3 */
-float dist_to_line_segment_v2(const float v1[2], const float v2[2], const float v3[2])
+/* distance p to line-piece v1-v2 */
+float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
{
float labda, rc[2], pt[2], len;
- rc[0] = v3[0] - v2[0];
- rc[1] = v3[1] - v2[1];
+ rc[0] = l2[0] - l1[0];
+ rc[1] = l2[1] - l1[1];
len = rc[0] * rc[0] + rc[1] * rc[1];
if (len == 0.0f) {
- rc[0] = v1[0] - v2[0];
- rc[1] = v1[1] - v2[1];
+ rc[0] = p[0] - l1[0];
+ rc[1] = p[1] - l1[1];
return (float)(sqrt(rc[0] * rc[0] + rc[1] * rc[1]));
}
- labda = (rc[0] * (v1[0] - v2[0]) + rc[1] * (v1[1] - v2[1])) / len;
+ labda = (rc[0] * (p[0] - l1[0]) + rc[1] * (p[1] - l1[1])) / len;
if (labda <= 0.0f) {
- pt[0] = v2[0];
- pt[1] = v2[1];
+ pt[0] = l1[0];
+ pt[1] = l1[1];
}
else if (labda >= 1.0f) {
- pt[0] = v3[0];
- pt[1] = v3[1];
+ pt[0] = l2[0];
+ pt[1] = l2[1];
}
else {
- pt[0] = labda * rc[0] + v2[0];
- pt[1] = labda * rc[1] + v2[1];
+ pt[0] = labda * rc[0] + l1[0];
+ pt[1] = labda * rc[1] + l1[1];
}
- rc[0] = pt[0] - v1[0];
- rc[1] = pt[1] - v1[1];
- return sqrtf(rc[0] * rc[0] + rc[1] * rc[1]);
+ rc[0] = pt[0] - p[0];
+ rc[1] = pt[1] - p[1];
+ return (rc[0] * rc[0] + rc[1] * rc[1]);
+}
+
+float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
+{
+ return sqrtf(dist_squared_to_line_segment_v2(p, l1, l2));
}
/* point closest to v1 on line v2-v3 in 2D */
@@ -312,6 +317,21 @@ int isect_line_line_v2_int(const int v1[2], const int v2[2], const int v3[2], co
return ISECT_LINE_LINE_NONE;
}
+/* intersect Line-Line, floats - gives intersection point */
+int isect_line_line_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2])
+{
+ float div;
+
+ div = (v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]);
+ if (div == 0.0f) return ISECT_LINE_LINE_COLINEAR;
+
+ vi[0] = ((v3[0] - v4[0]) * (v1[0] * v2[1] - v1[1] * v2[0]) - (v1[0] - v2[0]) * (v3[0] * v4[1] - v3[1] * v4[0])) / div;
+ vi[1] = ((v3[1] - v4[1]) * (v1[0] * v2[1] - v1[1] * v2[0]) - (v1[1] - v2[1]) * (v3[0] * v4[1] - v3[1] * v4[0])) / div;
+
+ return ISECT_LINE_LINE_CROSS;
+}
+
+
/* intersect Line-Line, floats */
int isect_line_line_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
{
@@ -332,7 +352,7 @@ int isect_line_line_v2(const float v1[2], const float v2[2], const float v3[2],
}
/* get intersection point of two 2D segments and return intersection type:
- * -1: colliniar
+ * -1: collinear
* 1: intersection
*/
int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2])
@@ -390,7 +410,7 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
}
}
- /* lines are colliniar */
+ /* lines are collinear */
return -1;
}
@@ -406,6 +426,15 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
return -1;
}
+int isect_seg_seg_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
+{
+#define CCW(A, B, C) ((C[1] - A[1]) * (B[0] - A[0]) > (B[1]-A[1]) * (C[0]-A[0]))
+
+ return CCW(v1, v3, v4) != CCW(v2, v3, v4) && CCW(v1, v2, v3) != CCW(v1, v2, v4);
+
+#undef CCW
+}
+
int isect_line_sphere_v3(const float l1[3], const float l2[3],
const float sp[3], const float r,
float r_p1[3], float r_p2[3])
@@ -532,7 +561,7 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
}
/*
- * -1: colliniar
+ * -1: collinear
* 1: intersection
*/
static short IsectLLPt2Df(const float x0, const float y0, const float x1, const float y1,
@@ -554,17 +583,17 @@ static short IsectLLPt2Df(const float x0, const float y0, const float x1, const
* compute slopes, note the cludge for infinity, however, this will
* be close enough
*/
- if (fabs(x1 - x0) > 0.000001f)
+ if (fabsf(x1 - x0) > 0.000001f)
m1 = (y1 - y0) / (x1 - x0);
else
return -1; /*m1 = (float)1e+10;*/ /* close enough to infinity */
- if (fabs(x3 - x2) > 0.000001f)
+ if (fabsf(x3 - x2) > 0.000001f)
m2 = (y3 - y2) / (x3 - x2);
else
return -1; /*m2 = (float)1e+10;*/ /* close enough to infinity */
- if (fabs(m1 - m2) < 0.000001f)
+ if (fabsf(m1 - m2) < 0.000001f)
return -1; /* parallel lines */
/* compute constants */
@@ -586,6 +615,20 @@ static short IsectLLPt2Df(const float x0, const float y0, const float x1, const
/* point in tri */
+/* only single direction */
+int isect_point_tri_v2_cw(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
+{
+ if (line_point_side_v2(v1, v2, pt) >= 0.0f) {
+ if (line_point_side_v2(v2, v3, pt) >= 0.0f) {
+ if (line_point_side_v2(v3, v1, pt) >= 0.0f) {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
{
if (line_point_side_v2(v1, v2, pt) >= 0.0f) {
@@ -1626,7 +1669,7 @@ static int point_in_slice(const float p[3], const float v1[3], const float l1[3]
* a line including l1,l2 and a point not on the line
* define a subset of R3 delimited by planes parallel to the line and orthogonal
* to the (point --> line) distance vector,one plane on the line one on the point,
- * the room inside usually is rather small compared to R3 though still infinte
+ * the room inside usually is rather small compared to R3 though still infinite
* useful for restricting (speeding up) searches
* e.g. all points of triangular prism are within the intersection of 3 'slices'
* onother trivial case : cube
@@ -1942,6 +1985,56 @@ void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3
}
}
+/* same as #barycentric_weights_v2 but works with a quad,
+ * note: untested for values outside the quad's bounds
+ * this is #interp_weights_poly_v2 expanded for quads only */
+void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const float v3[2], const float v4[2],
+ const float co[2], float w[4])
+{
+#define MEAN_VALUE_HALF_TAN_V2(_area, i1, i2) ((_area = cross_v2v2(dirs[i1], dirs[i2])) != 0.0f ? \
+ (((lens[i1] * lens[i2]) - dot_v2v2(dirs[i1], dirs[i2])) / _area) : 0.0f)
+
+ float wtot, area;
+
+ const float dirs[4][2] = {
+ {v1[0] - co[0], v1[1] - co[1]},
+ {v2[0] - co[0], v2[1] - co[1]},
+ {v3[0] - co[0], v3[1] - co[1]},
+ {v4[0] - co[0], v4[1] - co[1]},
+ };
+
+ const float lens[4] = {
+ len_v2(dirs[0]),
+ len_v2(dirs[1]),
+ len_v2(dirs[2]),
+ len_v2(dirs[3]),
+ };
+
+ /* inline mean_value_half_tan four times here */
+ float t[4] = {
+ MEAN_VALUE_HALF_TAN_V2(area, 0, 1),
+ MEAN_VALUE_HALF_TAN_V2(area, 1, 2),
+ MEAN_VALUE_HALF_TAN_V2(area, 2, 3),
+ MEAN_VALUE_HALF_TAN_V2(area, 3, 0),
+ };
+
+#undef MEAN_VALUE_HALF_TAN_V2
+
+ w[0] = (t[3] + t[0]) / lens[0];
+ w[1] = (t[0] + t[1]) / lens[1];
+ w[2] = (t[1] + t[2]) / lens[2];
+ w[3] = (t[2] + t[3]) / lens[3];
+
+ wtot = w[0] + w[1] + w[2] + w[3];
+
+ if (wtot != 0.0f) {
+ mul_v4_fl(w, 1.0f / wtot);
+ }
+ else { /* dummy values for zero area face */
+ copy_v4_fl(w, 1.0f / 4.0f);
+ }
+}
+
/* given 2 triangles in 3D space, and a point in relation to the first triangle.
* calculate the location of a point in relation to the second triangle.
* Useful for finding relative positions with geometry */
@@ -2074,7 +2167,7 @@ int interp_sparse_array(float *array, int const list_size, const float skipval)
/* Mean value weights - smooth interpolation weights for polygons with
* more than 3 vertices */
-static float mean_value_half_tan(const float v1[3], const float v2[3], const float v3[3])
+static float mean_value_half_tan_v3(const float v1[3], const float v2[3], const float v3[3])
{
float d2[3], d3[3], cross[3], area, dot, len;
@@ -2086,14 +2179,37 @@ static float mean_value_half_tan(const float v1[3], const float v2[3], const flo
dot = dot_v3v3(d2, d3);
len = len_v3(d2) * len_v3(d3);
- if (area == 0.0f)
+ if (LIKELY(area != 0.0f)) {
+ return (len - dot) / area;
+ }
+ else {
return 0.0f;
- else
+ }
+}
+static float mean_value_half_tan_v2(const float v1[2], const float v2[2], const float v3[2])
+{
+ float d2[2], d3[2], area, dot, len;
+
+ sub_v2_v2v2(d2, v2, v1);
+ sub_v2_v2v2(d3, v3, v1);
+
+ /* different from the 3d version but still correct */
+ area = cross_v2v2(d2, d3);
+
+ dot = dot_v2v2(d2, d3);
+ len = len_v2(d2) * len_v2(d3);
+
+ if (LIKELY(area != 0.0f)) {
return (len - dot) / area;
+ }
+ else {
+ return 0.0f;
+ }
}
void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[3])
{
+ /* TODO: t1 and t2 overlap each iter, we could call this only once per iter and reuse previous value */
float totweight, t1, t2, len, *vmid, *vprev, *vnext;
int i;
@@ -2104,17 +2220,47 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
vprev = (i == 0) ? v[n - 1] : v[i - 1];
vnext = (i == n - 1) ? v[0] : v[i + 1];
- t1 = mean_value_half_tan(co, vprev, vmid);
- t2 = mean_value_half_tan(co, vmid, vnext);
+ t1 = mean_value_half_tan_v3(co, vprev, vmid);
+ t2 = mean_value_half_tan_v3(co, vmid, vnext);
len = len_v3v3(co, vmid);
w[i] = (t1 + t2) / len;
totweight += w[i];
}
- if (totweight != 0.0f)
- for (i = 0; i < n; i++)
+ if (totweight != 0.0f) {
+ for (i = 0; i < n; i++) {
w[i] /= totweight;
+ }
+ }
+}
+
+void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[2])
+{
+ /* TODO: t1 and t2 overlap each iter, we could call this only once per iter and reuse previous value */
+ float totweight, t1, t2, len, *vmid, *vprev, *vnext;
+ int i;
+
+ totweight = 0.0f;
+
+ for (i = 0; i < n; i++) {
+ vmid = v[i];
+ vprev = (i == 0) ? v[n - 1] : v[i - 1];
+ vnext = (i == n - 1) ? v[0] : v[i + 1];
+
+ t1 = mean_value_half_tan_v2(co, vprev, vmid);
+ t2 = mean_value_half_tan_v2(co, vmid, vnext);
+
+ len = len_v2v2(co, vmid);
+ w[i] = (t1 + t2) / len;
+ totweight += w[i];
+ }
+
+ if (totweight != 0.0f) {
+ for (i = 0; i < n; i++) {
+ w[i] /= totweight;
+ }
+ }
}
/* (x1,v1)(t1=0)------(x2,v2)(t2=1), 0<t<1 --> (x,v)(t) */
@@ -2697,7 +2843,7 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight, fl
if (lloc) copy_v3_v3(lloc, accu_com);
if (rloc) copy_v3_v3(rloc, accu_rcom);
if (lrot || lscale) { /* caller does not want rot nor scale, strange but legal */
- /*so now do some reverse engeneering and see if we can split rotation from scale ->Polardecompose*/
+ /*so now do some reverse engineering and see if we can split rotation from scale ->Polardecompose*/
/* build 'projection' matrix */
float m[3][3], mr[3][3], q[3][3], qi[3][3];
float va[3], vb[3], stunt[3];
@@ -3238,3 +3384,10 @@ int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], c
/* linetests, the 2 diagonals have to instersect to be convex */
return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0) ? TRUE : FALSE;
}
+
+int is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
+{
+ /* linetests, the 2 diagonals have to instersect to be convex */
+ return (isect_line_line_v2(v1, v3, v2, v4) > 0) ? TRUE : FALSE;
+}
+
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index f159a6b9d17..3fb3d2b58ff 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1111,7 +1111,7 @@ void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3])
/* rotation & scale are linked, we need to create the mat's
* for these together since they are related. */
- /* so scale doesnt interfear with rotation [#24291] */
+ /* so scale doesn't interfere with rotation [#24291] */
/* note: this is a workaround for negative matrix not working for rotation conversion, FIXME */
normalize_m3_m3(mat3_n, mat3);
if (is_negative_m3(mat3)) {
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index ab5601fc2dc..78f0badc3b1 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -453,7 +453,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
nor[1] = -z2;
nor[2] = y2;
- if (fabs(y2) + fabs(z2) < 0.0001)
+ if (fabsf(y2) + fabsf(z2) < 0.0001f)
nor[1] = 1.0;
co = x2;
@@ -463,7 +463,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
nor[1] = 0.0;
nor[2] = -x2;
- if (fabs(x2) + fabs(z2) < 0.0001)
+ if (fabsf(x2) + fabsf(z2) < 0.0001f)
nor[2] = 1.0;
co = y2;
@@ -473,7 +473,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
nor[1] = x2;
nor[2] = 0.0;
- if (fabs(x2) + fabs(y2) < 0.0001)
+ if (fabsf(x2) + fabsf(y2) < 0.0001f)
nor[0] = 1.0;
co = z2;
@@ -696,7 +696,7 @@ void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
*angle = ha * 2;
/* prevent division by zero for axis conversion */
- if (fabs(si) < 0.0005)
+ if (fabsf(si) < 0.0005f)
si = 1.0f;
axis[0] = q[1] / si;
@@ -998,7 +998,7 @@ void mat3_to_eul(float *eul, float tmat[][3])
mat3_to_eul2(tmat, eul1, eul2);
/* return best, which is just the one with lowest values it in */
- if (fabs(eul1[0]) + fabs(eul1[1]) + fabs(eul1[2]) > fabs(eul2[0]) + fabs(eul2[1]) + fabs(eul2[2])) {
+ if (fabsf(eul1[0]) + fabsf(eul1[1]) + fabsf(eul1[2]) > fabsf(eul2[0]) + fabsf(eul2[1]) + fabsf(eul2[2])) {
copy_v3_v3(eul, eul2);
}
else {
@@ -1083,32 +1083,32 @@ void compatible_eul(float eul[3], const float oldrot[3])
dy = eul[1] - oldrot[1];
dz = eul[2] - oldrot[2];
- while (fabs(dx) > 5.1) {
+ while (fabsf(dx) > 5.1f) {
if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
else eul[0] += 2.0f * (float)M_PI;
dx = eul[0] - oldrot[0];
}
- while (fabs(dy) > 5.1) {
+ while (fabsf(dy) > 5.1f) {
if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
else eul[1] += 2.0f * (float)M_PI;
dy = eul[1] - oldrot[1];
}
- while (fabs(dz) > 5.1) {
+ while (fabsf(dz) > 5.1f) {
if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
else eul[2] += 2.0f * (float)M_PI;
dz = eul[2] - oldrot[2];
}
/* is 1 of the axis rotations larger than 180 degrees and the other small? NO ELSE IF!! */
- if (fabs(dx) > 3.2 && fabs(dy) < 1.6 && fabs(dz) < 1.6) {
+ if (fabsf(dx) > 3.2f && fabsf(dy) < 1.6f && fabsf(dz) < 1.6f) {
if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
else eul[0] += 2.0f * (float)M_PI;
}
- if (fabs(dy) > 3.2 && fabs(dz) < 1.6 && fabs(dx) < 1.6) {
+ if (fabsf(dy) > 3.2f && fabsf(dz) < 1.6f && fabsf(dx) < 1.6f) {
if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
else eul[1] += 2.0f * (float)M_PI;
}
- if (fabs(dz) > 3.2 && fabs(dx) < 1.6 && fabs(dy) < 1.6) {
+ if (fabsf(dz) > 3.2f && fabsf(dx) < 1.6f && fabsf(dy) < 1.6f) {
if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
else eul[2] += 2.0f * (float)M_PI;
}
@@ -1123,29 +1123,29 @@ void compatible_eul(float eul[3], const float oldrot[3])
/* special case, tested for x-z */
- if ((fabs(dx) > 3.1 && fabs(dz) > 1.5) || (fabs(dx) > 1.5 && fabs(dz) > 3.1)) {
- if (dx > 0.0) eul[0] -= M_PI;
+ if ((fabsf(dx) > 3.1f && fabsf(dz) > 1.5f) || (fabsf(dx) > 1.5f && fabsf(dz) > 3.1f)) {
+ if (dx > 0.0f) eul[0] -= M_PI;
else eul[0] += M_PI;
if (eul[1] > 0.0) eul[1] = M_PI - eul[1];
else eul[1] = -M_PI - eul[1];
- if (dz > 0.0) eul[2] -= M_PI;
+ if (dz > 0.0f) eul[2] -= M_PI;
else eul[2] += M_PI;
}
- else if ((fabs(dx) > 3.1 && fabs(dy) > 1.5) || (fabs(dx) > 1.5 && fabs(dy) > 3.1)) {
- if (dx > 0.0) eul[0] -= M_PI;
+ else if ((fabsf(dx) > 3.1f && fabsf(dy) > 1.5f) || (fabsf(dx) > 1.5f && fabsf(dy) > 3.1f)) {
+ if (dx > 0.0f) eul[0] -= M_PI;
else eul[0] += M_PI;
- if (dy > 0.0) eul[1] -= M_PI;
+ if (dy > 0.0f) eul[1] -= M_PI;
else eul[1] += M_PI;
- if (eul[2] > 0.0) eul[2] = M_PI - eul[2];
+ if (eul[2] > 0.0f) eul[2] = M_PI - eul[2];
else eul[2] = -M_PI - eul[2];
}
- else if ((fabs(dy) > 3.1 && fabs(dz) > 1.5) || (fabs(dy) > 1.5 && fabs(dz) > 3.1)) {
- if (eul[0] > 0.0) eul[0] = M_PI - eul[0];
+ else if ((fabsf(dy) > 3.1f && fabsf(dz) > 1.5f) || (fabsf(dy) > 1.5f && fabsf(dz) > 3.f1)) {
+ if (eul[0] > 0.0f) eul[0] = M_PI - eul[0];
else eul[0] = -M_PI - eul[0];
- if (dy > 0.0) eul[1] -= M_PI;
+ if (dy > 0.0f) eul[1] -= M_PI;
else eul[1] += M_PI;
- if (dz > 0.0) eul[2] -= M_PI;
+ if (dz > 0.0f) eul[2] -= M_PI;
else eul[2] += M_PI;
}
#endif
@@ -1164,8 +1164,8 @@ void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[][3])
compatible_eul(eul1, oldrot);
compatible_eul(eul2, oldrot);
- d1 = (float)fabs(eul1[0] - oldrot[0]) + (float)fabs(eul1[1] - oldrot[1]) + (float)fabs(eul1[2] - oldrot[2]);
- d2 = (float)fabs(eul2[0] - oldrot[0]) + (float)fabs(eul2[1] - oldrot[1]) + (float)fabs(eul2[2] - oldrot[2]);
+ d1 = fabsf(eul1[0] - oldrot[0]) + fabsf(eul1[1] - oldrot[1]) + fabsf(eul1[2] - oldrot[2]);
+ d2 = fabsf(eul2[0] - oldrot[0]) + fabsf(eul2[1] - oldrot[1]) + fabsf(eul2[2] - oldrot[2]);
/* return best, which is just the one with lowest difference */
if (d1 > d2) {
@@ -1360,7 +1360,7 @@ void mat3_to_eulO(float eul[3], const short order, float M[3][3])
mat3_to_eulo2(M, eul1, eul2, order);
/* return best, which is just the one with lowest values it in */
- if (fabs(eul1[0]) + fabs(eul1[1]) + fabs(eul1[2]) > fabs(eul2[0]) + fabs(eul2[1]) + fabs(eul2[2])) {
+ if (fabsf(eul1[0]) + fabsf(eul1[1]) + fabsf(eul1[2]) > fabsf(eul2[0]) + fabsf(eul2[1]) + fabsf(eul2[2])) {
copy_v3_v3(eul, eul2);
}
else {
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index e89b2ece467..177c099d647 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -521,7 +521,7 @@ MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
}
/* Newell's Method */
-/* excuse this fairly spesific function,
+/* excuse this fairly specific function,
* its used for polygon normals all over the place
* could use a better name */
MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3])
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 859bb66073c..bd83c5e018c 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -1130,7 +1130,7 @@ static float turbulencep(float noisesize, float x, float y, float z, int nr)
/* VORONOI/WORLEY */
/******************/
-/* distance metrics for voronoi, e parameter only used in Minkovsky */
+/* distance metrics for voronoi, e parameter only used in Minkowski */
/* Camberra omitted, didn't seem useful */
/* distance squared */
@@ -1161,7 +1161,7 @@ static float dist_Chebychev(float x, float y, float z, float e)
return ((z > t) ? z : t);
}
-/* minkovsky preset exponent 0.5 */
+/* minkowski preset exponent 0.5 */
static float dist_MinkovskyH(float x, float y, float z, float e)
{
float d = sqrtf(fabsf(x)) + sqrtf(fabsf(y)) + sqrtf(fabsf(z));
@@ -1169,7 +1169,7 @@ static float dist_MinkovskyH(float x, float y, float z, float e)
return (d * d);
}
-/* minkovsky preset exponent 4 */
+/* minkowski preset exponent 4 */
static float dist_Minkovsky4(float x, float y, float z, float e)
{
(void)e;
@@ -1179,7 +1179,7 @@ static float dist_Minkovsky4(float x, float y, float z, float e)
return sqrtf(sqrtf(x * x + y * y + z * z));
}
-/* Minkovsky, general case, slow, maybe too slow to be useful */
+/* Minkowski, general case, slow, maybe too slow to be useful */
static float dist_Minkovsky(float x, float y, float z, float e)
{
return powf(powf(fabsf(x), e) + powf(fabsf(y), e) + powf(fabsf(z), e), 1.0f / e);
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index c85efc1fd9a..22b160ad0b4 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1552,7 +1552,7 @@ char *BLI_path_basename(char *path)
* 0 if image filename is empty or if destination path
* matches image path (i.e. both are the same file).
* 2 if source is identical to destination.
- * 1 if rebase was successfull
+ * 1 if rebase was successful
* -------------------------------------------------------------
* Hint: Trailing slash in dest_dir is optional.
*
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index b36c3c717c0..658d45ad171 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -35,20 +35,30 @@
#include <stdio.h>
#include <math.h>
+#include <limits.h>
+#include <float.h>
+
#include "DNA_vec_types.h"
#include "BLI_rect.h"
-int BLI_rcti_is_empty(rcti *rect)
+/**
+ * Determine if a rect is empty. An empty
+ * rect is one with a zero (or negative)
+ * width or height.
+ *
+ * \return True if \a rect is empty.
+ */
+int BLI_rcti_is_empty(const rcti *rect)
{
return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
}
-int BLI_rctf_is_empty(rctf *rect)
+int BLI_rctf_is_empty(const rctf *rect)
{
return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
}
-int BLI_in_rcti(rcti *rect, int x, int y)
+int BLI_in_rcti(const rcti *rect, const int x, const int y)
{
if (x < rect->xmin) return 0;
if (x > rect->xmax) return 0;
@@ -57,7 +67,23 @@ int BLI_in_rcti(rcti *rect, int x, int y)
return 1;
}
-int BLI_in_rctf(rctf *rect, float x, float y)
+/**
+ * Determine if a rect is empty. An empty
+ * rect is one with a zero (or negative)
+ * width or height.
+ *
+ * \return True if \a rect is empty.
+ */
+int BLI_in_rcti_v(const rcti *rect, const int xy[2])
+{
+ if (xy[0] < rect->xmin) return 0;
+ if (xy[0] > rect->xmax) return 0;
+ if (xy[1] < rect->ymin) return 0;
+ if (xy[1] > rect->ymax) return 0;
+ return 1;
+}
+
+int BLI_in_rctf(const rctf *rect, const float x, const float y)
{
if (x < rect->xmin) return 0;
if (x > rect->xmax) return 0;
@@ -66,6 +92,15 @@ int BLI_in_rctf(rctf *rect, float x, float y)
return 1;
}
+int BLI_in_rctf_v(const rctf *rect, const float xy[2])
+{
+ if (xy[0] < rect->xmin) return 0;
+ if (xy[0] > rect->xmax) return 0;
+ if (xy[1] < rect->ymin) return 0;
+ if (xy[1] > rect->ymax) return 0;
+ return 1;
+}
+
/* based closely on 'isect_line_line_v2_int', but in modified so corner cases are treated as intersections */
static int isect_segments(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
{
@@ -80,7 +115,7 @@ static int isect_segments(const int v1[2], const int v2[2], const int v3[2], con
}
}
-int BLI_segment_in_rcti(rcti *rect, int s1[2], int s2[2])
+int BLI_rcti_isect_segment(const rcti *rect, const int s1[2], const int s2[2])
{
/* first do outside-bounds check for both points of the segment */
if (s1[0] < rect->xmin && s2[0] < rect->xmin) return 0;
@@ -89,7 +124,7 @@ int BLI_segment_in_rcti(rcti *rect, int s1[2], int s2[2])
if (s1[1] > rect->ymax && s2[1] > rect->ymax) return 0;
/* if either points intersect then we definetly intersect */
- if (BLI_in_rcti(rect, s1[0], s1[1]) || BLI_in_rcti(rect, s2[0], s2[1])) {
+ if (BLI_in_rcti_v(rect, s1) || BLI_in_rcti_v(rect, s2)) {
return 1;
}
else {
@@ -115,7 +150,7 @@ int BLI_segment_in_rcti(rcti *rect, int s1[2], int s2[2])
}
}
-void BLI_union_rctf(rctf *rct1, rctf *rct2)
+void BLI_rctf_union(rctf *rct1, const rctf *rct2)
{
if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
@@ -123,7 +158,7 @@ void BLI_union_rctf(rctf *rct1, rctf *rct2)
if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
}
-void BLI_union_rcti(rcti *rct1, rcti *rct2)
+void BLI_rcti_union(rcti *rct1, const rcti *rct2)
{
if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
@@ -131,7 +166,7 @@ void BLI_union_rcti(rcti *rct1, rcti *rct2)
if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
}
-void BLI_init_rctf(rctf *rect, float xmin, float xmax, float ymin, float ymax)
+void BLI_rctf_init(rctf *rect, float xmin, float xmax, float ymin, float ymax)
{
if (xmin <= xmax) {
rect->xmin = xmin;
@@ -151,7 +186,7 @@ void BLI_init_rctf(rctf *rect, float xmin, float xmax, float ymin, float ymax)
}
}
-void BLI_init_rcti(rcti *rect, int xmin, int xmax, int ymin, int ymax)
+void BLI_rcti_init(rcti *rect, int xmin, int xmax, int ymin, int ymax)
{
if (xmin <= xmax) {
rect->xmin = xmin;
@@ -171,14 +206,42 @@ void BLI_init_rcti(rcti *rect, int xmin, int xmax, int ymin, int ymax)
}
}
-void BLI_translate_rcti(rcti *rect, int x, int y)
+void BLI_rcti_init_minmax(struct rcti *rect)
+{
+ rect->xmin = rect->ymin = INT_MAX;
+ rect->xmax = rect->ymax = INT_MIN;
+}
+
+void BLI_rctf_init_minmax(struct rctf *rect)
+{
+ rect->xmin = rect->ymin = FLT_MAX;
+ rect->xmax = rect->ymax = FLT_MIN;
+}
+
+void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2])
+{
+ if (xy[0] < rect->xmin) rect->xmin = xy[0];
+ if (xy[0] > rect->xmax) rect->xmax = xy[0];
+ if (xy[1] < rect->ymin) rect->ymin = xy[1];
+ if (xy[1] > rect->ymax) rect->ymax = xy[1];
+}
+
+void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2])
+{
+ if (xy[0] < rect->xmin) rect->xmin = xy[0];
+ if (xy[0] > rect->xmax) rect->xmax = xy[0];
+ if (xy[1] < rect->ymin) rect->ymin = xy[1];
+ if (xy[1] > rect->ymax) rect->ymax = xy[1];
+}
+
+void BLI_rcti_translate(rcti *rect, int x, int y)
{
rect->xmin += x;
rect->ymin += y;
rect->xmax += x;
rect->ymax += y;
}
-void BLI_translate_rctf(rctf *rect, float x, float y)
+void BLI_rctf_translate(rctf *rect, float x, float y)
{
rect->xmin += x;
rect->ymin += y;
@@ -187,7 +250,7 @@ void BLI_translate_rctf(rctf *rect, float x, float y)
}
/* change width & height around the central location */
-void BLI_resize_rcti(rcti *rect, int x, int y)
+void BLI_rcti_resize(rcti *rect, int x, int y)
{
rect->xmin = rect->xmax = (rect->xmax + rect->xmin) / 2;
rect->ymin = rect->ymax = (rect->ymax + rect->ymin) / 2;
@@ -197,7 +260,7 @@ void BLI_resize_rcti(rcti *rect, int x, int y)
rect->ymax = rect->ymin + y;
}
-void BLI_resize_rctf(rctf *rect, float x, float y)
+void BLI_rctf_resize(rctf *rect, float x, float y)
{
rect->xmin = rect->xmax = (rect->xmax + rect->xmin) * 0.5f;
rect->ymin = rect->ymax = (rect->ymax + rect->ymin) * 0.5f;
@@ -207,7 +270,7 @@ void BLI_resize_rctf(rctf *rect, float x, float y)
rect->ymax = rect->ymin + y;
}
-int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
+int BLI_rctf_isect(const rctf *src1, const rctf *src2, rctf *dest)
{
float xmin, xmax;
float ymin, ymax;
@@ -237,7 +300,7 @@ int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
}
}
-int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
+int BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest)
{
int xmin, xmax;
int ymin, ymax;
@@ -267,21 +330,21 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
}
}
-void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
+void BLI_rcti_rctf_copy(rcti *tar, const rctf *src)
{
- tar->xmin = floor(src->xmin + 0.5f);
- tar->xmax = floor((src->xmax - src->xmin) + 0.5f);
- tar->ymin = floor(src->ymin + 0.5f);
- tar->ymax = floor((src->ymax - src->ymin) + 0.5f);
+ tar->xmin = floorf(src->xmin + 0.5f);
+ tar->xmax = floorf((src->xmax - src->xmin) + 0.5f);
+ tar->ymin = floorf(src->ymin + 0.5f);
+ tar->ymax = floorf((src->ymax - src->ymin) + 0.5f);
}
-void print_rctf(const char *str, rctf *rect)
+void print_rctf(const char *str, const rctf *rect)
{
printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str,
rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
}
-void print_rcti(const char *str, rcti *rect)
+void print_rcti(const char *str, const rcti *rect)
{
printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str,
rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index d86d151b1ef..7a750a74a33 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -168,8 +168,10 @@ escape_finish:
*
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
* data we want...
+ *
+ * TODO, return the offset and a length so as to avoid doing an allocation.
*/
-char *BLI_getQuotedStr(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *str, const char *prefix)
{
size_t prefixLen = strlen(prefix);
char *startMatch, *endMatch;
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 348fa29eae7..9994f89acd5 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -106,7 +106,7 @@ static void *thread_tls_data;
************************************************ */
static pthread_mutex_t _malloc_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _image_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t _preview_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t _image_draw_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _viewer_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _rcache_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -337,8 +337,8 @@ void BLI_lock_thread(int type)
{
if (type == LOCK_IMAGE)
pthread_mutex_lock(&_image_lock);
- else if (type == LOCK_PREVIEW)
- pthread_mutex_lock(&_preview_lock);
+ else if (type == LOCK_DRAW_IMAGE)
+ pthread_mutex_lock(&_image_draw_lock);
else if (type == LOCK_VIEWER)
pthread_mutex_lock(&_viewer_lock);
else if (type == LOCK_CUSTOM1)
@@ -357,8 +357,8 @@ void BLI_unlock_thread(int type)
{
if (type == LOCK_IMAGE)
pthread_mutex_unlock(&_image_lock);
- else if (type == LOCK_PREVIEW)
- pthread_mutex_unlock(&_preview_lock);
+ else if (type == LOCK_DRAW_IMAGE)
+ pthread_mutex_unlock(&_image_draw_lock);
else if (type == LOCK_VIEWER)
pthread_mutex_unlock(&_viewer_lock);
else if (type == LOCK_CUSTOM1)
diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c
index eeb0187b74c..dc76fb1493d 100644
--- a/source/blender/blenlib/intern/voronoi.c
+++ b/source/blender/blenlib/intern/voronoi.c
@@ -39,7 +39,7 @@
#include "BLI_voronoi.h"
#include "BLI_utildefines.h"
-#define VORONOI_EPS 1e-3
+#define VORONOI_EPS 1e-2
enum {
voronoiEventType_Site = 0,
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index d33a8a082f4..da6fc6b1a0b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -255,7 +255,7 @@ static void convert_tface_mt(FileData *fd, Main *main);
* in the case of libraray linking errors this is important!
*
* bit kludge but better then doubling up on prints,
- * we could alternatively have a versions of a report function which foces printing - campbell
+ * we could alternatively have a versions of a report function which forces printing - campbell
*/
static void BKE_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...)
{
@@ -3688,7 +3688,14 @@ static void lib_link_mesh(FileData *fd, Main *main)
G.main = gmain;
}
-
+ }
+ }
+
+ /* convert texface options to material */
+ convert_tface_mt(fd, main);
+
+ for (me = main->mesh.first; me; me = me->id.next) {
+ if (me->id.flag & LIB_NEEDLINK) {
/*
* Re-tessellate, even if the polys were just created from tessfaces, this
* is important because it:
@@ -3704,13 +3711,10 @@ static void lib_link_mesh(FileData *fd, Main *main)
#else
BKE_mesh_tessface_clear(me);
#endif
-
+
me->id.flag -= LIB_NEEDLINK;
}
}
-
- /* convert texface options to material */
- convert_tface_mt(fd, main);
}
static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
@@ -5916,7 +5920,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
}
else if (sl->spacetype == SPACE_SEQ) {
/* grease pencil data is not a direct data and can't be linked from direct_link*
- * functions, it should be linked from lib_link* funcrions instead
+ * functions, it should be linked from lib_link* functions instead
*
* otherwise it'll lead to lost grease data on open because it'll likely be
* read from file after all other users of grease pencil and newdataadr would
@@ -5945,7 +5949,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
//for (cl= sconsole->scrollback.first; cl; cl= cl->next)
// cl->line= newdataadr(fd, cl->line);
- /* comma expressions, (e.g. expr1, expr2, expr3) evalutate each expression,
+ /* comma expressions, (e.g. expr1, expr2, expr3) evaluate each expression,
* from left to right. the right-most expression sets the result of the comma
* expression as a whole*/
for (cl = sconsole->history.first; cl; cl = cl_next) {
@@ -7012,6 +7016,21 @@ static void do_version_ntree_dilateerode_264(void *UNUSED(data), ID *UNUSED(id),
}
}
+static void do_version_ntree_keying_despill_balance(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
+{
+ bNode *node;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_KEYING) {
+ NodeKeyingData *data = node->storage;
+
+ if (data->despill_balance == 0.0f) {
+ data->despill_balance = 0.5f;
+ }
+ }
+ }
+}
+
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -7826,6 +7845,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ntreetype->foreach_nodetree(main, NULL, do_version_ntree_dilateerode_264);
}
+ if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 14)) {
+ bNodeTreeType *ntreetype = ntreeGetType(NTREE_COMPOSIT);
+
+ if (ntreetype && ntreetype->foreach_nodetree)
+ ntreetype->foreach_nodetree(main, NULL, do_version_ntree_keying_despill_balance);
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
@@ -8149,7 +8175,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
* This line is NEEDED, the case is that you have 3 blend files...
* user.blend, lib.blend and lib_indirect.blend - if user.blend already references a "tree" from
* lib_indirect.blend but lib.blend does too, linking in a Scene or Group from lib.blend can result in an
- * empty without the dupli group referenced. Once you save and reload the group would appier. - Campbell */
+ * empty without the dupli group referenced. Once you save and reload the group would appear. - Campbell */
/* This crashes files, must look further into it */
/* Update: the issue is that in file reading, the oldnewmap is OK, but for existing data, it has to be
@@ -8498,7 +8524,6 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
{
CustomDataLayer *layer;
- MTFace *mtf;
TFace *tf;
int a, i;
@@ -8520,14 +8545,34 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
}
}
- for (a = 0; a < me->fdata.totlayer; a++) {
- layer = &me->fdata.layers[a];
-
- if (layer->type == CD_MTFACE) {
- mtf = (MTFace*)layer->data;
- for (i = 0; i < me->totface; i++, mtf++) {
- if (mtf->tpage)
- expand_doit(fd, mainvar, mtf->tpage);
+ if (me->mface && !me->mpoly) {
+ MTFace *mtf;
+
+ for (a = 0; a < me->fdata.totlayer; a++) {
+ layer = &me->fdata.layers[a];
+
+ if (layer->type == CD_MTFACE) {
+ mtf = (MTFace *) layer->data;
+ for (i = 0; i < me->totface; i++, mtf++) {
+ if (mtf->tpage)
+ expand_doit(fd, mainvar, mtf->tpage);
+ }
+ }
+ }
+ }
+ else {
+ MTexPoly *mtp;
+
+ for (a = 0; a < me->pdata.totlayer; a++) {
+ layer = &me->pdata.layers[a];
+
+ if (layer->type == CD_MTEXPOLY) {
+ mtp = (MTexPoly *) layer->data;
+
+ for (i = 0; i < me->totpoly; i++, mtp++) {
+ if (mtp->tpage)
+ expand_doit(fd, mainvar, mtp->tpage);
+ }
}
}
}
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 737efde8391..3bd99b748f6 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -198,8 +198,6 @@ typedef struct BMesh {
ListBase errorstack;
void *py_handle;
-
- int opflag; /* current operator flag */
} BMesh;
/* BMHeader->htype (char) */
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index a51d6bd2940..8c5adb3cceb 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -92,7 +92,7 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example)
* \brief Main function for creating a new edge.
*
* \note Duplicate edges are supported by the API however users should _never_ see them.
- * so unless you need a unique edge or know the edge won't exist, you should call wih \a nodouble = TRUE
+ * so unless you need a unique edge or know the edge won't exist, you should call with \a nodouble = TRUE
*/
BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble)
{
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
index 59817043eed..d16dacaf5cf 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -71,7 +71,7 @@ static void recount_totsels(BMesh *bm)
* (ie: all verts of an edge selects the edge and so on).
* This should only be called by system and not tool authors.
*/
-void BM_mesh_select_mode_flush(BMesh *bm)
+void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode)
{
BMEdge *e;
BMLoop *l_iter;
@@ -83,7 +83,7 @@ void BM_mesh_select_mode_flush(BMesh *bm)
int ok;
- if (bm->selectmode & SCE_SELECT_VERTEX) {
+ if (selectmode & SCE_SELECT_VERTEX) {
BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e->v1, BM_ELEM_SELECT) &&
BM_elem_flag_test(e->v2, BM_ELEM_SELECT) &&
@@ -113,7 +113,7 @@ void BM_mesh_select_mode_flush(BMesh *bm)
BM_elem_flag_set(f, BM_ELEM_SELECT, ok);
}
}
- else if (bm->selectmode & SCE_SELECT_EDGE) {
+ else if (selectmode & SCE_SELECT_EDGE) {
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
ok = TRUE;
if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
@@ -139,6 +139,11 @@ void BM_mesh_select_mode_flush(BMesh *bm)
recount_totsels(bm);
}
+void BM_mesh_select_mode_flush(BMesh *bm)
+{
+ BM_mesh_select_mode_flush_ex(bm, bm->selectmode);
+}
+
/**
* mode independent flushing up/down
*/
@@ -880,7 +885,7 @@ void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hfla
/* note, better not attempt a fast path for selection as done with de-select
* because hidden geometry and different selection modes can give different results,
- * we could of course check for no hiddent faces and then use quicker method but its not worth it. */
+ * we could of course check for no hidden faces and then use quicker method but its not worth it. */
for (i = 0; i < 3; i++) {
if (htype & flag_types[i]) {
diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h
index 406971652dc..9b73ed2c390 100644
--- a/source/blender/bmesh/intern/bmesh_marking.h
+++ b/source/blender/bmesh/intern/bmesh_marking.h
@@ -60,6 +60,7 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select);
void BM_face_select_set(BMesh *bm, BMFace *f, int select);
void BM_mesh_select_mode_set(BMesh *bm, int selectmode);
+void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode);
void BM_mesh_select_mode_flush(BMesh *bm);
void BM_mesh_deselect_flush(BMesh *bm);
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 385572cceff..cf593627e8d 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -290,47 +290,6 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden)
MEM_freeN(edgevec);
}
-/*
- * This function ensures correct normals for the mesh, but
- * sets the flag BM_ELEM_TAG in flipped faces, to allow restoration
- * of original normals.
- *
- * if undo is 0: calculate right normals
- * if undo is 1: restore original normals
- */
-
-//keep in sycn with utils.c!
-#define FACE_FLIP 8
-static void bm_rationalize_normals(BMesh *bm, int undo)
-{
- BMOperator bmop;
- BMFace *f;
- BMIter iter;
-
- if (undo) {
- BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
- if (BM_elem_flag_test(f, BM_ELEM_TAG)) {
- BM_face_normal_flip(bm, f);
- }
- BM_elem_flag_disable(f, BM_ELEM_TAG);
- }
-
- return;
- }
-
- BMO_op_initf(bm, &bmop, "recalc_face_normals faces=%af do_flip=%b", FALSE);
-
- BMO_push(bm, &bmop);
- bmo_recalc_face_normals_exec(bm, &bmop);
-
- BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
- BM_elem_flag_set(f, BM_ELEM_TAG, BMO_elem_flag_test(bm, f, FACE_FLIP));
- }
-
- BMO_pop(bm);
- BMO_op_finish(bm, &bmop);
-}
-
static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from, int to)
{
/* switch multires data out of tangent space */
@@ -390,10 +349,8 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from
* the editing operations are done. These are called by the tools/operator
* API for each time a tool is executed.
*/
-void bmesh_edit_begin(BMesh *bm, int flag)
+void bmesh_edit_begin(BMesh *UNUSED(bm), int UNUSED(type_flag))
{
- bm->opflag = flag;
-
/* Most operators seem to be using BMO_OP_FLAG_UNTAN_MULTIRES to change the MDisps to
* absolute space during mesh edits. With this enabled, changes to the topology
* (loop cuts, edge subdivides, etc) are not reflected in the higher levels of
@@ -401,27 +358,20 @@ void bmesh_edit_begin(BMesh *bm, int flag)
* until this is shown to be better for certain types of mesh edits. */
#if BMOP_UNTAN_MULTIRES_ENABLED
/* switch multires data out of tangent space */
- if ((flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
+ if ((type_flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
bmesh_mdisps_space_set(bm, MULTIRES_SPACE_TANGENT, MULTIRES_SPACE_ABSOLUTE);
/* ensure correct normals, if possible */
bmesh_rationalize_normals(bm, 0);
BM_mesh_normals_update(bm);
}
- else if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
- bmesh_rationalize_normals(bm, 0);
- }
-#else
- if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
- bm_rationalize_normals(bm, 0);
- }
#endif
}
/**
* \brief BMesh End Edit
*/
-void bmesh_edit_end(BMesh *bm, int flag)
+void bmesh_edit_end(BMesh *bm, int UNUSED(flag))
{
/* BMO_OP_FLAG_UNTAN_MULTIRES disabled for now, see comment above in bmesh_edit_begin. */
#if BMOP_UNTAN_MULTIRES_ENABLED
@@ -434,14 +384,8 @@ void bmesh_edit_end(BMesh *bm, int flag)
else if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
bmesh_rationalize_normals(bm, 1);
}
-#else
- if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
- bm_rationalize_normals(bm, 1);
- }
#endif
- bm->opflag = 0;
-
/* compute normals, clear temp flags and flush selections */
BM_mesh_normals_update(bm, TRUE);
BM_mesh_select_mode_flush(bm);
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index 0441f38b429..8b6ef9aa3e0 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -37,8 +37,8 @@ void BM_mesh_clear(BMesh *bm);
void BM_mesh_normals_update(BMesh *bm, const short skip_hidden);
-void bmesh_edit_begin(BMesh *bm, int flag);
-void bmesh_edit_end(BMesh *bm, int flag);
+void bmesh_edit_begin(BMesh *bm, int type_flag);
+void bmesh_edit_end(BMesh *bm, int type_flag);
void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag);
void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func,
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index 74087c00940..a2f14ef8388 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -135,13 +135,19 @@ typedef struct BMOpSlot {
typedef struct BMOperator {
int type;
int slot_type;
- int needflag;
- int flag;
+ int type_flag;
+ int flag; /* runtime options */
struct BMOpSlot slot_args[BMO_OP_MAX_SLOTS];
void (*exec)(BMesh *bm, struct BMOperator *op);
struct MemArena *arena;
} BMOperator;
+enum {
+ BMO_FLAG_RESPECT_HIDE = 1,
+};
+
+#define BMO_FLAG_DEFAULTS BMO_FLAG_RESPECT_HIDE
+
#define MAX_SLOTNAME 32
typedef struct BMOSlotType {
@@ -153,17 +159,13 @@ typedef struct BMOpDefine {
const char *name;
BMOSlotType slot_types[BMO_OP_MAX_SLOTS];
void (*exec)(BMesh *bm, BMOperator *op);
- int flag;
+ int type_flag;
} BMOpDefine;
-/* BMOpDefine->flag */
-#define BMO_OP_FLAG_UNTAN_MULTIRES 1 /*switch from multires tangent space to absolute coordinates*/
-
-/* ensures consistent normals before operator execution,
- * restoring the original ones windings/normals afterwards.
- * keep in mind, this won't work if the input mesh isn't
- * manifold.*/
-#define BMO_OP_FLAG_RATIONALIZE_NORMALS 2
+/* BMOpDefine->type_flag */
+enum {
+ BMO_OP_FLAG_UNTAN_MULTIRES = 1 /*switch from multires tangent space to absolute coordinates*/
+};
/*------------- Operator API --------------*/
@@ -171,7 +173,7 @@ typedef struct BMOpDefine {
* have it set directly. and never use BMO_slot_ptr_set to
* pass in a list of edges or any arrays, really.*/
-void BMO_op_init(BMesh *bm, BMOperator *op, const char *opname);
+void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname);
/* executes an operator, pushing and popping a new tool flag
* layer as appropriate.*/
@@ -194,7 +196,7 @@ int BMO_mesh_disabled_flag_count(BMesh *bm, const char htype, const short oflag)
* this system is used to execute or initialize an operator,
* using a formatted-string system.
*
- * for example, BMO_op_callf(bm, "delete geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES);
+ * for example, BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES);
* . . .will execute the delete operator, feeding in selected faces, deleting them.
*
* the basic format for the format string is:
@@ -231,16 +233,16 @@ void BMO_push(BMesh *bm, BMOperator *op);
void BMO_pop(BMesh *bm);
/*executes an operator*/
-int BMO_op_callf(BMesh *bm, const char *fmt, ...);
+int BMO_op_callf(BMesh *bm, const int flag, const char *fmt, ...);
/* initializes, but doesn't execute an operator. this is so you can
* gain access to the outputs of the operator. note that you have
- * to execute/finitsh (BMO_op_exec and BMO_op_finish) yourself. */
-int BMO_op_initf(BMesh *bm, BMOperator *op, const char *fmt, ...);
+ * to execute/finish (BMO_op_exec and BMO_op_finish) yourself. */
+int BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...);
/* va_list version, used to implement the above two functions,
* plus EDBM_op_callf in editmesh_utils.c. */
-int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *fmt, va_list vlist);
+int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, va_list vlist);
/* test whether a named slot exists */
int BMO_slot_exists(BMOperator *op, const char *slot_name);
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 5447e6b5a55..0f2dc7041fa 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -126,7 +126,7 @@ void BMO_pop(BMesh *bm)
*
* Initializes an operator structure to a certain type
*/
-void BMO_op_init(BMesh *bm, BMOperator *op, const char *opname)
+void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
{
int i, opcode = bmo_opname_to_opcode(opname);
@@ -142,7 +142,8 @@ void BMO_op_init(BMesh *bm, BMOperator *op, const char *opname)
memset(op, 0, sizeof(BMOperator));
op->type = opcode;
- op->flag = opdefines[opcode]->flag;
+ op->type_flag = opdefines[opcode]->type_flag;
+ op->flag = flag;
/* initialize the operator slot types */
for (i = 0; opdefines[opcode]->slot_types[i].type; i++) {
@@ -173,11 +174,11 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
BMO_push(bm, op);
if (bm->stackdepth == 2)
- bmesh_edit_begin(bm, op->flag);
+ bmesh_edit_begin(bm, op->type_flag);
op->exec(bm, op);
if (bm->stackdepth == 2)
- bmesh_edit_end(bm, op->flag);
+ bmesh_edit_end(bm, op->type_flag);
BMO_pop(bm);
}
@@ -697,13 +698,14 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
{
BMOpSlot *output = BMO_slot_get(op, slot_name);
int totelement = 0, i = 0;
+ const int respecthide = (op->flag & BMO_FLAG_RESPECT_HIDE) != 0;
BLI_assert(ELEM(test_for_enabled, TRUE, FALSE));
if (test_for_enabled)
- totelement = BM_mesh_elem_hflag_count_enabled(bm, htype, hflag, TRUE);
+ totelement = BM_mesh_elem_hflag_count_enabled(bm, htype, hflag, respecthide);
else
- totelement = BM_mesh_elem_hflag_count_disabled(bm, htype, hflag, TRUE);
+ totelement = BM_mesh_elem_hflag_count_disabled(bm, htype, hflag, respecthide);
if (totelement) {
BMIter iter;
@@ -715,7 +717,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
if (htype & BM_VERT) {
BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
- if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) &&
+ if ((!respecthide || !BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) &&
BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
{
((BMElem **)output->data.p)[i] = ele;
@@ -726,7 +728,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
if (htype & BM_EDGE) {
BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
- if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) &&
+ if ((!respecthide || !BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) &&
BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
{
((BMElem **)output->data.p)[i] = ele;
@@ -737,7 +739,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
if (htype & BM_FACE) {
BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
- if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) &&
+ if ((!respecthide || !BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) &&
BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
{
((BMElem **)output->data.p)[i] = ele;
@@ -1320,7 +1322,7 @@ static int bmo_opname_to_opcode(const char *opname)
}
/* Example:
- * BMO_op_callf(bm, "delete %i %hv", DEL_ONLYFACES, BM_ELEM_SELECT);
+ * BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete %i %hv", DEL_ONLYFACES, BM_ELEM_SELECT);
*
* i - int
* b - boolean (same as int but 1/0 only)
@@ -1336,7 +1338,7 @@ static int bmo_opname_to_opcode(const char *opname)
* Hv, He, Hf, Fv, Fe, Ff,
*/
-int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
+int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, va_list vlist)
{
BMOpDefine *def;
char *opname, *ofmt, *fmt;
@@ -1376,7 +1378,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
return FALSE;
}
- BMO_op_init(bm, op, opname);
+ BMO_op_init(bm, op, flag, opname);
def = opdefines[i];
i = 0;
@@ -1556,12 +1558,12 @@ error:
}
-int BMO_op_initf(BMesh *bm, BMOperator *op, const char *fmt, ...)
+int BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...)
{
va_list list;
va_start(list, fmt);
- if (!BMO_op_vinitf(bm, op, fmt, list)) {
+ if (!BMO_op_vinitf(bm, op, flag, fmt, list)) {
printf("%s: failed\n", __func__);
va_end(list);
return FALSE;
@@ -1571,13 +1573,13 @@ int BMO_op_initf(BMesh *bm, BMOperator *op, const char *fmt, ...)
return TRUE;
}
-int BMO_op_callf(BMesh *bm, const char *fmt, ...)
+int BMO_op_callf(BMesh *bm, const int flag, const char *fmt, ...)
{
va_list list;
BMOperator op;
va_start(list, fmt);
- if (!BMO_op_vinitf(bm, &op, fmt, list)) {
+ if (!BMO_op_vinitf(bm, &op, flag, fmt, list)) {
printf("%s: failed, format is:\n \"%s\"\n", __func__, fmt);
va_end(list);
return FALSE;
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 6b9abfb3e20..03b72aefee6 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -712,7 +712,7 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
}
}
/* Last check we do not get overlapping triangles
- * (as much as possible, ther are some cases with no good solution!) */
+ * (as much as possible, there are some cases with no good solution!) */
i4 = (i + 3) % 4;
if (!bm_face_goodline((float const (*)[3])verts, f, BM_elem_index_get(larr[i4]->v),
BM_elem_index_get(larr[i]->v), BM_elem_index_get(larr[i + 1]->v)))
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index f22c25766df..10ea21291db 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -712,7 +712,7 @@ BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
*
* Finds the loop used which uses \a v in face loop \a l
*
- * \note currenly this just uses simple loop in future may be speeded up
+ * \note currently this just uses simple loop in future may be sped up
* using radial vars
*/
BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v)
@@ -735,7 +735,7 @@ BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v)
*
* Finds the loop used which uses \a e in face loop \a l
*
- * \note currenly this just uses simple loop in future may be speeded up
+ * \note currently this just uses simple loop in future may be sped up
* using radial vars
*/
BMLoop *BM_face_edge_share_loop(BMFace *f, BMEdge *e)
@@ -794,7 +794,7 @@ float BM_loop_calc_face_angle(BMLoop *l)
/**
* \brief BM_loop_calc_face_normal
*
- * Calculate the normal at this loop corner or fallback to the face normal on straignt lines.
+ * Calculate the normal at this loop corner or fallback to the face normal on straight lines.
*
* \param bm The BMesh
* \param l The loop to calculate the normal at
@@ -817,7 +817,7 @@ void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3])
/**
* \brief BM_loop_calc_face_tangent
*
- * Calculate the tangent at this loop corner or fallback to the face normal on straignt lines.
+ * Calculate the tangent at this loop corner or fallback to the face normal on straight lines.
* This vector always points inward into the face.
*
* \param bm The BMesh
@@ -873,7 +873,7 @@ float BM_edge_calc_face_angle(BMEdge *e)
/**
* \brief BMESH EDGE/FACE TANGENT
*
- * Calculate the tangent at this loop corner or fallback to the face normal on straignt lines.
+ * Calculate the tangent at this loop corner or fallback to the face normal on straight lines.
* This vector always points inward into the face.
*
* \brief BM_edge_calc_face_tangent
diff --git a/source/blender/bmesh/intern/bmesh_structure.h b/source/blender/bmesh/intern/bmesh_structure.h
index 8b43f72c725..b19df4660b8 100644
--- a/source/blender/bmesh/intern/bmesh_structure.h
+++ b/source/blender/bmesh/intern/bmesh_structure.h
@@ -34,7 +34,7 @@
* The lowest level of functionality for manipulating bmesh structures.
* None of these functions should ever be exported to the rest of Blender.
*
- * in the vast majority of cases thes should not be used directly.
+ * in the vast majority of cases there shouldn't be used directly.
* if absolutely necessary, see function definitions in code for
* descriptive comments. but seriously, don't use this stuff.
*/
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index 0b036c6ff2b..8210ea973e6 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -106,7 +106,7 @@ static void calc_corner_co(BMLoop *l, const float fac, float r_co[3],
normalize_v3(l_vec_next);
add_v3_v3v3(co_ofs, l_vec_prev, l_vec_next);
- if (UNLIKELY(normalize_v3(co_ofs) == 0.0f)) { /* edges form a straignt line */
+ if (UNLIKELY(normalize_v3(co_ofs) == 0.0f)) { /* edges form a straight line */
cross_v3_v3v3(co_ofs, l_vec_prev, l->f->no);
}
@@ -865,7 +865,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
}
#endif
- BMO_op_callf(bm, "delete geom=%fv context=%i", BEVEL_DEL, DEL_VERTS);
+ BMO_op_callf(bm, op->flag, "delete geom=%fv context=%i", BEVEL_DEL, DEL_VERTS);
/* clean up any edges that might not get properly delete */
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
@@ -873,8 +873,8 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, e, BEVEL_DEL);
}
- BMO_op_callf(bm, "delete geom=%fe context=%i", BEVEL_DEL, DEL_EDGES);
- BMO_op_callf(bm, "delete geom=%ff context=%i", BEVEL_DEL, DEL_FACES);
+ BMO_op_callf(bm, op->flag, "delete geom=%fe context=%i", BEVEL_DEL, DEL_EDGES);
+ BMO_op_callf(bm, op->flag, "delete geom=%ff context=%i", BEVEL_DEL, DEL_FACES);
BLI_smallhash_release(&hash);
BLI_array_free(tags);
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index f1063d1ca42..c17f23eb658 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -1365,12 +1365,12 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
/* call edgenet create */
/* call edgenet prepare op so additional face creation cases wore */
- BMO_op_initf(bm, &op2, "edgenet_prepare edges=%fe", ELE_NEW);
+ BMO_op_initf(bm, &op2, op->flag, "edgenet_prepare edges=%fe", ELE_NEW);
BMO_op_exec(bm, &op2);
BMO_slot_buffer_flag_enable(bm, &op2, "edgeout", BM_EDGE, ELE_NEW);
BMO_op_finish(bm, &op2);
- BMO_op_initf(bm, &op2,
+ BMO_op_initf(bm, &op2, op->flag,
"edgenet_fill edges=%fe use_fill_check=%b mat_nr=%i use_smooth=%b",
ELE_NEW, TRUE, mat_nr, use_smooth);
@@ -1386,7 +1386,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMO_op_finish(bm, &op2);
/* now call dissolve face */
- BMO_op_initf(bm, &op2, "dissolve_faces faces=%ff", ELE_NEW);
+ BMO_op_initf(bm, &op2, op->flag, "dissolve_faces faces=%ff", ELE_NEW);
BMO_op_exec(bm, &op2);
/* if we dissolved anything, then return */
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 8e69696f771..b10556af04e 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -164,7 +164,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
}
- BMO_op_callf(bm, "delete geom=%ff context=%i", FACE_ORIG, DEL_FACES);
+ BMO_op_callf(bm, op->flag, "delete geom=%ff context=%i", FACE_ORIG, DEL_FACES);
if (use_verts) {
@@ -214,7 +214,7 @@ void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, e->v2, VERT_MARK);
/* BMESH_TODO - check on delaying edge removal since we may end up removing more then
- * one edge, and later referene a removed edge */
+ * one edge, and later reference a removed edge */
BM_faces_join_pair(bm, fa, fb, e, TRUE);
}
}
@@ -270,7 +270,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
/* join faces */
/* BMESH_TODO - check on delaying edge removal since we may end up removing more then
- * one edge, and later referene a removed edge */
+ * one edge, and later reference a removed edge */
BM_faces_join_pair(bm, fa, fb, e, TRUE);
}
}
@@ -383,7 +383,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_op_callf(bm, "dissolve_faces faces=%ff", FACE_MARK);
+ BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_MARK);
if (BMO_error_occurred(bm)) {
const char *msg;
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index 1421ae294bc..4d4d7e30a4e 100644
--- a/source/blender/bmesh/operators/bmo_dupe.c
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -381,8 +381,8 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
const short use_only_faces = BMO_slot_bool_get(op, "use_only_faces");
/* initialize our sub-operator */
- BMO_op_init(bm, &dupeop, "duplicate");
- BMO_op_init(bm, &delop, "delete");
+ BMO_op_init(bm, &dupeop, op->flag, "duplicate");
+ BMO_op_init(bm, &delop, op->flag, "delete");
BMO_slot_copy(splitop, &dupeop, "geom", "geom");
BMO_op_exec(bm, &dupeop);
@@ -487,18 +487,20 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
BMO_slot_copy(op, op, "geom", "lastout");
for (a = 0; a < steps; a++) {
if (do_dupli) {
- BMO_op_initf(bm, &dupop, "duplicate geom=%s", op, "lastout");
+ BMO_op_initf(bm, &dupop, op->flag, "duplicate geom=%s", op, "lastout");
BMO_op_exec(bm, &dupop);
- BMO_op_callf(bm, "rotate cent=%v mat=%m3 verts=%s",
+ BMO_op_callf(bm, op->flag,
+ "rotate cent=%v mat=%m3 verts=%s",
cent, rmat, &dupop, "newout");
BMO_slot_copy(&dupop, op, "newout", "lastout");
BMO_op_finish(bm, &dupop);
}
else {
- BMO_op_initf(bm, &extop, "extrude_face_region edgefacein=%s",
+ BMO_op_initf(bm, &extop, op->flag, "extrude_face_region edgefacein=%s",
op, "lastout");
BMO_op_exec(bm, &extop);
- BMO_op_callf(bm, "rotate cent=%v mat=%m3 verts=%s",
+ BMO_op_callf(bm, op->flag,
+ "rotate cent=%v mat=%m3 verts=%s",
cent, rmat, &extop, "geomout");
BMO_slot_copy(&extop, op, "geomout", "lastout");
BMO_op_finish(bm, &extop);
@@ -506,7 +508,9 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
if (usedvec) {
mul_m3_v3(rmat, dvec);
- BMO_op_callf(bm, "translate vec=%v verts=%s", dvec, op, "lastout");
+ BMO_op_callf(bm, op->flag,
+ "translate vec=%v verts=%s",
+ dvec, op, "lastout");
}
}
}
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index b8993b41caf..7b59a4a9101 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -118,7 +118,9 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
BLI_array_free(edges);
- BMO_op_callf(bm, "delete geom=%ff context=%i", EXT_DEL, DEL_ONLYFACES);
+ BMO_op_callf(bm, op->flag,
+ "delete geom=%ff context=%i",
+ EXT_DEL, DEL_ONLYFACES);
BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, EXT_KEEP);
}
@@ -195,7 +197,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, e->v2, EXT_INPUT);
}
- BMO_op_initf(bm, &dupeop, "duplicate geom=%fve", EXT_INPUT);
+ BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%fve", EXT_INPUT);
BMO_op_exec(bm, &dupeop);
/* disable root flag on all new skin nodes */
@@ -273,7 +275,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
int found, fwd, delorig = FALSE;
/* initialize our sub-operators */
- BMO_op_init(bm, &dupeop, "duplicate");
+ BMO_op_init(bm, &dupeop, op->flag, "duplicate");
BMO_slot_buffer_flag_enable(bm, op, "edgefacein", BM_EDGE | BM_FACE, EXT_INPUT);
@@ -341,7 +343,8 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
}
if (delorig == TRUE) {
- BMO_op_initf(bm, &delop, "delete geom=%fvef context=%i",
+ BMO_op_initf(bm, &delop, op->flag,
+ "delete geom=%fvef context=%i",
EXT_DEL, DEL_ONLYTAGGED);
}
@@ -647,13 +650,13 @@ void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op)
thickness = BMO_slot_float_get(op, "thickness");
/* Flip original faces (so the shell is extruded inward) */
- BMO_op_init(bm, &reverseop, "reverse_faces");
+ BMO_op_init(bm, &reverseop, op->flag, "reverse_faces");
BMO_slot_copy(op, &reverseop, "geom", "faces");
BMO_op_exec(bm, &reverseop);
BMO_op_finish(bm, &reverseop);
/* Extrude the region */
- BMO_op_initf(bm, &extrudeop, "extrude_face_region alwayskeeporig=%b", TRUE);
+ BMO_op_initf(bm, &extrudeop, op->flag, "extrude_face_region alwayskeeporig=%b", TRUE);
BMO_slot_copy(op, &extrudeop, "geom", "edgefacein");
BMO_op_exec(bm, &extrudeop);
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
index b22bdf60210..87ba216d5cf 100644
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ b/source/blender/bmesh/operators/bmo_hull.c
@@ -61,7 +61,7 @@ typedef enum {
HULL_FLAG_HOLE = (1 << 5)
} HullFlags;
-/* Store hull triangles seperate from BMesh faces until the end; this
+/* Store hull triangles separate from BMesh faces until the end; this
* way we don't have to worry about cleaning up extraneous edges or
* incorrectly deleting existing geometry. */
typedef struct HullTriangle {
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
index 26197c43bd0..3aa6e6dbe49 100644
--- a/source/blender/bmesh/operators/bmo_inset.c
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -280,7 +280,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
BMFace *f_b = e_info_b->l->f;
/* we use this as either the normal OR to find the right direction for the
- * crpss product between both face normals */
+ * cross product between both face normals */
add_v3_v3v3(tvec, e_info_a->no, e_info_b->no);
if ((f_a == f_b) || compare_v3v3(f_a->no, f_b->no, 0.00001f)) {
diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c
index c550a17e696..c4b988ae82d 100644
--- a/source/blender/bmesh/operators/bmo_mesh_conv.c
+++ b/source/blender/bmesh/operators/bmo_mesh_conv.c
@@ -70,7 +70,9 @@ void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
/* Scene *scene = BMO_slot_ptr_get(op, "scene"); */
Mesh *me = ob->data;
- BMO_op_callf(bm, "bmesh_to_mesh mesh=%p object=%p notessellation=%b", me, ob, TRUE);
+ BMO_op_callf(bm, op->flag,
+ "bmesh_to_mesh mesh=%p object=%p notessellation=%b",
+ me, ob, TRUE);
}
void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c
index 1ab439b38bb..c6b228b988e 100644
--- a/source/blender/bmesh/operators/bmo_mirror.c
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -62,7 +62,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
BMO_slot_mat4_get(op, "mat", mtx);
invert_m4_m4(imtx, mtx);
- BMO_op_initf(bm, &dupeop, "duplicate geom=%s", op, "geom");
+ BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom");
BMO_op_exec(bm, &dupeop);
BMO_slot_buffer_flag_enable(bm, &dupeop, "newout", BM_ALL, ELE_NEW);
@@ -80,11 +80,11 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
/* feed old data to transform bmo */
scale[axis] = -1.0f;
- BMO_op_callf(bm, "transform verts=%fv mat=%m4", ELE_NEW, mtx);
- BMO_op_callf(bm, "scale verts=%fv vec=%v", ELE_NEW, scale);
- BMO_op_callf(bm, "transform verts=%fv mat=%m4", ELE_NEW, imtx);
+ BMO_op_callf(bm, op->flag, "transform verts=%fv mat=%m4", ELE_NEW, mtx);
+ BMO_op_callf(bm, op->flag, "scale verts=%fv vec=%v", ELE_NEW, scale);
+ BMO_op_callf(bm, op->flag, "transform verts=%fv mat=%m4", ELE_NEW, imtx);
- BMO_op_init(bm, &weldop, "weld_verts");
+ BMO_op_init(bm, &weldop, op->flag, "weld_verts");
v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
for (i = 0; i < ototvert; i++) {
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index d59a90ba3a1..70173d942a1 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -267,19 +267,19 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
for (a = 0; a < seg - 1; a++) {
if (a) {
- BMO_op_initf(bm, &bmop, "extrude_edge_only edges=%s", &prevop, "geomout");
+ BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%s", &prevop, "geomout");
BMO_op_exec(bm, &bmop);
BMO_op_finish(bm, &prevop);
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
}
else {
- BMO_op_initf(bm, &bmop, "extrude_edge_only edges=%fe", EDGE_ORIG);
+ BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%fe", EDGE_ORIG);
BMO_op_exec(bm, &bmop);
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
}
- BMO_op_callf(bm, "translate vec=%v verts=%s", vec, &bmop, "geomout");
+ BMO_op_callf(bm, op->flag, "translate vec=%v verts=%s", vec, &bmop, "geomout");
prevop = bmop;
}
@@ -333,17 +333,17 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
for (a = 0; a < seg; a++) {
if (a) {
- BMO_op_initf(bm, &bmop, "extrude_edge_only edges=%s", &prevop, "geomout");
+ BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%s", &prevop, "geomout");
BMO_op_exec(bm, &bmop);
BMO_op_finish(bm, &prevop);
}
else {
- BMO_op_initf(bm, &bmop, "extrude_edge_only edges=%fe", EDGE_ORIG);
+ BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%fe", EDGE_ORIG);
BMO_op_exec(bm, &bmop);
}
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
- BMO_op_callf(bm, "rotate cent=%v mat=%m3 verts=%s", vec, cmat, &bmop, "geomout");
+ BMO_op_callf(bm, op->flag, "rotate cent=%v mat=%m3 verts=%s", vec, cmat, &bmop, "geomout");
prevop = bmop;
}
@@ -365,7 +365,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
len2 = len_v3v3(vec, vec2);
/* use shortest segment length divided by 3 as merge threshold */
- BMO_op_callf(bm, "remove_doubles verts=%fv dist=%f", VERT_MARK, MIN2(len, len2) / 3.0f);
+ BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, MIN2(len, len2) / 3.0f);
}
/* and now do imat */
@@ -426,7 +426,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
if (subdiv > 1) {
BMOperator bmop;
- BMO_op_initf(bm, &bmop,
+ BMO_op_initf(bm, &bmop, op->flag,
"subdivide_edges edges=%fe "
"smooth=%f "
"numcuts=%i "
@@ -563,7 +563,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
}
if (!cap_tris) {
- BMO_op_callf(bm, "dissolve_faces faces=%ff", FACE_NEW);
+ BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
}
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
@@ -656,12 +656,12 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
}
if (!cap_tris) {
- BMO_op_callf(bm, "dissolve_faces faces=%ff", FACE_NEW);
+ BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
}
BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, FALSE);
- BMO_op_callf(bm, "remove_doubles verts=%fv dist=%f", VERT_MARK, 0.000001);
+ BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, 0.000001);
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
}
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index b3c348a330c..e1a5ef9f905 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -227,7 +227,7 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_op_callf(bm, "delete geom=%fvef context=%i", ELE_DEL, DEL_ONLYTAGGED);
+ BMO_op_callf(bm, op->flag, "delete geom=%fvef context=%i", ELE_DEL, DEL_ONLYTAGGED);
BLI_array_free(edges);
BLI_array_free(loops);
@@ -347,8 +347,8 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
BMO_slot_vec_get(op, "merge_co", vec);
- //BMO_op_callf(bm, "collapse_uvs edges=%s", op, "edges");
- BMO_op_init(bm, &weldop, "weld_verts");
+ //BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");
+ BMO_op_init(bm, &weldop, op->flag, "weld_verts");
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
if (!snapv) {
@@ -374,8 +374,8 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
float min[3], max[3];
int i, tot;
- BMO_op_callf(bm, "collapse_uvs edges=%s", op, "edges");
- BMO_op_init(bm, &weldop, "weld_verts");
+ BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");
+ BMO_op_init(bm, &weldop, op->flag, "weld_verts");
BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
@@ -561,7 +561,7 @@ void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op)
{
BMOperator weldop;
- BMO_op_init(bm, &weldop, "weld_verts");
+ BMO_op_init(bm, &weldop, op->flag, "weld_verts");
bmesh_find_doubles_common(bm, op, &weldop, "targetmap");
BMO_op_exec(bm, &weldop);
BMO_op_finish(bm, &weldop);
@@ -591,12 +591,12 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op)
/* Search for doubles among all vertices, but only merge non-VERT_KEEP
* vertices into VERT_KEEP vertices. */
- BMO_op_initf(bm, &findop, "find_doubles verts=%av keep_verts=%fv", VERT_KEEP);
+ BMO_op_initf(bm, &findop, op->flag, "find_doubles verts=%av keep_verts=%fv", VERT_KEEP);
BMO_slot_copy(op, &findop, "dist", "dist");
BMO_op_exec(bm, &findop);
/* weld the vertices */
- BMO_op_init(bm, &weldop, "weld_verts");
+ BMO_op_init(bm, &weldop, op->flag, "weld_verts");
BMO_slot_copy(&findop, &weldop, "targetmapout", "targetmap");
BMO_op_exec(bm, &weldop);
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index ee3e34c527f..a03aa0caf10 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -1037,7 +1037,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
BMOperator op;
/* use_sphere isnt exposed here since its only used for new primitives */
- BMO_op_initf(bm, &op,
+ BMO_op_initf(bm, &op, BMO_FLAG_DEFAULTS,
"subdivide_edges edges=%he "
"smooth=%f fractal=%f along_normal=%f "
"numcuts=%i "
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 0903620f9a0..de876477e5a 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -212,7 +212,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
BLI_smallhash_release(&hash);
/* clean up fill */
- BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff constrain_edges=%fe", ELE_NEW, EDGE_MARK);
+ BMO_op_initf(bm, &bmop, op->flag, "beautify_fill faces=%ff constrain_edges=%fe", ELE_NEW, EDGE_MARK);
BMO_op_exec(bm, &bmop);
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE | BM_EDGE, ELE_NEW);
BMO_op_finish(bm, &bmop);
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 7d6e34b3a05..5664c487236 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -73,7 +73,7 @@ void bmo_translate_exec(BMesh *bm, BMOperator *op)
unit_m4(mat);
copy_v3_v3(mat[3], vec);
- BMO_op_callf(bm, "transform mat=%m4 verts=%s", mat, op, "verts");
+ BMO_op_callf(bm, op->flag, "transform mat=%m4 verts=%s", mat, op, "verts");
}
void bmo_scale_exec(BMesh *bm, BMOperator *op)
@@ -87,7 +87,7 @@ void bmo_scale_exec(BMesh *bm, BMOperator *op)
mat[1][1] = vec[1];
mat[2][2] = vec[2];
- BMO_op_callf(bm, "transform mat=%m3 verts=%s", mat, op, "verts");
+ BMO_op_callf(bm, op->flag, "transform mat=%m3 verts=%s", mat, op, "verts");
}
void bmo_rotate_exec(BMesh *bm, BMOperator *op)
@@ -100,12 +100,12 @@ void bmo_rotate_exec(BMesh *bm, BMOperator *op)
* this is how editmesh did it and I'm too tired to think
* through the math right now. */
mul_v3_fl(vec, -1.0f);
- BMO_op_callf(bm, "translate verts=%s vec=%v", op, "verts", vec);
+ BMO_op_callf(bm, op->flag, "translate verts=%s vec=%v", op, "verts", vec);
- BMO_op_callf(bm, "transform mat=%s verts=%s", op, "mat", op, "verts");
+ BMO_op_callf(bm, op->flag, "transform mat=%s verts=%s", op, "mat", op, "verts");
mul_v3_fl(vec, -1.0f);
- BMO_op_callf(bm, "translate verts=%s vec=%v", op, "verts", vec);
+ BMO_op_callf(bm, op->flag, "translate verts=%s vec=%v", op, "verts", vec);
}
void bmo_reverse_faces_exec(BMesh *bm, BMOperator *op)
@@ -530,7 +530,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
/*
* The first thing to do is to iterate through all the the selected items and mark them since
* they will be in the selection anyway.
- * This will increase performance, (especially when the number of originaly selected faces is high)
+ * This will increase performance, (especially when the number of originally selected faces is high)
* so the overall complexity will be less than $O(mn)$ where is the total number of selected faces,
* and n is the total number of faces
*/
diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c
index 07e413985bf..eb498ebf9ab 100644
--- a/source/blender/bmesh/tools/BME_bevel.c
+++ b/source/blender/bmesh/tools/BME_bevel.c
@@ -1129,7 +1129,7 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i
}
/* possibly needed when running as a tool (which is no longer functional)
- * but keep as an optioin for now */
+ * but keep as an option for now */
if (do_tessface) {
BMEdit_RecalcTessellation(em);
}
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 4182a9c4c93..9c11358ce7f 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -916,7 +916,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
}
}
- if ( (animType->camera) != 0) {
+ if (animType->camera != 0) {
Camera *camera = (Camera *) ob->data;
if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID *)&camera->id, 1);
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index c3d1106b288..d30f9b86a5a 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -135,7 +135,7 @@ void GeometryExporter::operator()(Object *ob)
// XXX slow
if (ob->totcol) {
- for (int a = 0; a < ob->totcol; a++) {
+ for (int a = 0; a < ob->totcol; a++) {
createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind);
}
}
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index b9e96445dcb..206dc09fe8b 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -63,6 +63,11 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
if (not_yet_exported) {
ImBuf *imbuf = BKE_image_get_ibuf(image, NULL);
+ if(!imbuf) {
+ fprintf(stderr, "Collada export: image does not exist:\n%s\n", image->name);
+ return;
+ }
+
bool is_dirty = imbuf->userflags & IB_BITMAPDIRTY;
ImageFormatData imageFormat;
@@ -100,6 +105,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
if (BKE_imbuf_write_as(imbuf, export_path, &imageFormat, true) == 0) {
fprintf(stderr, "Collada export: Cannot export image to:\n%s\n", export_path);
+ return;
}
BLI_strncpy(export_path, export_file, sizeof(export_path));
}
@@ -119,6 +125,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
if (BLI_copy(source_path, export_path) != 0) {
fprintf(stderr, "Collada export: Cannot copy image:\n source:%s\ndest :%s\n", source_path, export_path);
+ return;
}
BLI_strncpy(export_path, export_file, sizeof(export_path));
@@ -153,8 +160,7 @@ void ImagesExporter::export_UV_Images()
for (int i = 0; i < me->pdata.totlayer; i++) {
if (me->pdata.layers[i].type == CD_MTEXPOLY) {
MTexPoly *txface = (MTexPoly *)me->pdata.layers[i].data;
- MFace *mface = me->mface;
- for (int j = 0; j < me->totpoly; j++, mface++, txface++) {
+ for (int j = 0; j < me->totpoly; j++, txface++) {
Image *ima = txface->tpage;
if (ima == NULL)
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index 9bad1b55d95..870e379b343 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -338,6 +338,11 @@ set(SRC
operations/COM_KeyingScreenOperation.cpp
operations/COM_KeyingScreenOperation.h
+ nodes/COM_TrackPositionNode.cpp
+ nodes/COM_TrackPositionNode.h
+ operations/COM_TrackPositionOperation.cpp
+ operations/COM_TrackPositionOperation.h
+
nodes/COM_KeyingNode.cpp
nodes/COM_KeyingNode.h
operations/COM_KeyingOperation.cpp
diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h
index 86390e5650a..cd1615c9094 100644
--- a/source/blender/compositor/COM_compositor.h
+++ b/source/blender/compositor/COM_compositor.h
@@ -37,9 +37,9 @@ extern "C" {
* @mainpage Introduction of the Blender Compositor
*
* @section bcomp Blender compositor
- * This project redesigns the interals of Blender's compositor. The project has been executed in 2011 by At Mind.
+ * This project redesigns the internals of Blender's compositor. The project has been executed in 2011 by At Mind.
* At Mind is a technology company located in Amsterdam, The Netherlands.
- * The project has been crowdfunded. This code has been released under GPL2 to be used in Blender.
+ * The project has been crowd-funded. This code has been released under GPL2 to be used in Blender.
*
* @section goals The goals of the project
* the new compositor has 2 goals.
@@ -58,7 +58,7 @@ extern "C" {
* @section workflow Work faster
* The previous compositor only showed the final image. The compositor could wait a long time before seeing the result
* of his work. The new compositor will work in a way that it will focus on getting information back to the user.
- * It will prioritise its work to get earlier user feedback.
+ * It will prioritize its work to get earlier user feedback.
*
* @page memory Memory model
* The main issue is the type of memory model to use. Blender is used by consumers and professionals.
@@ -79,7 +79,7 @@ extern "C" {
* Render priority is an priority of an output node. A user has a different need of Render priorities of output nodes
* than during editing.
* for example. the Active ViewerNode has top priority during editing, but during rendering a CompositeNode has.
- * All NodeOperation has a setting for their renderpriority, but only for output NodeOperation these have effect.
+ * All NodeOperation has a setting for their render-priority, but only for output NodeOperation these have effect.
* In ExecutionSystem.execute all priorities are checked. For every priority the ExecutionGroup's are check if the
* priority do match.
* When match the ExecutionGroup will be executed (this happens in serial)
@@ -91,18 +91,18 @@ extern "C" {
* @section order Chunk order
*
* When a ExecutionGroup is executed, first the order of chunks are determined.
- * The settings are stored in the ViewerNode inside the ExecutionGroup. ExecutionGroups that have no viewernode,
+ * The settings are stored in the ViewerNode inside the ExecutionGroup. ExecutionGroups that have no viewer-node,
* will use a default one.
* There are several possible chunk orders
* - [@ref OrderOfChunks.COM_TO_CENTER_OUT]: Start calculating from a configurable point and order by nearest chunk
* - [@ref OrderOfChunks.COM_TO_RANDOM]: Randomize all chunks.
* - [@ref OrderOfChunks.COM_TO_TOP_DOWN]: Start calculation from the bottom to the top of the image
- * - [@ref OrderOfChunks.COM_TO_RULE_OF_THIRDS]: Experimental order based on 9 hotspots in the image
+ * - [@ref OrderOfChunks.COM_TO_RULE_OF_THIRDS]: Experimental order based on 9 hot-spots in the image
*
- * When the chunkorder is determined, the first few chunks will be checked if they can be scheduled.
+ * When the chunk-order is determined, the first few chunks will be checked if they can be scheduled.
* Chunks can have three states:
- * - [@ref ChunkExecutionState.COM_ES_NOT_SCHEDULED]: Chunk is not yet scheduled, or dependacies are not met
- * - [@ref ChunkExecutionState.COM_ES_SCHEDULED]: All dependacies are met, chunk is scheduled, but not finished
+ * - [@ref ChunkExecutionState.COM_ES_NOT_SCHEDULED]: Chunk is not yet scheduled, or dependencies are not met
+ * - [@ref ChunkExecutionState.COM_ES_SCHEDULED]: All dependencies are met, chunk is scheduled, but not finished
* - [@ref ChunkExecutionState.COM_ES_EXECUTED]: Chunk is finished
*
* @see ExecutionGroup.execute
@@ -110,7 +110,7 @@ extern "C" {
* @see OrderOfChunks
*
* @section interest Area of interest
- * An ExecutionGroup can have dependancies to other ExecutionGroup's. Data passing from one ExecutionGroup to another
+ * An ExecutionGroup can have dependencies to other ExecutionGroup's. Data passing from one ExecutionGroup to another
* one are stored in 'chunks'.
* If not all input chunks are available the chunk execution will not be scheduled.
* <pre>
@@ -217,22 +217,22 @@ extern "C" {
* @section workscheduler WorkScheduler
* the WorkScheduler is implemented as a static class. the responsibility of the WorkScheduler is to balance
* WorkPackages to the available and free devices.
- * the workscheduler can work in 2 states. For witching these between the state you need to recompile blender
+ * the work-scheduler can work in 2 states. For witching these between the state you need to recompile blender
*
* @subsection multithread Multi threaded
- * Default the workscheduler will place all work as WorkPackage in a queue.
+ * Default the work-scheduler will place all work as WorkPackage in a queue.
* For every CPUcore a working thread is created. These working threads will ask the WorkScheduler if there is work
* for a specific Device.
- * the workscheduler will find work for the device and the device will be asked to execute the WorkPackage
+ * the work-scheduler will find work for the device and the device will be asked to execute the WorkPackage
*
* @subsection singlethread Single threaded
* For debugging reasons the multi-threading can be disabled. This is done by changing the COM_CURRENT_THREADING_MODEL
- * to COM_TM_NOTHREAD. When compiling the workscheduler
+ * to COM_TM_NOTHREAD. When compiling the work-scheduler
* will be changes to support no threading and run everything on the CPU.
*
* @section devices Devices
* A Device within the compositor context is a Hardware component that can used to calculate chunks.
- * This chunk is encapseled in a WorkPackage.
+ * This chunk is encapsulated in a WorkPackage.
* the WorkScheduler controls the devices and selects the device where a WorkPackage will be calculated.
*
* @subsection WS_Devices Workscheduler
@@ -299,6 +299,19 @@ extern "C" {
*/
void COM_execute(RenderData* rd, bNodeTree *editingtree, int rendering);
+/**
+ * @brief Return a list of highlighted bnodes pointers.
+ * @return
+ */
+void COM_startReadHighlights(void);
+
+/**
+ * @brief check if a bnode is highlighted
+ * @param bnode
+ * @return
+ */
+int COM_isHighlightedbNode(bNode* bnode);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/compositor/SConscript b/source/blender/compositor/SConscript
index af0d4109acc..d7f18cfa436 100644
--- a/source/blender/compositor/SConscript
+++ b/source/blender/compositor/SConscript
@@ -11,4 +11,4 @@ incs += '../opencl ../nodes ../nodes/intern ../nodes/composite '
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
-env.BlenderLib ( 'bf_composite', sources, Split(incs), defines=defs, libtype=['core'], priority = [191] )
+env.BlenderLib ( 'bf_composite', sources, Split(incs), defines=defs, libtype=['core'], priority = [164] )
diff --git a/source/blender/compositor/intern/COM_CPUDevice.cpp b/source/blender/compositor/intern/COM_CPUDevice.cpp
index 95462b3c384..7029aa032cc 100644
--- a/source/blender/compositor/intern/COM_CPUDevice.cpp
+++ b/source/blender/compositor/intern/COM_CPUDevice.cpp
@@ -29,10 +29,9 @@ void CPUDevice::execute(WorkPackage *work)
rcti rect;
executionGroup->determineChunkRect(&rect, chunkNumber);
- MemoryBuffer **inputBuffers = executionGroup->getInputBuffersCPU();
- executionGroup->getOutputNodeOperation()->executeRegion(&rect, chunkNumber, inputBuffers);
+ executionGroup->getOutputNodeOperation()->executeRegion(&rect, chunkNumber);
- executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers);
+ executionGroup->finalizeChunkExecution(chunkNumber, NULL);
}
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 4ed7ae7ca8a..37d38261ea5 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -110,6 +110,7 @@
#include "COM_TransformNode.h"
#include "COM_TranslateNode.h"
#include "COM_TranslateOperation.h"
+#include "COM_TrackPositionNode.h"
#include "COM_ValueNode.h"
#include "COM_VectorBlurNode.h"
#include "COM_VectorCurveNode.h"
@@ -377,6 +378,9 @@ Node *Converter::convert(bNode *b_node, bool fast)
case CMP_NODE_KEYING:
node = new KeyingNode(b_node);
break;
+ case CMP_NODE_TRACKPOS:
+ node = new TrackPositionNode(b_node);
+ break;
/* not inplemented yet */
default:
node = new MuteNode(b_node);
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 90f4ba85c78..46a0db7af2d 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -372,23 +372,6 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
delete[] chunkOrder;
}
-MemoryBuffer **ExecutionGroup::getInputBuffersCPU()
-{
- vector<MemoryProxy *> memoryproxies;
- unsigned int index;
-
- this->determineDependingMemoryProxies(&memoryproxies);
- MemoryBuffer **memoryBuffers = new MemoryBuffer *[this->m_cachedMaxReadBufferOffset];
- for (index = 0; index < this->m_cachedMaxReadBufferOffset; index++) {
- memoryBuffers[index] = NULL;
- }
- for (index = 0; index < this->m_cachedReadOperations.size(); index++) {
- ReadBufferOperation *readOperation = (ReadBufferOperation *)this->m_cachedReadOperations[index];
- memoryBuffers[readOperation->getOffset()] = readOperation->getMemoryProxy()->getBuffer();
- }
- return memoryBuffers;
-}
-
MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
{
rcti rect;
@@ -449,12 +432,12 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
inline void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const
{
if (this->m_singleThreaded) {
- BLI_init_rcti(rect, 0, this->m_width, 0, this->m_height);
+ BLI_rcti_init(rect, 0, this->m_width, 0, this->m_height);
}
else {
const unsigned int minx = xChunk * this->m_chunkSize;
const unsigned int miny = yChunk * this->m_chunkSize;
- BLI_init_rcti(rect, minx, min(minx + this->m_chunkSize, this->m_width), miny, min(miny + this->m_chunkSize, this->m_height));
+ BLI_rcti_init(rect, minx, min(minx + this->m_chunkSize, this->m_width), miny, min(miny + this->m_chunkSize, this->m_height));
}
}
@@ -551,7 +534,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChun
for (index = 0; index < this->m_cachedReadOperations.size(); index++) {
ReadBufferOperation *readOperation = (ReadBufferOperation *)this->m_cachedReadOperations[index];
- BLI_init_rcti(&area, 0, 0, 0, 0);
+ BLI_rcti_init(&area, 0, 0, 0, 0);
MemoryProxy *memoryProxy = memoryProxies[index];
determineDependingAreaOfInterest(&rect, readOperation, &area);
ExecutionGroup *group = memoryProxy->getExecutor();
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h
index 43c2bfac52e..e890715cafe 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.h
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.h
@@ -180,7 +180,7 @@ private:
/**
* @brief Determine the rect (minx, maxx, miny, maxy) of a chunk at a position.
- * @note Only gives usefull results ater the determination of the chunksize
+ * @note Only gives useful results ater the determination of the chunksize
* @see determineChunkSize()
*/
void determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const;
@@ -376,7 +376,7 @@ public:
/**
* @brief Determine the rect (minx, maxx, miny, maxy) of a chunk.
- * @note Only gives usefull results ater the determination of the chunksize
+ * @note Only gives useful results ater the determination of the chunksize
* @see determineChunkSize()
*/
void determineChunkRect(rcti *rect, const unsigned int chunkNumber) const;
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index ff841092848..801505e9d39 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -129,6 +129,13 @@ void ExecutionSystem::execute()
operation->setbNodeTree(this->m_context.getbNodeTree());
operation->initExecution();
}
+ for (index = 0; index < this->m_operations.size(); index++) {
+ NodeOperation *operation = this->m_operations[index];
+ if (operation->isReadBufferOperation()) {
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
+ readOperation->updateMemoryBuffer();
+ }
+ }
for (index = 0; index < this->m_groups.size(); index++) {
ExecutionGroup *executionGroup = this->m_groups[index];
executionGroup->setChunksize(this->m_context.getChunksize());
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index 209358ec786..4f6780c8d0b 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -37,7 +37,7 @@ using namespace std;
/**
* @page execution Execution model
- * In order to get to an efficient model for execution, serveral steps are being done. these steps are explained below.
+ * In order to get to an efficient model for execution, several steps are being done. these steps are explained below.
*
* @section EM_Step1 Step 1: translating blender node system to the new compsitor system
* Blenders node structure is based on C structs (DNA). These structs are not efficient in the new architecture. We want to use classes in order to simplify the system.
@@ -64,7 +64,7 @@ using namespace std;
* @section EM_Step3 Step3: add additional conversions to the operation system
* - Data type conversions: the system has 3 data types COM_DT_VALUE, COM_DT_VECTOR, COM_DT_COLOR. The user can connect a Value socket to a color socket. As values are ordered differently than colors a conversion happens.
*
- * - Image size conversions: the system can automatically convert when resolutions do not match. An InputSocket has a resize mode. This can be any of the folowing settings.
+ * - Image size conversions: the system can automatically convert when resolutions do not match. An InputSocket has a resize mode. This can be any of the following settings.
* - [@ref InputSocketResizeMode.COM_SC_CENTER]: The center of both images are aligned
* - [@ref InputSocketResizeMode.COM_SC_FIT_WIDTH]: The width of both images are aligned
* - [@ref InputSocketResizeMode.COM_SC_FIT_HEIGHT]: the height of both images are aligned
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index 8dd1e55274f..0aae8853795 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -22,8 +22,7 @@
#include "COM_MemoryBuffer.h"
#include "MEM_guardedalloc.h"
-#include "BLI_math.h"
-#include "BKE_global.h"
+//#include "BKE_global.h"
unsigned int MemoryBuffer::determineBufferSize()
{
@@ -41,7 +40,7 @@ int MemoryBuffer::getHeight() const
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect)
{
- BLI_init_rcti(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+ BLI_rcti_init(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
this->m_memoryProxy = memoryProxy;
this->m_chunkNumber = chunkNumber;
this->m_buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
@@ -52,7 +51,7 @@ MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, r
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
{
- BLI_init_rcti(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+ BLI_rcti_init(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
this->m_memoryProxy = memoryProxy;
this->m_chunkNumber = -1;
this->m_buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
@@ -117,26 +116,12 @@ void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer)
}
}
-void MemoryBuffer::read(float result[4], int x, int y)
-{
- if (x >= this->m_rect.xmin && x < this->m_rect.xmax &&
- y >= this->m_rect.ymin && y < this->m_rect.ymax)
- {
- const int dx = x - this->m_rect.xmin;
- const int dy = y - this->m_rect.ymin;
- const int offset = (this->m_chunkWidth * dy + dx) * COM_NUMBER_OF_CHANNELS;
- copy_v4_v4(result, &this->m_buffer[offset]);
- }
- else {
- zero_v4(result);
- }
-}
void MemoryBuffer::writePixel(int x, int y, const float color[4])
{
if (x >= this->m_rect.xmin && x < this->m_rect.xmax &&
y >= this->m_rect.ymin && y < this->m_rect.ymax)
{
- const int offset = (this->m_chunkWidth * y + x) * COM_NUMBER_OF_CHANNELS;
+ const int offset = (this->m_chunkWidth * (y-this->m_rect.ymin) + x-this->m_rect.xmin) * COM_NUMBER_OF_CHANNELS;
copy_v4_v4(&this->m_buffer[offset], color);
}
}
@@ -146,49 +131,11 @@ void MemoryBuffer::addPixel(int x, int y, const float color[4])
if (x >= this->m_rect.xmin && x < this->m_rect.xmax &&
y >= this->m_rect.ymin && y < this->m_rect.ymax)
{
- const int offset = (this->m_chunkWidth * y + x) * COM_NUMBER_OF_CHANNELS;
+ const int offset = (this->m_chunkWidth * (y-this->m_rect.ymin) + x-this->m_rect.xmin) * COM_NUMBER_OF_CHANNELS;
add_v4_v4(&this->m_buffer[offset], color);
}
}
-void MemoryBuffer::readCubic(float result[4], float x, float y)
-{
- int x1 = floor(x);
- int x2 = x1 + 1;
- int y1 = floor(y);
- int y2 = y1 + 1;
-
- float valuex = x - x1;
- float valuey = y - y1;
- float mvaluex = 1.0f - valuex;
- float mvaluey = 1.0f - valuey;
-
- float color1[4];
- float color2[4];
- float color3[4];
- float color4[4];
-
- read(color1, x1, y1);
- read(color2, x1, y2);
- read(color3, x2, y1);
- read(color4, x2, y2);
-
- color1[0] = color1[0] * mvaluey + color2[0] * valuey;
- color1[1] = color1[1] * mvaluey + color2[1] * valuey;
- color1[2] = color1[2] * mvaluey + color2[2] * valuey;
- color1[3] = color1[3] * mvaluey + color2[3] * valuey;
-
- color3[0] = color3[0] * mvaluey + color4[0] * valuey;
- color3[1] = color3[1] * mvaluey + color4[1] * valuey;
- color3[2] = color3[2] * mvaluey + color4[2] * valuey;
- color3[3] = color3[3] * mvaluey + color4[3] * valuey;
-
- result[0] = color1[0] * mvaluex + color3[0] * valuex;
- result[1] = color1[1] * mvaluex + color3[1] * valuex;
- result[2] = color1[2] * mvaluex + color3[2] * valuex;
- result[3] = color1[3] * mvaluex + color3[3] * valuex;
-}
-
// table of (exp(ar) - exp(a)) / (1 - exp(a)) for r in range [0, 1] and a = -2
// used instead of actual gaussian, otherwise at high texture magnifications circular artifacts are visible
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h
index 63b41aeddde..9abbfb163e2 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.h
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.h
@@ -28,10 +28,12 @@ class MemoryBuffer;
#include "COM_ExecutionGroup.h"
#include "BLI_rect.h"
#include "COM_MemoryProxy.h"
+
extern "C" {
- #include "BLI_threads.h"
+ //#include "BLI_threads.h"
+ #include "BLI_math.h"
}
-#include <vector>
+//#include <vector>
/**
* @brief state of a memory buffer
@@ -65,7 +67,7 @@ private:
/**
- * @brief region of this buffer inside reative to the MemoryProxy
+ * @brief region of this buffer inside relative to the MemoryProxy
*/
rcti m_rect;
@@ -120,14 +122,76 @@ public:
/**
* @brief after execution the state will be set to available by calling this method
*/
- void setCreatedState() {
+ void setCreatedState()
+ {
this->m_state = COM_MB_AVAILABLE;
}
- void read(float result[4], int x, int y);
+ inline void read(float result[4], int x, int y)
+ {
+ if (x >= this->m_rect.xmin && x < this->m_rect.xmax &&
+ y >= this->m_rect.ymin && y < this->m_rect.ymax)
+ {
+ const int dx = x - this->m_rect.xmin;
+ const int dy = y - this->m_rect.ymin;
+ const int offset = (this->m_chunkWidth * dy + dx) * COM_NUMBER_OF_CHANNELS;
+ copy_v4_v4(result, &this->m_buffer[offset]);
+ }
+ else {
+ zero_v4(result);
+ }
+ }
+
+ inline void readNoCheck(float result[4], int x, int y)
+ {
+ const int dx = x - this->m_rect.xmin;
+ const int dy = y - this->m_rect.ymin;
+ const int offset = (this->m_chunkWidth * dy + dx) * COM_NUMBER_OF_CHANNELS;
+ copy_v4_v4(result, &this->m_buffer[offset]);
+ }
+
void writePixel(int x, int y, const float color[4]);
void addPixel(int x, int y, const float color[4]);
- void readCubic(float result[4], float x, float y);
+ inline void readCubic(float result[4], float x, float y)
+ {
+ int x1 = floor(x);
+ int x2 = x1 + 1;
+ int y1 = floor(y);
+ int y2 = y1 + 1;
+
+ float valuex = x - x1;
+ float valuey = y - y1;
+ float mvaluex = 1.0f - valuex;
+ float mvaluey = 1.0f - valuey;
+
+ float color1[4];
+ float color2[4];
+ float color3[4];
+ float color4[4];
+
+ read(color1, x1, y1);
+ read(color2, x1, y2);
+ read(color3, x2, y1);
+ read(color4, x2, y2);
+
+ color1[0] = color1[0] * mvaluey + color2[0] * valuey;
+ color1[1] = color1[1] * mvaluey + color2[1] * valuey;
+ color1[2] = color1[2] * mvaluey + color2[2] * valuey;
+ color1[3] = color1[3] * mvaluey + color2[3] * valuey;
+
+ color3[0] = color3[0] * mvaluey + color4[0] * valuey;
+ color3[1] = color3[1] * mvaluey + color4[1] * valuey;
+ color3[2] = color3[2] * mvaluey + color4[2] * valuey;
+ color3[3] = color3[3] * mvaluey + color4[3] * valuey;
+
+ result[0] = color1[0] * mvaluex + color3[0] * valuex;
+ result[1] = color1[1] * mvaluex + color3[1] * valuex;
+ result[2] = color1[2] * mvaluex + color3[2] * valuex;
+ result[3] = color1[3] * mvaluex + color3[3] * valuex;
+ }
+
+
+
void readEWA(float result[4], float fx, float fy, float dx, float dy);
/**
@@ -157,7 +221,7 @@ public:
int getHeight() const;
/**
- * @brief clear the buffer. Make all pixels black transparant.
+ * @brief clear the buffer. Make all pixels black transparent.
*/
void clear();
diff --git a/source/blender/compositor/intern/COM_MemoryProxy.h b/source/blender/compositor/intern/COM_MemoryProxy.h
index 130c5f5057a..696c843e7c4 100644
--- a/source/blender/compositor/intern/COM_MemoryProxy.h
+++ b/source/blender/compositor/intern/COM_MemoryProxy.h
@@ -89,7 +89,7 @@ public:
WriteBufferOperation *getWriteBufferOperation() { return this->m_writeBufferOperation; }
/**
- * @brief allocate memory of size widht x height
+ * @brief allocate memory of size width x height
*/
void allocate(unsigned int width, unsigned int height);
diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h
index bc4a25db605..e19b1d774c9 100644
--- a/source/blender/compositor/intern/COM_Node.h
+++ b/source/blender/compositor/intern/COM_Node.h
@@ -74,7 +74,7 @@ public:
/**
* @brief convert node to operation
*
- * @todo this must be described furter
+ * @todo this must be described further
*
* @param system the ExecutionSystem where the operations need to be added
* @param context reference to the CompositorContext
diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp
index c3fa308971c..9baab584d9e 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperation.cpp
@@ -120,7 +120,7 @@ void NodeOperation::getConnectedInputSockets(vector<InputSocket *> *sockets)
bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
if (this->isInputNode()) {
- BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
+ BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
return false;
}
else {
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index d316cfa0aa4..9b6d574e321 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -101,7 +101,7 @@ public:
/**
* @brief isOutputOperation determines whether this operation is an output of the ExecutionSystem during rendering or editing.
*
- * Default behaviour if not overriden, this operation will not be evaluated as being an output of the ExecutionSystem.
+ * Default behaviour if not overridden, this operation will not be evaluated as being an output of the ExecutionSystem.
*
* @see ExecutionSystem
* @group check
@@ -134,7 +134,7 @@ public:
* @param chunkNumber the chunkNumber to be calculated
* @param memoryBuffers all input MemoryBuffer's needed
*/
- virtual void executeRegion(rcti *rect, unsigned int chunkNumber, MemoryBuffer **memoryBuffers) {}
+ virtual void executeRegion(rcti *rect, unsigned int chunkNumber) {}
/**
* @brief when a chunk is executed by an OpenCLDevice, this method is called
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
index eae1ffeb08a..63f75681779 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
@@ -65,11 +65,16 @@ void OpenCLDevice::execute(WorkPackage *work)
executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers);
}
-
cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader)
{
+ return COM_clAttachMemoryBufferToKernelParameter(kernel, parameterIndex, offsetIndex, cleanup, inputMemoryBuffers, (ReadBufferOperation*)reader);
+}
+
+cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, ReadBufferOperation *reader)
+{
cl_int error;
- MemoryBuffer *result = (MemoryBuffer *)reader->initializeTileData(NULL, inputMemoryBuffers);
+
+ MemoryBuffer *result = (MemoryBuffer *)reader->getInputMemoryBuffer(inputMemoryBuffers);
const cl_image_format imageFormat = {
CL_RGBA,
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h
index 30a90dabc3e..f1a1e31c930 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.h
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.h
@@ -28,6 +28,7 @@ class OpenCLDevice;
#include "COM_Device.h"
#include "OCL_opencl.h"
#include "COM_WorkScheduler.h"
+#include "COM_ReadBufferOperation.h"
/**
* @brief device representing an GPU OpenCL device.
@@ -91,11 +92,12 @@ public:
*/
void execute(WorkPackage *work);
- cl_context getContext(){ return this->m_context; }
+ cl_context getContext() { return this->m_context; }
- cl_command_queue getQueue(){ return this->m_queue; }
+ cl_command_queue getQueue() { return this->m_queue; }
cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader);
+ cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, ReadBufferOperation *reader);
void COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel kernel, int offsetIndex, MemoryBuffer *memoryBuffers);
void COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, cl_mem clOutputMemoryBuffer);
void COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offsetIndex, NodeOperation* operation);
diff --git a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
index a6f81410b74..d14b8c48c89 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
@@ -33,9 +33,9 @@ void SingleThreadedNodeOperation::initExecution()
initMutex();
}
-void SingleThreadedNodeOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void SingleThreadedNodeOperation::executePixel(float *color, int x, int y, void *data)
{
- this->m_cachedInstance->read(color, x, y);
+ this->m_cachedInstance->readNoCheck(color, x, y);
}
void SingleThreadedNodeOperation::deinitExecution()
@@ -46,14 +46,14 @@ void SingleThreadedNodeOperation::deinitExecution()
this->m_cachedInstance = NULL;
}
}
-void *SingleThreadedNodeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *SingleThreadedNodeOperation::initializeTileData(rcti *rect)
{
if (this->m_cachedInstance) return this->m_cachedInstance;
lockMutex();
if (this->m_cachedInstance == NULL) {
//
- this->m_cachedInstance = createMemoryBuffer(rect, memoryBuffers);
+ this->m_cachedInstance = createMemoryBuffer(rect);
}
unlockMutex();
return this->m_cachedInstance;
diff --git a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.h b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.h
index c6db5381f48..68951eab507 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.h
+++ b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
@@ -51,9 +51,9 @@ public:
*/
void deinitExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
- virtual MemoryBuffer *createMemoryBuffer(rcti *rect, MemoryBuffer **memoryBuffers) = 0;
+ virtual MemoryBuffer *createMemoryBuffer(rcti *rect) = 0;
int isSingleThreaded() { return true; }
};
diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h
index 0f35fcfb0df..736dd2fc8b6 100644
--- a/source/blender/compositor/intern/COM_SocketReader.h
+++ b/source/blender/compositor/intern/COM_SocketReader.h
@@ -63,7 +63,7 @@ protected:
* @param y the y-coordinate of the pixel to calculate in image space
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
*/
- virtual void executePixel(float *result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {}
+ virtual void executePixel(float *result, float x, float y, PixelSampler sampler) {}
/**
* @brief calculate a single pixel
@@ -74,8 +74,8 @@ protected:
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
* @param chunkData chunk specific data a during execution time.
*/
- virtual void executePixel(float *result, int x, int y, MemoryBuffer *inputBuffers[], void *chunkData) {
- executePixel(result, x, y, COM_PS_NEAREST, inputBuffers);
+ virtual void executePixel(float *result, int x, int y, void *chunkData) {
+ executePixel(result, x, y, COM_PS_NEAREST);
}
/**
@@ -88,21 +88,21 @@ protected:
* @param dy
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
*/
- virtual void executePixel(float *result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {}
+ virtual void executePixel(float *result, float x, float y, float dx, float dy) {}
public:
- inline void read(float *result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
- executePixel(result, x, y, sampler, inputBuffers);
+ inline void read(float *result, float x, float y, PixelSampler sampler) {
+ executePixel(result, x, y, sampler);
}
- inline void read(float *result, int x, int y, MemoryBuffer *inputBuffers[], void *chunkData) {
- executePixel(result, x, y, inputBuffers, chunkData);
+ inline void read(float *result, int x, int y, void *chunkData) {
+ executePixel(result, x, y, chunkData);
}
- inline void read(float *result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {
- executePixel(result, x, y, dx, dy, inputBuffers);
+ inline void read(float *result, float x, float y, float dx, float dy) {
+ executePixel(result, x, y, dx, dy);
}
- virtual void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { return 0; }
- virtual void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) {
+ virtual void *initializeTileData(rcti *rect) { return 0; }
+ virtual void deinitializeTileData(rcti *rect, void *data) {
}
virtual MemoryBuffer *getInputMemoryBuffer(MemoryBuffer **memoryBuffers) { return 0; }
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index 120b4d6d0f2..7d4134aca13 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -36,10 +36,13 @@
#include "BLI_threads.h"
#if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD
-#warning COM_CURRENT_THREADING_MODEL COM_TM_NOTHREAD is activated. Use only for debugging.
+# ifndef DEBUG /* test this so we dont get warnings in debug builds */
+# warning COM_CURRENT_THREADING_MODEL COM_TM_NOTHREAD is activated. Use only for debugging.
+# endif
#elif COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
+ /* do nothing - default */
#else
-#error COM_CURRENT_THREADING_MODEL No threading model selected
+# error COM_CURRENT_THREADING_MODEL No threading model selected
#endif
@@ -66,6 +69,12 @@ static bool g_openclActive = false;
#endif
#endif
+#define MAX_HIGHLIGHT 8
+extern "C" {
+int g_highlightIndex;
+void ** g_highlightedNodes;
+void ** g_highlightedNodesRead;
+
#define HIGHLIGHT(wp) \
{ \
ExecutionGroup* group = wp->getExecutionGroup(); \
@@ -77,15 +86,42 @@ static bool g_openclActive = false;
bNode *node = complexOperation->getbNode(); \
if (node) { \
if (node->original) { \
- node->original->highlight = 1;\
- } else {\
- node->highlight = 1; \
+ node = node->original;\
+ }\
+ if (g_highlightIndex < MAX_HIGHLIGHT) {\
+ g_highlightedNodes[g_highlightIndex++] = node;\
}\
} \
} \
} \
}
+void COM_startReadHighlights()
+{
+ if (g_highlightedNodesRead) {
+ delete [] g_highlightedNodesRead;
+ }
+
+ g_highlightedNodesRead = g_highlightedNodes;
+ g_highlightedNodes = new void*[MAX_HIGHLIGHT];
+ g_highlightIndex = 0;
+ for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
+ g_highlightedNodes[i] = 0;
+ }
+}
+
+int COM_isHighlightedbNode(bNode* bnode)
+{
+ if (!g_highlightedNodesRead) return false;
+ for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
+ void* p = g_highlightedNodesRead[i];
+ if (!p) return false;
+ if (p == bnode) return true;
+ }
+ return false;
+}
+} // end extern "C"
+
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
void *WorkScheduler::thread_execute_cpu(void *data)
{
@@ -219,6 +255,9 @@ extern void clContextError(const char *errinfo, const void *private_info, size_t
void WorkScheduler::initialize()
{
+ g_highlightedNodesRead = 0;
+ g_highlightedNodes = 0;
+ COM_startReadHighlights();
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
int numberOfCPUThreads = BLI_system_thread_count();
@@ -313,3 +352,4 @@ void WorkScheduler::deinitialize()
#endif
#endif
}
+
diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp
index 5447652c238..9b945887ec2 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BlurNode.cpp
@@ -25,9 +25,13 @@
#include "DNA_node_types.h"
#include "COM_GaussianXBlurOperation.h"
#include "COM_GaussianYBlurOperation.h"
+#include "COM_GaussianAlphaXBlurOperation.h"
+#include "COM_GaussianAlphaYBlurOperation.h"
#include "COM_ExecutionSystem.h"
#include "COM_GaussianBokehBlurOperation.h"
#include "COM_FastGaussianBlurOperation.h"
+#include "COM_MathBaseOperation.h"
+#include "COM_SetValueOperation.h"
BlurNode::BlurNode(bNode *editorNode) : Node(editorNode)
{
@@ -56,6 +60,42 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
graph->addOperation(operationfgb);
addPreviewOperation(graph, operationfgb->getOutputSocket());
}
+ else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_REFERENCE) {
+ MathAddOperation *clamp = new MathAddOperation();
+ SetValueOperation *zero = new SetValueOperation();
+ addLink(graph, zero->getOutputSocket(), clamp->getInputSocket(1));
+ this->getInputSocket(1)->relinkConnections(clamp->getInputSocket(0), 1, graph);
+ zero->setValue(0.0f);
+ clamp->setUseClamp(true);
+ graph->addOperation(clamp);
+ graph->addOperation(zero);
+
+ GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation();
+ operationx->setData(data);
+ operationx->setbNode(editorNode);
+ operationx->setQuality(quality);
+ operationx->setSize(1.0f);
+ addLink(graph, clamp->getOutputSocket(), operationx->getInputSocket(0));
+ graph->addOperation(operationx);
+
+ GaussianYBlurOperation *operationy = new GaussianYBlurOperation();
+ operationy->setData(data);
+ operationy->setbNode(editorNode);
+ operationy->setQuality(quality);
+ operationy->setSize(1.0f);
+ addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
+ graph->addOperation(operationy);
+
+ GaussianBlurReferenceOperation *operation = new GaussianBlurReferenceOperation();
+ operation->setData(data);
+ operation->setbNode(editorNode);
+ operation->setQuality(quality);
+ this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+ addLink(graph, operationy->getOutputSocket(), operation->getInputSocket(1));
+ graph->addOperation(operation);
+ this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
+ addPreviewOperation(graph, operation->getOutputSocket());
+ }
else if (!data->bokeh) {
GaussianXBlurOperation *operationx = new GaussianXBlurOperation();
operationx->setData(data);
diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
index 0ea4b20c793..300193da842 100644
--- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
@@ -37,32 +37,24 @@ BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode)
void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
-// Object *camob = context->getScene()->camera;
+ BokehBlurOperation *operation = new BokehBlurOperation();
+ InputSocket *inputSizeSocket = this->getInputSocket(2);
+ bool connectedSizeSocket = inputSizeSocket->isConnected();
-// if (this->getInputSocket(2)->isConnected()) {
-// VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
-// ConvertDepthToRadiusOperation *converter = new ConvertDepthToRadiusOperation();
-// converter->setfStop(this->getbNode()->custom3);
-// converter->setCameraObject(camob);
-// operation->setMaxBlur((int)this->getbNode()->custom4);
-// operation->setQuality(context->getQuality());
-// this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
-// this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
-// this->getInputSocket(2)->relinkConnections(converter->getInputSocket(0), 2, graph);
-// addLink(graph, converter->getOutputSocket(), operation->getInputSocket(2));
-// graph->addOperation(operation);
-// graph->addOperation(converter);
-// this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-// }
-// else {
- BokehBlurOperation *operation = new BokehBlurOperation();
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph);
- operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value);
- operation->setQuality(context->getQuality());
- operation->setbNode(this->getbNode());
- graph->addOperation(operation);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-// }
+ const bNodeSocket *sock = this->getInputSocket(2)->getbNodeSocket();
+ const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value;
+
+ this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+ this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
+ this->getInputSocket(2)->relinkConnections(operation->getInputSocket(3), 2, graph);
+ this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph);
+ //operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value);
+ operation->setQuality(context->getQuality());
+ operation->setbNode(this->getbNode());
+ graph->addOperation(operation);
+ this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
+
+ if (!connectedSizeSocket) {
+ operation->setSize(size);
+ }
}
diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cpp b/source/blender/compositor/nodes/COM_DefocusNode.cpp
index 05bf907af5a..65825a60b50 100644
--- a/source/blender/compositor/nodes/COM_DefocusNode.cpp
+++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp
@@ -99,9 +99,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
#ifdef COM_DEFOCUS_SEARCH
InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation();
addLink(graph, radiusOperation->getOutputSocket(0), search->getInputSocket(0));
- addLink(graph, depthOperation, search->getInputSocket(1));
search->setMaxBlur(data->maxblur);
- search->setThreshold(data->bthresh);
graph->addOperation(search);
#endif
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
@@ -116,7 +114,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
addLink(graph, bokeh->getOutputSocket(), operation->getInputSocket(1));
addLink(graph, radiusOperation->getOutputSocket(), operation->getInputSocket(2));
#ifdef COM_DEFOCUS_SEARCH
- addLink(graph, search->getOutputSocket(), operation->getInputSocket(4));
+ addLink(graph, search->getOutputSocket(), operation->getInputSocket(3));
#endif
if (data->gamco) {
GammaCorrectOperation *correct = new GammaCorrectOperation();
diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
index dee0e6a88da..85fc63ae8cb 100644
--- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
@@ -37,6 +37,7 @@ void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, Compositor
DirectionalBlurOperation *operation = new DirectionalBlurOperation();
operation->setQuality(context->getQuality());
operation->setData(data);
+ operation->setbNode(this->getbNode());
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
graph->addOperation(operation);
diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp
index 7c39765fbf1..efd50a44a51 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.cpp
+++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp
@@ -184,11 +184,13 @@ OutputSocket *KeyingNode::setupFeather(ExecutionSystem *graph, CompositorContext
return operationy->getOutputSocket();
}
-OutputSocket *KeyingNode::setupDespill(ExecutionSystem *graph, OutputSocket *despillInput, OutputSocket *inputScreen, float factor)
+OutputSocket *KeyingNode::setupDespill(ExecutionSystem *graph, OutputSocket *despillInput, OutputSocket *inputScreen,
+ float factor, float colorBalance)
{
KeyingDespillOperation *despillOperation = new KeyingDespillOperation();
despillOperation->setDespillFactor(factor);
+ despillOperation->setColorBalance(colorBalance);
addLink(graph, despillInput, despillOperation->getInputSocket(0));
addLink(graph, inputScreen, despillOperation->getInputSocket(1));
@@ -292,7 +294,8 @@ void KeyingNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
if (keying_data->despill_factor > 0.0f) {
postprocessedImage = setupDespill(graph, postprocessedImage,
keyingOperation->getInputSocket(1)->getConnection()->getFromSocket(),
- keying_data->despill_factor);
+ keying_data->despill_factor,
+ keying_data->despill_balance);
}
/* connect result to output sockets */
diff --git a/source/blender/compositor/nodes/COM_KeyingNode.h b/source/blender/compositor/nodes/COM_KeyingNode.h
index 294a27bb52c..6ab6a60a44d 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.h
+++ b/source/blender/compositor/nodes/COM_KeyingNode.h
@@ -36,7 +36,8 @@ protected:
OutputSocket *setupDilateErode(ExecutionSystem *graph, OutputSocket *dilateErodeInput, int distance);
OutputSocket *setupFeather(ExecutionSystem *graph, CompositorContext *context, OutputSocket *featherInput,
int falloff, int distance);
- OutputSocket *setupDespill(ExecutionSystem *graph, OutputSocket *despillInput, OutputSocket *inputSrceen, float factor);
+ OutputSocket *setupDespill(ExecutionSystem *graph, OutputSocket *despillInput, OutputSocket *inputSrceen,
+ float factor, float colorBalance);
OutputSocket *setupClip(ExecutionSystem *graph, OutputSocket *clipInput, int kernelRadius, float kernelTolerance,
float clipBlack, float clipWhite, bool edgeMatte);
public:
diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp
index 300c9967cc4..307590b977b 100644
--- a/source/blender/compositor/nodes/COM_MathNode.cpp
+++ b/source/blender/compositor/nodes/COM_MathNode.cpp
@@ -83,10 +83,14 @@ void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
}
if (operation != NULL) {
+ bool useClamp = this->getbNode()->custom2;
+
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
+
+ operation->setUseClamp(useClamp);
+
graph->addOperation(operation);
}
}
diff --git a/source/blender/compositor/nodes/COM_MixNode.cpp b/source/blender/compositor/nodes/COM_MixNode.cpp
index eb62ebd2635..7aeaaf56c98 100644
--- a/source/blender/compositor/nodes/COM_MixNode.cpp
+++ b/source/blender/compositor/nodes/COM_MixNode.cpp
@@ -58,6 +58,8 @@ void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext *con
InputSocket *color2Socket = this->getInputSocket(2);
OutputSocket *outputSocket = this->getOutputSocket(0);
bNode *editorNode = this->getbNode();
+ bool useAlphaPremultiply = this->getbNode()->custom2 & 1;
+ bool useClamp = this->getbNode()->custom2 & 2;
MixBaseOperation *convertProg;
@@ -119,7 +121,8 @@ void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext *con
convertProg = new MixBlendOperation();
break;
}
- convertProg->setUseValueAlphaMultiply(this->getbNode()->custom2);
+ convertProg->setUseValueAlphaMultiply(useAlphaPremultiply);
+ convertProg->setUseClamp(useClamp);
valueSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph);
color1Socket->relinkConnections(convertProg->getInputSocket(1), 1, graph);
diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
index 89bd0e8549e..a250841b160 100644
--- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp
+++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
@@ -81,6 +81,7 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
operation->setMovieClip(movieClip);
operation->setMovieClipUser(movieClipUser);
operation->setFramenumber(context->getFramenumber());
+ operation->setCacheFrame(!context->isRendering());
graph->addOperation(operation);
MovieTrackingStabilization *stab = &movieClip->tracking.stabilization;
diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
new file mode 100644
index 00000000000..243f63a0149
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Sergey Sharybin
+ */
+
+#include "COM_TrackPositionNode.h"
+#include "COM_ExecutionSystem.h"
+#include "COM_TrackPositionOperation.h"
+
+extern "C" {
+ #include "DNA_movieclip_types.h"
+}
+
+TrackPositionNode::TrackPositionNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
+
+void TrackPositionNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+{
+ OutputSocket *outputX = this->getOutputSocket(0);
+ OutputSocket *outputY = this->getOutputSocket(1);
+
+ bNode *editorNode = this->getbNode();
+ MovieClip *clip = (MovieClip *) editorNode->id;
+
+ NodeTrackPosData *trackpos_data = (NodeTrackPosData *) editorNode->storage;
+
+ TrackPositionOperation *operationX = new TrackPositionOperation();
+ TrackPositionOperation *operationY = new TrackPositionOperation();
+
+ operationX->setMovieClip(clip);
+ operationX->setTrackingObject(trackpos_data->tracking_object);
+ operationX->setTrackName(trackpos_data->track_name);
+ operationX->setFramenumber(context->getFramenumber());
+ operationX->setAxis(0);
+ operationX->setRelative(editorNode->custom1);
+
+ operationY->setMovieClip(clip);
+ operationY->setTrackingObject(trackpos_data->tracking_object);
+ operationY->setTrackName(trackpos_data->track_name);
+ operationY->setFramenumber(context->getFramenumber());
+ operationY->setAxis(1);
+ operationY->setRelative(editorNode->custom1);
+
+ outputX->relinkConnections(operationX->getOutputSocket());
+ outputY->relinkConnections(operationY->getOutputSocket());
+
+ graph->addOperation(operationX);
+}
diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.h b/source/blender/compositor/nodes/COM_TrackPositionNode.h
new file mode 100644
index 00000000000..3d92ec3978c
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_TrackPositionNode.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Sergey Sharybin
+ */
+
+#include "COM_Node.h"
+#include "DNA_node_types.h"
+
+/**
+ * @brief TrackPositionNode
+ * @ingroup Node
+ */
+class TrackPositionNode : public Node {
+public:
+ TrackPositionNode(bNode *editorNode);
+ void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+
+};
diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp
index e688332a039..406a98f81e9 100644
--- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp
@@ -27,15 +27,15 @@ AlphaOverKeyOperation::AlphaOverKeyOperation() : MixBaseOperation()
/* pass */
}
-void AlphaOverKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void AlphaOverKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputOverColor[4];
float value[4];
- this->m_inputValueOperation->read(value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(value, x, y, sampler);
+ this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
+ this->m_inputColor2Operation->read(inputOverColor, x, y, sampler);
if (inputOverColor[3] <= 0.0f) {
copy_v4_v4(outputValue, inputColor1);
diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h
index 113ec245ee6..5f430efb98e 100644
--- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h
+++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h
@@ -39,6 +39,6 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
index e56fb9151f2..b94486b5b4f 100644
--- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
@@ -27,15 +27,15 @@ AlphaOverMixedOperation::AlphaOverMixedOperation() : MixBaseOperation()
this->m_x = 0.0f;
}
-void AlphaOverMixedOperation::executePixel(float outputValue[4], float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void AlphaOverMixedOperation::executePixel(float outputValue[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputOverColor[4];
float value[4];
- this->m_inputValueOperation->read(value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(value, x, y, sampler);
+ this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
+ this->m_inputColor2Operation->read(inputOverColor, x, y, sampler);
if (inputOverColor[3] <= 0.0f) {
copy_v4_v4(outputValue, inputColor1);
diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h
index 3c0b955e360..308f139884d 100644
--- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h
+++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h
@@ -41,7 +41,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void setX(float x) { this->m_x = x; }
};
diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
index b2c40a058ba..dad43f3b179 100644
--- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
@@ -27,15 +27,15 @@ AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation() : MixBaseOperatio
/* pass */
}
-void AlphaOverPremultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void AlphaOverPremultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputOverColor[4];
float value[4];
- this->m_inputValueOperation->read(value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(value, x, y, sampler);
+ this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
+ this->m_inputColor2Operation->read(inputOverColor, x, y, sampler);
/* Zero alpha values should still permit an add of RGB data */
if (inputOverColor[3] < 0.0f) {
diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h
index 7b7b9238794..37ddc6dcda5 100644
--- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h
+++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
index 46fa07893e8..27ba2ef51f6 100644
--- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
+++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
@@ -42,7 +42,7 @@ void AntiAliasOperation::initExecution()
NodeOperation::initMutex();
}
-void AntiAliasOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void AntiAliasOperation::executePixel(float *color, int x, int y, void *data)
{
if (y < 0 || (unsigned int)y >= this->m_height || x < 0 || (unsigned int)x >= this->m_width) {
color[0] = 0.0f;
@@ -82,12 +82,12 @@ bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
return false;
}
-void *AntiAliasOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *AntiAliasOperation::initializeTileData(rcti *rect)
{
if (this->m_buffer) { return this->m_buffer; }
lockMutex();
if (this->m_buffer == NULL) {
- MemoryBuffer *tile = (MemoryBuffer *)this->m_valueReader->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_valueReader->initializeTileData(rect);
int size = tile->getHeight() * tile->getWidth();
float *input = tile->getBuffer();
char *valuebuffer = new char[size];
diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.h b/source/blender/compositor/operations/COM_AntiAliasOperation.h
index 3d9bcf6d90a..7489d2e393a 100644
--- a/source/blender/compositor/operations/COM_AntiAliasOperation.h
+++ b/source/blender/compositor/operations/COM_AntiAliasOperation.h
@@ -43,14 +43,14 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
/**
* Deinitialize the execution
diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
index 4f7f5eea8a0..1db3ecb2db8 100644
--- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
@@ -46,7 +46,7 @@ void BilateralBlurOperation::initExecution()
QualityStepHelper::initExecution(COM_QH_INCREASE);
}
-void BilateralBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void BilateralBlurOperation::executePixel(float *color, int x, int y, void *data)
{
// read the determinator color at x, y, this will be used as the reference color for the determinator
float determinatorReferenceColor[4];
@@ -61,20 +61,20 @@ void BilateralBlurOperation::executePixel(float *color, int x, int y, MemoryBuff
int miny = floor(y - space);
int maxy = ceil(y + space);
float deltaColor;
- this->m_inputDeterminatorProgram->read(determinatorReferenceColor, x, y, inputBuffers, data);
+ this->m_inputDeterminatorProgram->read(determinatorReferenceColor, x, y, data);
zero_v4(blurColor);
blurDivider = 0.0f;
for (int yi = miny; yi < maxy; yi += QualityStepHelper::getStep()) {
for (int xi = minx; xi < maxx; xi += QualityStepHelper::getStep()) {
// read determinator
- this->m_inputDeterminatorProgram->read(determinator, xi, yi, inputBuffers, data);
+ this->m_inputDeterminatorProgram->read(determinator, xi, yi, data);
deltaColor = (fabsf(determinatorReferenceColor[0] - determinator[0]) +
fabsf(determinatorReferenceColor[1] - determinator[1]) +
fabsf(determinatorReferenceColor[2] - determinator[2])); // do not take the alpha channel into account
if (deltaColor < sigmacolor) {
// add this to the blur
- this->m_inputColorProgram->read(tempColor, xi, yi, inputBuffers, data);
+ this->m_inputColorProgram->read(tempColor, xi, yi, data);
add_v4_v4(blurColor, tempColor);
blurDivider += 1.0f;
}
diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.h b/source/blender/compositor/operations/COM_BilateralBlurOperation.h
index be6ce7a221e..c1b5f764f01 100644
--- a/source/blender/compositor/operations/COM_BilateralBlurOperation.h
+++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.h
@@ -38,7 +38,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index 696c0748d69..98aeba41ecb 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -140,11 +140,11 @@ void BlurBaseOperation::deinitExecution()
this->m_data = NULL;
}
-void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers)
+void BlurBaseOperation::updateSize()
{
if (!this->m_sizeavailable) {
float result[4];
- this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers);
+ this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST);
this->m_size = result[0];
this->m_sizeavailable = true;
}
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h
index 6d60abf09bf..d8729ad4394 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.h
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h
@@ -34,7 +34,7 @@ protected:
float *make_gausstab(int rad);
float *make_dist_fac_inverse(int rad, int falloff);
- void updateSize(MemoryBuffer **memoryBuffers);
+ void updateSize();
/**
* Cached reference to the inputProgram
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
index e83ad4824e4..ef28d55dbc8 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
@@ -33,25 +33,32 @@ BokehBlurOperation::BokehBlurOperation() : NodeOperation()
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
this->addInputSocket(COM_DT_VALUE);
+ this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_COLOR);
this->setComplex(true);
this->setOpenCL(true);
this->m_size = 1.0f;
-
+ this->m_sizeavailable = false;
this->m_inputProgram = NULL;
this->m_inputBokehProgram = NULL;
this->m_inputBoundingBoxReader = NULL;
}
-void *BokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *BokehBlurOperation::initializeTileData(rcti *rect)
{
- void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
+ lockMutex();
+ if (!this->m_sizeavailable) {
+ updateSize();
+ }
+ void *buffer = getInputOperation(0)->initializeTileData(NULL);
+ unlockMutex();
return buffer;
}
void BokehBlurOperation::initExecution()
{
+ initMutex();
this->m_inputProgram = getInputSocketReader(0);
this->m_inputBokehProgram = getInputSocketReader(1);
this->m_inputBoundingBoxReader = getInputSocketReader(2);
@@ -72,13 +79,13 @@ void BokehBlurOperation::initExecution()
QualityStepHelper::initExecution(COM_QH_INCREASE);
}
-void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void BokehBlurOperation::executePixel(float *color, int x, int y, void *data)
{
float color_accum[4];
float tempBoundingBox[4];
float bokeh[4];
- this->m_inputBoundingBoxReader->read(tempBoundingBox, x, y, COM_PS_NEAREST, inputBuffers);
+ this->m_inputBoundingBoxReader->read(tempBoundingBox, x, y, COM_PS_NEAREST);
if (tempBoundingBox[0] > 0.0f) {
float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
@@ -87,7 +94,10 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
int bufferstartx = inputBuffer->getRect()->xmin;
int bufferstarty = inputBuffer->getRect()->ymin;
int pixelSize = this->m_size * this->getWidth() / 100.0f;
-
+ if (pixelSize==0) {
+ this->m_inputProgram->read(color, x, y, COM_PS_NEAREST);
+ return;
+ }
int miny = y - pixelSize;
int maxy = y + pixelSize;
int minx = x - pixelSize;
@@ -108,7 +118,7 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
for (int nx = minx; nx < maxx; nx += step) {
float u = this->m_bokehMidX - (nx - x) * m;
float v = this->m_bokehMidY - (ny - y) * m;
- this->m_inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers);
+ this->m_inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST);
madd_v4_v4v4(color_accum, bokeh, &buffer[bufferindex]);
add_v4_v4(multiplier_accum, bokeh);
bufferindex += offsetadd;
@@ -120,12 +130,13 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
color[3] = color_accum[3] * (1.0f / multiplier_accum[3]);
}
else {
- this->m_inputProgram->read(color, x, y, COM_PS_NEAREST, inputBuffers);
+ this->m_inputProgram->read(color, x, y, COM_PS_NEAREST);
}
}
void BokehBlurOperation::deinitExecution()
{
+ deinitMutex();
this->m_inputProgram = NULL;
this->m_inputBokehProgram = NULL;
this->m_inputBoundingBoxReader = NULL;
@@ -136,10 +147,17 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
rcti newInput;
rcti bokehInput;
- newInput.xmax = input->xmax + (this->m_size * this->getWidth() / 100.0f);
- newInput.xmin = input->xmin - (this->m_size * this->getWidth() / 100.0f);
- newInput.ymax = input->ymax + (this->m_size * this->getWidth() / 100.0f);
- newInput.ymin = input->ymin - (this->m_size * this->getWidth() / 100.0f);
+ if (this->m_sizeavailable) {
+ newInput.xmax = input->xmax + (this->m_size * this->getWidth() / 100.0f);
+ newInput.xmin = input->xmin - (this->m_size * this->getWidth() / 100.0f);
+ newInput.ymax = input->ymax + (this->m_size * this->getWidth() / 100.0f);
+ newInput.ymin = input->ymin - (this->m_size * this->getWidth() / 100.0f);
+ } else {
+ newInput.xmax = input->xmax + (10.0f * this->getWidth() / 100.0f);
+ newInput.xmin = input->xmin - (10.0f * this->getWidth() / 100.0f);
+ newInput.ymax = input->ymax + (10.0f * this->getWidth() / 100.0f);
+ newInput.ymin = input->ymin - (10.0f * this->getWidth() / 100.0f);
+ }
NodeOperation *operation = getInputOperation(1);
bokehInput.xmax = operation->getWidth();
@@ -157,6 +175,17 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
if (operation->determineDependingAreaOfInterest(input, readOperation, output) ) {
return true;
}
+ if (!this->m_sizeavailable) {
+ rcti sizeInput;
+ sizeInput.xmin = 0;
+ sizeInput.ymin = 0;
+ sizeInput.xmax = 5;
+ sizeInput.ymax = 5;
+ operation = getInputOperation(3);
+ if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output) ) {
+ return true;
+ }
+ }
return false;
}
@@ -166,7 +195,9 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice* device,
list<cl_kernel> *clKernelsToCleanUp)
{
cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", NULL);
-
+ if (!this->m_sizeavailable) {
+ updateSize();
+ }
cl_int radius = this->getWidth() * this->m_size / 100.0f;
cl_int step = this->getStep();
@@ -181,3 +212,14 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice* device,
device->COM_clEnqueueRange(kernel, outputMemoryBuffer, 9, this);
}
+
+void BokehBlurOperation::updateSize()
+{
+ if (!this->m_sizeavailable) {
+ float result[4];
+ this->getInputSocketReader(3)->read(result, 0, 0, COM_PS_NEAREST);
+ this->m_size = result[0];
+ CLAMP(this->m_size, 0.0f, 10.0f);
+ this->m_sizeavailable = true;
+ }
+}
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.h b/source/blender/compositor/operations/COM_BokehBlurOperation.h
index 0433a4156a8..eef5429c409 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.h
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.h
@@ -30,18 +30,20 @@ private:
SocketReader *m_inputProgram;
SocketReader *m_inputBokehProgram;
SocketReader *m_inputBoundingBoxReader;
+ void updateSize();
float m_size;
+ bool m_sizeavailable;
float m_bokehMidX;
float m_bokehMidY;
float m_bokehDimension;
public:
BokehBlurOperation();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
@@ -55,7 +57,7 @@ public:
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void setSize(float size) { this->m_size = size; }
+ void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; }
void executeOpenCL(OpenCLDevice* device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp);
};
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp
index 90e272438d6..d7de201e9df 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp
@@ -87,7 +87,7 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y)
}
return insideBokeh;
}
-void BokehImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void BokehImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float shift = this->m_data->lensshift;
float shift2 = shift / 2.0f;
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h
index 085aaa471f0..a797d0fca53 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.h
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.h
@@ -47,7 +47,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
index 96738a2920a..a0fb37f4310 100644
--- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
@@ -44,7 +44,7 @@ void BoxMaskOperation::initExecution()
this->m_aspectRatio = ((float)this->getWidth()) / this->getHeight();
}
-void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inputMask[4];
float inputValue[4];
@@ -57,8 +57,8 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler
rx = this->m_data->x + (this->m_cosine * dx + this->m_sine * dy);
ry = this->m_data->y + (-this->m_sine * dx + this->m_cosine * dy);
- this->m_inputMask->read(inputMask, x, y, sampler, inputBuffers);
- this->m_inputValue->read(inputValue, x, y, sampler, inputBuffers);
+ this->m_inputMask->read(inputMask, x, y, sampler);
+ this->m_inputValue->read(inputValue, x, y, sampler);
float halfHeight = this->m_data->height / 2.0f;
float halfWidth = this->m_data->width / 2.0f;
diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.h b/source/blender/compositor/operations/COM_BoxMaskOperation.h
index cec680ef6c3..5a6745d9a9b 100644
--- a/source/blender/compositor/operations/COM_BoxMaskOperation.h
+++ b/source/blender/compositor/operations/COM_BoxMaskOperation.h
@@ -45,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
index 8c9fb6394a7..9a6a930c7c9 100644
--- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp
+++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
@@ -37,15 +37,15 @@ void BrightnessOperation::initExecution()
this->m_inputContrastProgram = this->getInputSocketReader(2);
}
-void BrightnessOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void BrightnessOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inputValue[4];
float a, b;
float inputBrightness[4];
float inputContrast[4];
- this->m_inputProgram->read(inputValue, x, y, sampler, inputBuffers);
- this->m_inputBrightnessProgram->read(inputBrightness, x, y, sampler, inputBuffers);
- this->m_inputContrastProgram->read(inputContrast, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(inputValue, x, y, sampler);
+ this->m_inputBrightnessProgram->read(inputBrightness, x, y, sampler);
+ this->m_inputContrastProgram->read(inputContrast, x, y, sampler);
float brightness = inputBrightness[0];
float contrast = inputContrast[0];
brightness /= 100.0f;
diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.h b/source/blender/compositor/operations/COM_BrightnessOperation.h
index 61f667aa1be..2a6200ad9df 100644
--- a/source/blender/compositor/operations/COM_BrightnessOperation.h
+++ b/source/blender/compositor/operations/COM_BrightnessOperation.h
@@ -40,7 +40,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp
index a1c679b3e15..b0cfdb44736 100644
--- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp
+++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp
@@ -42,7 +42,7 @@ void CalculateMeanOperation::initExecution()
NodeOperation::initMutex();
}
-void CalculateMeanOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void CalculateMeanOperation::executePixel(float *color, int x, int y, void *data)
{
color[0] = this->m_result;
}
@@ -70,11 +70,11 @@ bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti *input, ReadB
return false;
}
-void *CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *CalculateMeanOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_iscalculated) {
- MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect);
calculateMean(tile);
this->m_iscalculated = true;
}
diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.h b/source/blender/compositor/operations/COM_CalculateMeanOperation.h
index 2bd723c40a3..09727533306 100644
--- a/source/blender/compositor/operations/COM_CalculateMeanOperation.h
+++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.h
@@ -46,14 +46,14 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
/**
* Deinitialize the execution
diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
index 2d860df449c..de602ba1dd6 100644
--- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
+++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
@@ -31,16 +31,16 @@ CalculateStandardDeviationOperation::CalculateStandardDeviationOperation() : Cal
/* pass */
}
-void CalculateStandardDeviationOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void CalculateStandardDeviationOperation::executePixel(float *color, int x, int y, void *data)
{
color[0] = this->m_standardDeviation;
}
-void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_iscalculated) {
- MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect);
CalculateMeanOperation::calculateMean(tile);
this->m_standardDeviation = 0.0f;
float *buffer = tile->getBuffer();
diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h
index 506c5d6fe3a..311cedd7d32 100644
--- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h
+++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h
@@ -39,9 +39,9 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
};
#endif
diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
index 0812dd45bf6..7a6a22e5c05 100644
--- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
@@ -39,11 +39,11 @@ void ChangeHSVOperation::deinitExecution()
this->m_inputOperation = NULL;
}
-void ChangeHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ChangeHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
- this->m_inputOperation->read(inputColor1, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(inputColor1, x, y, sampler);
outputValue[0] = inputColor1[0] + (this->m_hue - 0.5f);
if (outputValue[0] > 1.0f) outputValue[0] -= 1.0f;
diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h
index ee35fbe01d4..e5660e44f73 100644
--- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h
+++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h
@@ -49,7 +49,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void setHue(float hue) { this->m_hue = hue; }
void setSaturation(float saturation) { this->m_saturation = saturation; }
diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
index b2de934e6d8..85f606fafdf 100644
--- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
@@ -83,7 +83,7 @@ void ChannelMatteOperation::deinitExecution()
this->m_inputImageProgram = NULL;
}
-void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inColor[4];
float alpha;
@@ -92,7 +92,7 @@ void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, P
const float limit_min = this->m_limit_min;
const float limit_range = this->m_limit_range;
- this->m_inputImageProgram->read(inColor, x, y, sampler, inputBuffers);
+ this->m_inputImageProgram->read(inColor, x, y, sampler);
/* matte operation */
alpha = inColor[this->m_ids[0]] - max(inColor[this->m_ids[1]], inColor[this->m_ids[2]]);
diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.h b/source/blender/compositor/operations/COM_ChannelMatteOperation.h
index ee17036a78d..a02d0618a4c 100644
--- a/source/blender/compositor/operations/COM_ChannelMatteOperation.h
+++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.h
@@ -59,7 +59,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
index e88feb6db9c..85a19d7c60f 100644
--- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
@@ -44,7 +44,7 @@ void ChromaMatteOperation::deinitExecution()
this->m_inputKeyProgram = NULL;
}
-void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inKey[4];
float inImage[4];
@@ -57,8 +57,8 @@ void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, Pi
float theta, beta;
float kfg;
- this->m_inputKeyProgram->read(inKey, x, y, sampler, inputBuffers);
- this->m_inputImageProgram->read(inImage, x, y, sampler, inputBuffers);
+ this->m_inputKeyProgram->read(inKey, x, y, sampler);
+ this->m_inputImageProgram->read(inImage, x, y, sampler);
/* store matte(alpha) value in [0] to go with
* COM_SetAlphaOperation and the Value output
diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.h b/source/blender/compositor/operations/COM_ChromaMatteOperation.h
index eaca05e66ca..37b58fa45ed 100644
--- a/source/blender/compositor/operations/COM_ChromaMatteOperation.h
+++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.h
@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
index 66ce86234b7..33e6db22ef4 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
@@ -49,13 +49,13 @@ void ColorBalanceASCCDLOperation::initExecution()
this->m_inputColorOperation = this->getInputSocketReader(1);
}
-void ColorBalanceASCCDLOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ColorBalanceASCCDLOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler)
{
float inputColor[4];
float value[4];
- this->m_inputValueOperation->read(value, x, y, sampler, inputBuffers);
- this->m_inputColorOperation->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(value, x, y, sampler);
+ this->m_inputColorOperation->read(inputColor, x, y, sampler);
float fac = value[0];
fac = min(1.0f, fac);
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
index a9c0dff9ad4..d6361ea16ba 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
@@ -49,7 +49,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
index 13863a9ec5a..b0691925361 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
@@ -54,13 +54,13 @@ void ColorBalanceLGGOperation::initExecution()
this->m_inputColorOperation = this->getInputSocketReader(1);
}
-void ColorBalanceLGGOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ColorBalanceLGGOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler)
{
float inputColor[4];
float value[4];
- this->m_inputValueOperation->read(value, x, y, sampler, inputBuffers);
- this->m_inputColorOperation->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(value, x, y, sampler);
+ this->m_inputColorOperation->read(inputColor, x, y, sampler);
float fac = value[0];
fac = min(1.0f, fac);
diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h
index ffc78fae6f1..c3d44c53e53 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h
+++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h
@@ -50,7 +50,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
index 8008866752f..ebc818b0f7e 100644
--- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
@@ -40,12 +40,12 @@ void ColorCorrectionOperation::initExecution()
this->m_inputMask = this->getInputSocketReader(1);
}
-void ColorCorrectionOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ColorCorrectionOperation::executePixel(float *output, float x, float y, PixelSampler sampler)
{
float inputImageColor[4];
float inputMask[4];
- this->m_inputImage->read(inputImageColor, x, y, sampler, inputBuffers);
- this->m_inputMask->read(inputMask, x, y, sampler, inputBuffers);
+ this->m_inputImage->read(inputImageColor, x, y, sampler);
+ this->m_inputMask->read(inputMask, x, y, sampler);
float level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2]) / 3.0f;
float contrast = this->m_data->master.contrast;
diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h
index 8db3870709e..685413741fa 100644
--- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h
+++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
index 9848d191c04..88bd673a19f 100644
--- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
@@ -58,7 +58,7 @@ void ColorCurveOperation::initExecution()
}
-void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
CurveMapping *cumap = this->m_curveMapping;
CurveMapping *workingCopy = (CurveMapping *)MEM_dupallocN(cumap);
@@ -68,13 +68,13 @@ void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSamp
float fac[4];
float image[4];
- this->m_inputBlackProgram->read(black, x, y, sampler, inputBuffers);
- this->m_inputWhiteProgram->read(white, x, y, sampler, inputBuffers);
+ this->m_inputBlackProgram->read(black, x, y, sampler);
+ this->m_inputWhiteProgram->read(white, x, y, sampler);
curvemapping_set_black_white(workingCopy, black, white);
- this->m_inputFacProgram->read(fac, x, y, sampler, inputBuffers);
- this->m_inputImageProgram->read(image, x, y, sampler, inputBuffers);
+ this->m_inputFacProgram->read(fac, x, y, sampler);
+ this->m_inputImageProgram->read(image, x, y, sampler);
if (*fac >= 1.0f)
curvemapping_evaluate_premulRGBF(workingCopy, color, image);
@@ -126,14 +126,14 @@ void ConstantLevelColorCurveOperation::initExecution()
curvemapping_set_black_white(this->m_curveMapping, this->m_black, this->m_white);
}
-void ConstantLevelColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConstantLevelColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float fac[4];
float image[4];
- this->m_inputFacProgram->read(fac, x, y, sampler, inputBuffers);
- this->m_inputImageProgram->read(image, x, y, sampler, inputBuffers);
+ this->m_inputFacProgram->read(fac, x, y, sampler);
+ this->m_inputImageProgram->read(image, x, y, sampler);
if (*fac >= 1.0f)
curvemapping_evaluate_premulRGBF(this->m_curveMapping, color, image);
diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.h b/source/blender/compositor/operations/COM_ColorCurveOperation.h
index 3bcbc31650c..beb2e16298a 100644
--- a/source/blender/compositor/operations/COM_ColorCurveOperation.h
+++ b/source/blender/compositor/operations/COM_ColorCurveOperation.h
@@ -41,7 +41,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
@@ -70,7 +70,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
index 4a01499b060..5326e397494 100644
--- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
@@ -44,7 +44,7 @@ void ColorMatteOperation::deinitExecution()
this->m_inputKeyProgram = NULL;
}
-void ColorMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ColorMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inColor[4];
float inKey[4];
@@ -55,8 +55,8 @@ void ColorMatteOperation::executePixel(float *outputValue, float x, float y, Pix
float h_wrap;
- this->m_inputImageProgram->read(inColor, x, y, sampler, inputBuffers);
- this->m_inputKeyProgram->read(inKey, x, y, sampler, inputBuffers);
+ this->m_inputImageProgram->read(inColor, x, y, sampler);
+ this->m_inputKeyProgram->read(inKey, x, y, sampler);
/* store matte(alpha) value in [0] to go with
diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.h b/source/blender/compositor/operations/COM_ColorMatteOperation.h
index d996ce34667..de7c4dd8ce2 100644
--- a/source/blender/compositor/operations/COM_ColorMatteOperation.h
+++ b/source/blender/compositor/operations/COM_ColorMatteOperation.h
@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.cpp b/source/blender/compositor/operations/COM_ColorRampOperation.cpp
index 95dca0dc410..edd7df89c81 100644
--- a/source/blender/compositor/operations/COM_ColorRampOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorRampOperation.cpp
@@ -43,11 +43,11 @@ void ColorRampOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
-void ColorRampOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ColorRampOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float values[4];
- this->m_inputProgram->read(values, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(values, x, y, sampler);
do_colorband(this->m_colorBand, values[0], color);
}
diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.h b/source/blender/compositor/operations/COM_ColorRampOperation.h
index 42bc6b943b7..c5f3fe449de 100644
--- a/source/blender/compositor/operations/COM_ColorRampOperation.h
+++ b/source/blender/compositor/operations/COM_ColorRampOperation.h
@@ -38,7 +38,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
index e2773f3a6b4..2c0bfc10bb0 100644
--- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
@@ -84,12 +84,12 @@ void ColorSpillOperation::deinitExecution()
this->m_inputFacReader = NULL;
}
-void ColorSpillOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ColorSpillOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float fac[4];
float input[4];
- this->m_inputFacReader->read(fac, x, y, sampler, inputBuffers);
- this->m_inputImageReader->read(input, x, y, sampler, inputBuffers);
+ this->m_inputFacReader->read(fac, x, y, sampler);
+ this->m_inputImageReader->read(input, x, y, sampler);
float rfac = min(1.0f, fac[0]);
float map = calculateMapValue(rfac, input);
if (map > 0.0f) {
diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.h b/source/blender/compositor/operations/COM_ColorSpillOperation.h
index 7aac612cb8c..ea443f2a5a1 100644
--- a/source/blender/compositor/operations/COM_ColorSpillOperation.h
+++ b/source/blender/compositor/operations/COM_ColorSpillOperation.h
@@ -46,7 +46,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp b/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp
index 9f175a381a4..d05040c4c12 100644
--- a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp
+++ b/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp
@@ -78,24 +78,24 @@ void CombineChannelsOperation::deinitExecution()
}
-void CombineChannelsOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void CombineChannelsOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float input[4];
/// @todo: remove if statements
if (this->m_inputChannel1Operation) {
- this->m_inputChannel1Operation->read(input, x, y, sampler, inputBuffers);
+ this->m_inputChannel1Operation->read(input, x, y, sampler);
color[0] = input[0];
}
if (this->m_inputChannel2Operation) {
- this->m_inputChannel2Operation->read(input, x, y, sampler, inputBuffers);
+ this->m_inputChannel2Operation->read(input, x, y, sampler);
color[1] = input[0];
}
if (this->m_inputChannel3Operation) {
- this->m_inputChannel3Operation->read(input, x, y, sampler, inputBuffers);
+ this->m_inputChannel3Operation->read(input, x, y, sampler);
color[2] = input[0];
}
if (this->m_inputChannel4Operation) {
- this->m_inputChannel4Operation->read(input, x, y, sampler, inputBuffers);
+ this->m_inputChannel4Operation->read(input, x, y, sampler);
color[3] = input[0];
}
}
diff --git a/source/blender/compositor/operations/COM_CombineChannelsOperation.h b/source/blender/compositor/operations/COM_CombineChannelsOperation.h
index 8e4c2120614..ff1251a3949 100644
--- a/source/blender/compositor/operations/COM_CombineChannelsOperation.h
+++ b/source/blender/compositor/operations/COM_CombineChannelsOperation.h
@@ -33,7 +33,7 @@ private:
SocketReader *m_inputChannel4Operation;
public:
CombineChannelsOperation();
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index 717b6ce76cc..43aad4f19d9 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -27,6 +27,7 @@
#include "BKE_image.h"
extern "C" {
+ #include "BLI_threads.h"
#include "RE_pipeline.h"
#include "RE_shader_ext.h"
#include "RE_render_ext.h"
@@ -63,6 +64,7 @@ void CompositorOperation::deinitExecution()
const RenderData *rd = this->m_rd;
Render *re = RE_GetRender_FromData(rd);
RenderResult *rr = RE_AcquireResultWrite(re);
+
if (rr) {
if (rr->rectf != NULL) {
MEM_freeN(rr->rectf);
@@ -75,7 +77,9 @@ void CompositorOperation::deinitExecution()
}
}
+ BLI_lock_thread(LOCK_DRAW_IMAGE);
BKE_image_signal(BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"), NULL, IMA_SIGNAL_FREE);
+ BLI_unlock_thread(LOCK_DRAW_IMAGE);
if (re) {
RE_ReleaseResult(re);
@@ -94,7 +98,7 @@ void CompositorOperation::deinitExecution()
}
-void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
+void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
float color[8]; // 7 is enough
float *buffer = this->m_outputBuffer;
@@ -111,9 +115,9 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, Mem
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2 && (!breaked); x++) {
- this->m_imageInput->read(color, x, y, COM_PS_NEAREST, memoryBuffers);
+ this->m_imageInput->read(color, x, y, COM_PS_NEAREST);
if (this->m_alphaInput != NULL) {
- this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST, memoryBuffers);
+ this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST);
}
copy_v4_v4(buffer + offset, color);
offset += COM_NUMBER_OF_CHANNELS;
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h
index 2719d376339..23d34abbfff 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.h
+++ b/source/blender/compositor/operations/COM_CompositorOperation.h
@@ -52,7 +52,7 @@ private:
SocketReader *m_alphaInput;
public:
CompositorOperation();
- void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
+ void executeRegion(rcti *rect, unsigned int tileNumber);
void setRenderData(const RenderData *rd) { this->m_rd = rd; }
bool isOutputOperation(bool rendering) const { return true; }
void initExecution();
diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
index 4d829eae7a0..c7272d461d6 100644
--- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
@@ -38,10 +38,10 @@ void ConvertColorProfileOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertColorProfileOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertColorProfileOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float color[4];
- this->m_inputOperation->read(color, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(color, x, y, sampler);
IMB_buffer_float_from_float(outputValue, color, 4, this->m_toProfile, this->m_fromProfile, this->m_predivided, 1, 1, 0, 0);
}
diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h
index b237448d16e..09d96a92d95 100644
--- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h
@@ -59,7 +59,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp
index a8c57449a2e..4da09a69a15 100644
--- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp
@@ -34,10 +34,10 @@ void ConvertColorToBWOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertColorToBWOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertColorToBWOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor[4];
- this->m_inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(&inputColor[0], x, y, sampler);
outputValue[0] = rgb_to_bw(inputColor);
}
diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h
index 9c62ad8dd39..a9951af2e3b 100644
--- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp b/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp
index c09842b1aa9..17bd34d51b0 100644
--- a/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp
+++ b/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp
@@ -34,10 +34,10 @@ void ConvertColorToValueProg::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertColorToValueProg::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertColorToValueProg::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor[4];
- this->m_inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(&inputColor[0], x, y, sampler);
outputValue[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f;
}
diff --git a/source/blender/compositor/operations/COM_ConvertColorToValueProg.h b/source/blender/compositor/operations/COM_ConvertColorToValueProg.h
index c1ac7ca69ce..6a20d4bf27a 100644
--- a/source/blender/compositor/operations/COM_ConvertColorToValueProg.h
+++ b/source/blender/compositor/operations/COM_ConvertColorToValueProg.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp
index 6c79c4ea6a3..ec1f0fd37e4 100644
--- a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp
@@ -34,9 +34,9 @@ void ConvertColorToVectorOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertColorToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertColorToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
- this->m_inputOperation->read(outputValue, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(outputValue, x, y, sampler);
}
void ConvertColorToVectorOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h
index 51fa3a677cd..861807db8db 100644
--- a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
index b4319d25d13..80416bbccdf 100644
--- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
@@ -75,12 +75,12 @@ void ConvertDepthToRadiusOperation::initExecution()
}
}
-void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue[4];
float z;
float radius;
- this->m_inputOperation->read(inputValue, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(inputValue, x, y, sampler);
z = inputValue[0];
if (z != 0.f) {
float iZ = (1.f / z);
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h
index f0e905db9c2..4f80ef69f43 100644
--- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h
@@ -54,7 +54,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp
index 5149e370208..4b42de26f59 100644
--- a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp
@@ -35,10 +35,10 @@ void ConvertHSVToRGBOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertHSVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertHSVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor[4];
- this->m_inputOperation->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(inputColor, x, y, sampler);
hsv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor[3];
}
diff --git a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h
index 3babbfb7c1d..28ce70170a0 100644
--- a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp
index b7db0a6a2c7..787b1a4547c 100644
--- a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp
@@ -35,12 +35,12 @@ void ConvertKeyToPremulOperation::initExecution()
this->m_inputColor = getInputSocketReader(0);
}
-void ConvertKeyToPremulOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertKeyToPremulOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue[4];
float alpha;
- this->m_inputColor->read(inputValue, x, y, sampler, inputBuffers);
+ this->m_inputColor->read(inputValue, x, y, sampler);
alpha = inputValue[3];
mul_v3_v3fl(outputValue, inputValue, alpha);
diff --git a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h
index 50b39928305..a1a8836a690 100644
--- a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h
@@ -40,7 +40,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp
index 0ba23b2ec2e..22cfdd2f572 100644
--- a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp
@@ -35,12 +35,12 @@ void ConvertPremulToKeyOperation::initExecution()
this->m_inputColor = getInputSocketReader(0);
}
-void ConvertPremulToKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertPremulToKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue[4];
float alpha;
- this->m_inputColor->read(inputValue, x, y, sampler, inputBuffers);
+ this->m_inputColor->read(inputValue, x, y, sampler);
alpha = inputValue[3];
if (fabsf(alpha) < 1e-5f) {
diff --git a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h
index 173cbb4fc0a..fb83a06c25d 100644
--- a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h
@@ -40,7 +40,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp
index dd5e9907642..8478eac75b0 100644
--- a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp
@@ -35,10 +35,10 @@ void ConvertRGBToHSVOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertRGBToHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertRGBToHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor[4];
- this->m_inputOperation->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(inputColor, x, y, sampler);
rgb_to_hsv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor[3];
}
diff --git a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h
index 42bd439c8c2..09f6c7e48a6 100644
--- a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp
index 7f41a79b7f4..52aa1d7a123 100644
--- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp
@@ -50,12 +50,12 @@ void ConvertRGBToYCCOperation::setMode(int mode)
}
}
-void ConvertRGBToYCCOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertRGBToYCCOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor[4];
float color[3];
- this->m_inputOperation->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(inputColor, x, y, sampler);
rgb_to_ycc(inputColor[0], inputColor[1], inputColor[2], &color[0], &color[1], &color[2], this->m_mode);
/* divided by 255 to normalize for viewing in */
diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h
index 744e0657dc6..7f4eb6d7318 100644
--- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h
@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp
index e87a765f2eb..2206a066a37 100644
--- a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp
@@ -34,10 +34,10 @@ void ConvertRGBToYUVOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertRGBToYUVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertRGBToYUVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor[4];
- this->m_inputOperation->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(inputColor, x, y, sampler);
rgb_to_yuv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor[3];
}
diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h
index b470378704e..f7b3da800b3 100644
--- a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h
@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp b/source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp
index 100a4931d69..330ffd00acb 100644
--- a/source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp
+++ b/source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp
@@ -33,10 +33,10 @@ void ConvertValueToColorProg::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
-void ConvertValueToColorProg::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertValueToColorProg::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inputValue[4];
- this->m_inputProgram->read(inputValue, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(inputValue, x, y, sampler);
color[0] = inputValue[0];
color[1] = inputValue[0];
color[2] = inputValue[0];
diff --git a/source/blender/compositor/operations/COM_ConvertValueToColorProg.h b/source/blender/compositor/operations/COM_ConvertValueToColorProg.h
index d59964dd400..2fa5edcf09b 100644
--- a/source/blender/compositor/operations/COM_ConvertValueToColorProg.h
+++ b/source/blender/compositor/operations/COM_ConvertValueToColorProg.h
@@ -37,7 +37,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp
index 37760fe26d7..54a5b0dbd0e 100644
--- a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp
@@ -34,10 +34,10 @@ void ConvertValueToVectorOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertValueToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertValueToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float input[4];
- this->m_inputOperation->read(input, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(input, x, y, sampler);
outputValue[0] = input[0];
outputValue[1] = input[0];
outputValue[2] = input[0];
diff --git a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h
index 0e79c1ff3df..c0936a32eb5 100644
--- a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp
index 395b96e8b25..9fb9a2e0705 100644
--- a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp
@@ -34,9 +34,9 @@ void ConvertVectorToColorOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertVectorToColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertVectorToColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
- this->m_inputOperation->read(outputValue, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(outputValue, x, y, sampler);
outputValue[3] = 1.0f;
}
diff --git a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h
index 8225d03d58e..a062c452a91 100644
--- a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp
index 68842c5a055..23b552f1dbe 100644
--- a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp
@@ -34,10 +34,10 @@ void ConvertVectorToValueOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertVectorToValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertVectorToValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float input[4];
- this->m_inputOperation->read(input, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(input, x, y, sampler);
outputValue[0] = (input[0] + input[1] + input[2]) / 3.0f;
}
diff --git a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h
index a7981e8dc59..b662f3eed6c 100644
--- a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp
index 78b7a7af60d..88a7e7dedd9 100644
--- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp
@@ -50,10 +50,10 @@ void ConvertYCCToRGBOperation::setMode(int mode)
}
}
-void ConvertYCCToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertYCCToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor[4];
- this->m_inputOperation->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(inputColor, x, y, sampler);
/* need to un-normalize the data */
/* R,G,B --> Y,Cb,Cr */
diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h
index e23dfd8a985..a8e03bcb807 100644
--- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h
@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp
index b4393c53b92..1a5e7cbf2a6 100644
--- a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp
@@ -34,10 +34,10 @@ void ConvertYUVToRGBOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void ConvertYUVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ConvertYUVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor[4];
- this->m_inputOperation->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(inputColor, x, y, sampler);
yuv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor[3];
}
diff --git a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h
index 3368e0a24df..80321ae37d2 100644
--- a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h
@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
index cf3ffe6d8f4..90bda5c8d2c 100644
--- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
@@ -28,7 +28,7 @@ ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFi
/* pass */
}
-void ConvolutionEdgeFilterOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void ConvolutionEdgeFilterOperation::executePixel(float *color, int x, int y, void *data)
{
float in1[4], in2[4], res1[4], res2[4];
@@ -46,7 +46,7 @@ void ConvolutionEdgeFilterOperation::executePixel(float *color, int x, int y, Me
CLAMP(y3, 0, getHeight() - 1);
float value[4];
- this->m_inputValueOperation->read(value, x2, y2, inputBuffers, NULL);
+ this->m_inputValueOperation->read(value, x2, y2, NULL);
float mval = 1.0f - value[0];
res1[0] = 0.0f;
@@ -58,39 +58,39 @@ void ConvolutionEdgeFilterOperation::executePixel(float *color, int x, int y, Me
res2[2] = 0.0f;
res2[3] = 0.0f;
- this->m_inputOperation->read(in1, x1, y1, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x1, y1, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[0]);
madd_v3_v3fl(res2, in1, this->m_filter[0]);
- this->m_inputOperation->read(in1, x2, y1, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x2, y1, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[1]);
madd_v3_v3fl(res2, in1, this->m_filter[3]);
- this->m_inputOperation->read(in1, x3, y1, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x3, y1, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[2]);
madd_v3_v3fl(res2, in1, this->m_filter[6]);
- this->m_inputOperation->read(in1, x1, y2, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x1, y2, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[3]);
madd_v3_v3fl(res2, in1, this->m_filter[1]);
- this->m_inputOperation->read(in2, x2, y2, inputBuffers, NULL);
+ this->m_inputOperation->read(in2, x2, y2, NULL);
madd_v3_v3fl(res1, in2, this->m_filter[4]);
madd_v3_v3fl(res2, in2, this->m_filter[4]);
- this->m_inputOperation->read(in1, x3, y2, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x3, y2, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[5]);
madd_v3_v3fl(res2, in1, this->m_filter[7]);
- this->m_inputOperation->read(in1, x1, y3, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x1, y3, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[6]);
madd_v3_v3fl(res2, in1, this->m_filter[2]);
- this->m_inputOperation->read(in1, x2, y3, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x2, y3, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[7]);
madd_v3_v3fl(res2, in1, this->m_filter[5]);
- this->m_inputOperation->read(in1, x3, y3, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x3, y3, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[8]);
madd_v3_v3fl(res2, in1, this->m_filter[8]);
diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h
index 92e45c7104f..b96b8785524 100644
--- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h
+++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h
@@ -28,7 +28,7 @@
class ConvolutionEdgeFilterOperation : public ConvolutionFilterOperation {
public:
ConvolutionEdgeFilterOperation();
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
};
#endif
diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
index 3840e775fe3..6c1e434ab41 100644
--- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
@@ -67,7 +67,7 @@ void ConvolutionFilterOperation::deinitExecution()
}
-void ConvolutionFilterOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void ConvolutionFilterOperation::executePixel(float *color, int x, int y, void *data)
{
float in1[4];
float in2[4];
@@ -84,27 +84,27 @@ void ConvolutionFilterOperation::executePixel(float *color, int x, int y, Memory
CLAMP(y2, 0, getHeight() - 1);
CLAMP(y3, 0, getHeight() - 1);
float value[4];
- this->m_inputValueOperation->read(value, x2, y2, inputBuffers, NULL);
+ this->m_inputValueOperation->read(value, x2, y2, NULL);
const float mval = 1.0f - value[0];
zero_v4(color);
- this->m_inputOperation->read(in1, x1, y1, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x1, y1, NULL);
madd_v4_v4fl(color, in1, this->m_filter[0]);
- this->m_inputOperation->read(in1, x2, y1, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x2, y1, NULL);
madd_v4_v4fl(color, in1, this->m_filter[1]);
- this->m_inputOperation->read(in1, x3, y1, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x3, y1, NULL);
madd_v4_v4fl(color, in1, this->m_filter[2]);
- this->m_inputOperation->read(in1, x1, y2, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x1, y2, NULL);
madd_v4_v4fl(color, in1, this->m_filter[3]);
- this->m_inputOperation->read(in2, x2, y2, inputBuffers, NULL);
+ this->m_inputOperation->read(in2, x2, y2, NULL);
madd_v4_v4fl(color, in2, this->m_filter[4]);
- this->m_inputOperation->read(in1, x3, y2, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x3, y2, NULL);
madd_v4_v4fl(color, in1, this->m_filter[5]);
- this->m_inputOperation->read(in1, x1, y3, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x1, y3, NULL);
madd_v4_v4fl(color, in1, this->m_filter[6]);
- this->m_inputOperation->read(in1, x2, y3, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x2, y3, NULL);
madd_v4_v4fl(color, in1, this->m_filter[7]);
- this->m_inputOperation->read(in1, x3, y3, inputBuffers, NULL);
+ this->m_inputOperation->read(in1, x3, y3, NULL);
madd_v4_v4fl(color, in1, this->m_filter[8]);
color[0] = color[0] * value[0] + in2[0] * mval;
diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h
index 0b5dfb4d75a..88455730c0e 100644
--- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h
+++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h
@@ -39,7 +39,7 @@ public:
ConvolutionFilterOperation();
void set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp
index 0a40f2370c8..efbc331e7d3 100644
--- a/source/blender/compositor/operations/COM_CropOperation.cpp
+++ b/source/blender/compositor/operations/COM_CropOperation.cpp
@@ -73,10 +73,10 @@ CropOperation::CropOperation() : CropBaseOperation()
/* pass */
}
-void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
if ((x < this->m_xmax && x >= this->m_xmin) && (y < this->m_ymax && y >= this->m_ymin)) {
- this->m_inputOperation->read(color, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(color, x, y, sampler);
}
else {
zero_v4(color);
@@ -108,7 +108,7 @@ void CropImageOperation::determineResolution(unsigned int resolution[], unsigned
resolution[1] = this->m_ymax - this->m_ymin;
}
-void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
- this->m_inputOperation->read(color, (x + this->m_xmin), (y + this->m_ymin), sampler, inputBuffers);
+ this->m_inputOperation->read(color, (x + this->m_xmin), (y + this->m_ymin), sampler);
}
diff --git a/source/blender/compositor/operations/COM_CropOperation.h b/source/blender/compositor/operations/COM_CropOperation.h
index 39dbb8aa873..78644536143 100644
--- a/source/blender/compositor/operations/COM_CropOperation.h
+++ b/source/blender/compositor/operations/COM_CropOperation.h
@@ -48,7 +48,7 @@ class CropOperation : public CropBaseOperation {
private:
public:
CropOperation();
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
class CropImageOperation : public CropBaseOperation {
@@ -57,7 +57,7 @@ public:
CropImageOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void determineResolution(unsigned int resolution[], unsigned int preferedResolution[]);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
index 3c4bdfe8e5b..ed3799fff5e 100644
--- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
@@ -44,7 +44,7 @@ void DifferenceMatteOperation::deinitExecution()
this->m_inputImage2Program = NULL;
}
-void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inColor1[4];
float inColor2[4];
@@ -54,8 +54,8 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y
float difference;
float alpha;
- this->m_inputImage1Program->read(inColor1, x, y, sampler, inputBuffers);
- this->m_inputImage2Program->read(inColor2, x, y, sampler, inputBuffers);
+ this->m_inputImage1Program->read(inColor1, x, y, sampler);
+ this->m_inputImage2Program->read(inColor2, x, y, sampler);
difference = (fabsf(inColor2[0] - inColor1[0]) +
fabsf(inColor2[1] - inColor1[1]) +
diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h
index c35550560e1..acec6ebf193 100644
--- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h
+++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h
@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
index a9b40f8a6ac..71be94bf2a7 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
@@ -54,13 +54,13 @@ void DilateErodeThresholdOperation::initExecution()
}
}
-void *DilateErodeThresholdOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *DilateErodeThresholdOperation::initializeTileData(rcti *rect)
{
- void *buffer = this->m_inputProgram->initializeTileData(NULL, memoryBuffers);
+ void *buffer = this->m_inputProgram->initializeTileData(NULL);
return buffer;
}
-void DilateErodeThresholdOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void DilateErodeThresholdOperation::executePixel(float *color, int x, int y, void *data)
{
float inputValue[4];
const float sw = this->m__switch;
@@ -80,7 +80,7 @@ void DilateErodeThresholdOperation::executePixel(float *color, int x, int y, Mem
const int bufferWidth = rect->xmax - rect->xmin;
int offset;
- this->m_inputProgram->read(inputValue, x, y, inputBuffers, NULL);
+ this->m_inputProgram->read(inputValue, x, y, NULL);
if (inputValue[0] > sw) {
for (int yi = miny; yi < maxy; yi++) {
const float dy = yi - y;
@@ -179,13 +179,13 @@ void DilateDistanceOperation::initExecution()
}
}
-void *DilateDistanceOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *DilateDistanceOperation::initializeTileData(rcti *rect)
{
- void *buffer = this->m_inputProgram->initializeTileData(NULL, memoryBuffers);
+ void *buffer = this->m_inputProgram->initializeTileData(NULL);
return buffer;
}
-void DilateDistanceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void DilateDistanceOperation::executePixel(float *color, int x, int y, void *data)
{
const float distance = this->m_distance;
const float mindist = distance * distance;
@@ -259,7 +259,7 @@ ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation()
/* pass */
}
-void ErodeDistanceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void ErodeDistanceOperation::executePixel(float *color, int x, int y, void *data)
{
const float distance = this->m_distance;
const float mindist = distance * distance;
@@ -325,14 +325,14 @@ void DilateStepOperation::initExecution()
this->initMutex();
}
-void *DilateStepOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *DilateStepOperation::initializeTileData(rcti *rect)
{
if (this->m_cached_buffer != NULL) {
return this->m_cached_buffer;
}
lockMutex();
if (this->m_cached_buffer == NULL) {
- MemoryBuffer *buffer = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL, memoryBuffers);
+ MemoryBuffer *buffer = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL);
float *rectf = buffer->convertToValueBuffer();
int x, y, i;
float *p;
@@ -374,7 +374,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB
}
-void DilateStepOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void DilateStepOperation::executePixel(float *color, int x, int y, void *data)
{
color[0] = this->m_cached_buffer[y * this->getWidth() + x];
}
@@ -412,14 +412,14 @@ ErodeStepOperation::ErodeStepOperation() : DilateStepOperation()
/* pass */
}
-void *ErodeStepOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *ErodeStepOperation::initializeTileData(rcti *rect)
{
if (this->m_cached_buffer != NULL) {
return this->m_cached_buffer;
}
lockMutex();
if (this->m_cached_buffer == NULL) {
- MemoryBuffer *buffer = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL, memoryBuffers);
+ MemoryBuffer *buffer = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL);
float *rectf = buffer->convertToValueBuffer();
int x, y, i;
float *p;
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h
index bc6049bf992..8c3eefb97e4 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.h
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h
@@ -47,14 +47,14 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
/**
* Deinitialize the execution
*/
@@ -83,14 +83,14 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
/**
* Deinitialize the execution
*/
@@ -111,7 +111,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
void executeOpenCL(OpenCLDevice* device,
MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
@@ -135,14 +135,14 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
/**
* Deinitialize the execution
*/
@@ -157,7 +157,7 @@ class ErodeStepOperation : public DilateStepOperation {
public:
ErodeStepOperation();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
};
#endif
diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp
index da7336afc07..5e6ff2c7da1 100644
--- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_DirectionalBlurOperation.h"
#include "BLI_math.h"
-
+#include "COM_OpenCLDevice.h"
extern "C" {
#include "RE_pipeline.h"
}
@@ -33,6 +33,7 @@ DirectionalBlurOperation::DirectionalBlurOperation() : NodeOperation()
this->addOutputSocket(COM_DT_COLOR);
this->setComplex(true);
+ this->setOpenCL(true);
this->m_inputProgram = NULL;
}
@@ -65,12 +66,12 @@ void DirectionalBlurOperation::initExecution()
}
-void DirectionalBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void DirectionalBlurOperation::executePixel(float *color, int x, int y, void *data)
{
const int iterations = pow(2.0f, this->m_data->iter);
float col[4] = {0, 0, 0, 0};
float col2[4] = {0, 0, 0, 0};
- this->m_inputProgram->read(col2, x, y, COM_PS_NEAREST, inputBuffers);
+ this->m_inputProgram->read(col2, x, y, COM_PS_NEAREST);
float ltx = this->m_tx;
float lty = this->m_ty;
float lsc = this->m_sc;
@@ -86,7 +87,7 @@ void DirectionalBlurOperation::executePixel(float *color, int x, int y, MemoryBu
this->m_inputProgram->read(col,
cs * u + ss * v + this->m_center_x_pix,
cs * v - ss * u + this->m_center_y_pix,
- COM_PS_NEAREST, inputBuffers);
+ COM_PS_NEAREST);
add_v4_v4(col2, col);
@@ -97,9 +98,35 @@ void DirectionalBlurOperation::executePixel(float *color, int x, int y, MemoryBu
lsc += this->m_sc;
}
- mul_v4_v4fl(color, col2, 1.0f / iterations);
+ mul_v4_v4fl(color, col2, 1.0f / (iterations+1));
}
+void DirectionalBlurOperation::executeOpenCL(OpenCLDevice* device,
+ MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
+ MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
+ list<cl_kernel> *clKernelsToCleanUp)
+{
+ cl_kernel directionalBlurKernel = device->COM_clCreateKernel("directionalBlurKernel", NULL);
+
+ cl_int iterations = pow(2.0f, this->m_data->iter);
+ cl_float2 ltxy = {this->m_tx, this->m_ty};
+ cl_float2 centerpix = {this->m_center_x_pix, this->m_center_y_pix};
+ cl_float lsc = this->m_sc;
+ cl_float lrot = this->m_rot;
+
+ device->COM_clAttachMemoryBufferToKernelParameter(directionalBlurKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
+ device->COM_clAttachOutputMemoryBufferToKernelParameter(directionalBlurKernel, 1, clOutputBuffer);
+ device->COM_clAttachMemoryBufferOffsetToKernelParameter(directionalBlurKernel, 2, outputMemoryBuffer);
+ clSetKernelArg(directionalBlurKernel, 3, sizeof(cl_int), &iterations);
+ clSetKernelArg(directionalBlurKernel, 4, sizeof(cl_float), &lsc);
+ clSetKernelArg(directionalBlurKernel, 5, sizeof(cl_float), &lrot);
+ clSetKernelArg(directionalBlurKernel, 6, sizeof(cl_float2), &ltxy);
+ clSetKernelArg(directionalBlurKernel, 7, sizeof(cl_float2), &centerpix);
+
+ device->COM_clEnqueueRange(directionalBlurKernel, outputMemoryBuffer, 8, this);
+}
+
+
void DirectionalBlurOperation::deinitExecution()
{
this->m_inputProgram = NULL;
diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h
index 329f855871e..cc49e947f95 100644
--- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h
+++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h
@@ -40,7 +40,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
@@ -55,5 +55,11 @@ public:
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void setData(NodeDBlurData *data) { this->m_data = data; }
+
+ void executeOpenCL(OpenCLDevice* device,
+ MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
+ MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
+ list<cl_kernel> *clKernelsToCleanUp);
+
};
#endif
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
index c7df53770c5..018df78cb65 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
@@ -54,7 +54,7 @@ void DisplaceOperation::initExecution()
* in order to take effect */
#define DISPLACE_EPSILON 0.01f
-void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void DisplaceOperation::executePixel(float *color, int x, int y, void *data)
{
float inVector[4];
float inScale[4];
@@ -64,9 +64,9 @@ void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *i
float dxt, dyt;
float u, v;
- this->m_inputScaleXProgram->read(inScale, x, y, COM_PS_NEAREST, inputBuffers);
+ this->m_inputScaleXProgram->read(inScale, x, y, COM_PS_NEAREST);
float xs = inScale[0];
- this->m_inputScaleYProgram->read(inScale, x, y, COM_PS_NEAREST, inputBuffers);
+ this->m_inputScaleYProgram->read(inScale, x, y, COM_PS_NEAREST);
float ys = inScale[0];
/* clamp x and y displacement to triple image resolution -
@@ -74,7 +74,7 @@ void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *i
CLAMP(xs, -this->m_width_x4, this->m_width_x4);
CLAMP(ys, -this->m_height_x4, this->m_height_x4);
- this->m_inputVectorProgram->read(inVector, x, y, COM_PS_NEAREST, inputBuffers);
+ this->m_inputVectorProgram->read(inVector, x, y, COM_PS_NEAREST);
p_dx = inVector[0] * xs;
p_dy = inVector[1] * ys;
@@ -83,10 +83,10 @@ void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *i
v = y - p_dy + 0.5f;
/* calc derivatives */
- this->m_inputVectorProgram->read(inVector, x + 1, y, COM_PS_NEAREST, inputBuffers);
+ this->m_inputVectorProgram->read(inVector, x + 1, y, COM_PS_NEAREST);
d_dx = inVector[0] * xs;
- this->m_inputVectorProgram->read(inVector, x, y + 1, COM_PS_NEAREST, inputBuffers);
- d_dy = inVector[0] * ys;
+ this->m_inputVectorProgram->read(inVector, x, y + 1, COM_PS_NEAREST);
+ d_dy = inVector[1] * ys;
/* clamp derivatives to minimum displacement distance in UV space */
dxt = p_dx - d_dx;
@@ -96,7 +96,7 @@ void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *i
dyt = signf(dyt) * maxf(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight();
/* EWA filtering */
- this->m_inputColorProgram->read(color, u, v, dxt, dyt, inputBuffers);
+ this->m_inputColorProgram->read(color, u, v, dxt, dyt);
}
void DisplaceOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.h b/source/blender/compositor/operations/COM_DisplaceOperation.h
index e01c9190396..0e5b042aea5 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.h
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.h
@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
index d21fc62abd7..a93e39085c5 100644
--- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
@@ -53,7 +53,7 @@ void DisplaceSimpleOperation::initExecution()
* in order to take effect */
#define DISPLACE_EPSILON 0.01f
-void DisplaceSimpleOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void DisplaceSimpleOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inVector[4];
float inScale[4];
@@ -61,9 +61,9 @@ void DisplaceSimpleOperation::executePixel(float *color, float x, float y, Pixel
float p_dx, p_dy; /* main displacement in pixel space */
float u, v;
- this->m_inputScaleXProgram->read(inScale, x, y, sampler, inputBuffers);
+ this->m_inputScaleXProgram->read(inScale, x, y, sampler);
float xs = inScale[0];
- this->m_inputScaleYProgram->read(inScale, x, y, sampler, inputBuffers);
+ this->m_inputScaleYProgram->read(inScale, x, y, sampler);
float ys = inScale[0];
/* clamp x and y displacement to triple image resolution -
@@ -71,7 +71,7 @@ void DisplaceSimpleOperation::executePixel(float *color, float x, float y, Pixel
CLAMP(xs, -this->m_width_x4, this->m_width_x4);
CLAMP(ys, -this->m_height_x4, this->m_height_x4);
- this->m_inputVectorProgram->read(inVector, x, y, sampler, inputBuffers);
+ this->m_inputVectorProgram->read(inVector, x, y, sampler);
p_dx = inVector[0] * xs;
p_dy = inVector[1] * ys;
@@ -82,7 +82,7 @@ void DisplaceSimpleOperation::executePixel(float *color, float x, float y, Pixel
CLAMP(u, 0.f, this->getWidth() - 1.f);
CLAMP(v, 0.f, this->getHeight() - 1.f);
- this->m_inputColorProgram->read(color, u, v, sampler, inputBuffers);
+ this->m_inputColorProgram->read(color, u, v, sampler);
}
void DisplaceSimpleOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h
index 25afbafe335..81adc7be366 100644
--- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h
+++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h
@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp
index 5bdc616fed7..197e8b07918 100644
--- a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp
@@ -44,7 +44,7 @@ void DistanceMatteOperation::deinitExecution()
this->m_inputKeyProgram = NULL;
}
-void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inKey[4];
float inImage[4];
@@ -55,8 +55,8 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y,
float distance;
float alpha;
- this->m_inputKeyProgram->read(inKey, x, y, sampler, inputBuffers);
- this->m_inputImageProgram->read(inImage, x, y, sampler, inputBuffers);
+ this->m_inputKeyProgram->read(inKey, x, y, sampler);
+ this->m_inputImageProgram->read(inImage, x, y, sampler);
distance = sqrt(pow((inKey[0] - inImage[0]), 2) +
pow((inKey[1] - inImage[1]), 2) +
diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.h b/source/blender/compositor/operations/COM_DistanceMatteOperation.h
index 267aa1fca7a..6fe16c7fdff 100644
--- a/source/blender/compositor/operations/COM_DistanceMatteOperation.h
+++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.h
@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_DotproductOperation.cpp b/source/blender/compositor/operations/COM_DotproductOperation.cpp
index 53ab5f97518..559d97d6056 100644
--- a/source/blender/compositor/operations/COM_DotproductOperation.cpp
+++ b/source/blender/compositor/operations/COM_DotproductOperation.cpp
@@ -45,11 +45,11 @@ void DotproductOperation::deinitExecution()
/** @todo: current implementation is the inverse of a dotproduct. not 'logically' correct
*/
-void DotproductOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void DotproductOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float input1[4];
float input2[4];
- this->m_input1Operation->read(input1, x, y, sampler, inputBuffers);
- this->m_input2Operation->read(input2, x, y, sampler, inputBuffers);
+ this->m_input1Operation->read(input1, x, y, sampler);
+ this->m_input2Operation->read(input2, x, y, sampler);
color[0] = -(input1[0] * input2[0] + input1[1] * input2[1] + input1[2] * input2[2]);
}
diff --git a/source/blender/compositor/operations/COM_DotproductOperation.h b/source/blender/compositor/operations/COM_DotproductOperation.h
index 7ca540983d9..6ff6f622a50 100644
--- a/source/blender/compositor/operations/COM_DotproductOperation.h
+++ b/source/blender/compositor/operations/COM_DotproductOperation.h
@@ -31,7 +31,7 @@ private:
SocketReader *m_input2Operation;
public:
DotproductOperation();
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
index e5a145bab2e..f647629815b 100644
--- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
@@ -894,7 +894,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
int x; // x = pixel loop counter
int a; // a = temporary pixel index buffer loop counter
unsigned int ud; // ud = unscaled edge distance
- unsigned int dmin; // dmin = minimun edge distance
+ unsigned int dmin; // dmin = minimum edge distance
unsigned int rsl; // long used for finding fast 1.0/sqrt
unsigned int gradientFillOffset;
@@ -1012,7 +1012,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
unsigned int gradientFillOffset;
unsigned int t;
unsigned int ud; // ud = unscaled edge distance
- unsigned int dmin; // dmin = minimun edge distance
+ unsigned int dmin; // dmin = minimum edge distance
float odist; // odist = current outer edge distance
float idist; // idist = current inner edge distance
int dx; // dx = X-delta (used for distance proportion calculation)
@@ -1070,7 +1070,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
* pixel color as |GI| / (|GI| + |GO|). Since these are reciprocals, GI serves the
* purpose of GO for the proportion calculation.
*
- * For the purposes of the minimun distance comparisons, we only check
+ * For the purposes of the minimum distance comparisons, we only check
* the sums-of-squares against eachother, since they are in the same
* mathematical sort-order as if we did go ahead and take square roots
*
@@ -1116,7 +1116,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
/*
* Note once again that since we are using reciprocals of distance values our
* proportion is already the correct intensity, and does not need to be
- * subracted from 1.0 like it would have if we used real distances.
+ * subtracted from 1.0 like it would have if we used real distances.
*/
/*
@@ -1260,15 +1260,15 @@ void DoubleEdgeMaskOperation::initExecution()
this->m_cachedInstance = NULL;
}
-void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect)
{
if (this->m_cachedInstance)
return this->m_cachedInstance;
lockMutex();
if (this->m_cachedInstance == NULL) {
- MemoryBuffer *innerMask = (MemoryBuffer *)this->m_inputInnerMask->initializeTileData(rect, memoryBuffers);
- MemoryBuffer *outerMask = (MemoryBuffer *)this->m_inputOuterMask->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *innerMask = (MemoryBuffer *)this->m_inputInnerMask->initializeTileData(rect);
+ MemoryBuffer *outerMask = (MemoryBuffer *)this->m_inputOuterMask->initializeTileData(rect);
float *data = new float[this->getWidth() * this->getHeight()];
float *imask = innerMask->convertToValueBuffer();
float *omask = outerMask->convertToValueBuffer();
@@ -1280,7 +1280,7 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **mem
unlockMutex();
return this->m_cachedInstance;
}
-void DoubleEdgeMaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void DoubleEdgeMaskOperation::executePixel(float *color, int x, int y, void *data)
{
float *buffer = (float *) data;
int index = (y * this->getWidth() + x);
diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h
index 442680e320e..32e5a07cfdc 100644
--- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h
+++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h
@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
@@ -54,7 +54,7 @@ public:
*/
void deinitExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
index 1aa1b89ee76..c3cbaaaf2fc 100644
--- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
@@ -44,7 +44,7 @@ void EllipseMaskOperation::initExecution()
this->m_aspectRatio = ((float)this->getWidth()) / this->getHeight();
}
-void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inputMask[4];
float inputValue[4];
@@ -57,8 +57,8 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam
rx = this->m_data->x + (this->m_cosine * dx + this->m_sine * dy);
ry = this->m_data->y + (-this->m_sine * dx + this->m_cosine * dy);
- this->m_inputMask->read(inputMask, x, y, sampler, inputBuffers);
- this->m_inputValue->read(inputValue, x, y, sampler, inputBuffers);
+ this->m_inputMask->read(inputMask, x, y, sampler);
+ this->m_inputValue->read(inputValue, x, y, sampler);
const float halfHeight = (this->m_data->height) / 2.0f;
const float halfWidth = this->m_data->width / 2.0f;
diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.h b/source/blender/compositor/operations/COM_EllipseMaskOperation.h
index 0b0ffa023cb..fce3c93bba6 100644
--- a/source/blender/compositor/operations/COM_EllipseMaskOperation.h
+++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.h
@@ -45,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index 6d9c980ea58..7ef363f5c4a 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -31,7 +31,7 @@ FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation(COM_D
this->m_iirgaus = NULL;
}
-void FastGaussianBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void FastGaussianBlurOperation::executePixel(float *color, int x, int y, void *data)
{
MemoryBuffer *newData = (MemoryBuffer *)data;
newData->read(color, x, y);
@@ -79,13 +79,13 @@ void FastGaussianBlurOperation::deinitExecution()
BlurBaseOperation::deinitMutex();
}
-void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_iirgaus) {
- MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect);
MemoryBuffer *copy = newBuf->duplicate();
- updateSize(memoryBuffers);
+ updateSize();
int c;
this->m_sx = this->m_data->sizex * this->m_size / 2.0f;
@@ -233,7 +233,7 @@ FastGaussianBlurValueOperation::FastGaussianBlurValueOperation() : NodeOperation
setComplex(true);
}
-void FastGaussianBlurValueOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void FastGaussianBlurValueOperation::executePixel(float *color, int x, int y, void *data)
{
MemoryBuffer *newData = (MemoryBuffer *)data;
newData->read(color, x, y);
@@ -270,11 +270,11 @@ void FastGaussianBlurValueOperation::deinitExecution()
deinitMutex();
}
-void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_iirgaus) {
- MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputprogram->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputprogram->initializeTileData(rect);
MemoryBuffer *copy = newBuf->duplicate();
FastGaussianBlurOperation::IIR_gauss(copy, this->m_sigma, 0, 3);
this->m_iirgaus = copy;
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
index 5f76490473f..4560e1b25e3 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
@@ -34,10 +34,10 @@ private:
public:
FastGaussianBlurOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
static void IIR_gauss(MemoryBuffer *src, float sigma, unsigned int channel, unsigned int xy);
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
void deinitExecution();
void initExecution();
};
@@ -50,9 +50,9 @@ private:
public:
FastGaussianBlurValueOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
void deinitExecution();
void initExecution();
void setSigma(float sigma) { this->m_sigma = sigma; }
diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp
index 60dabb86bb5..939d05fffbf 100644
--- a/source/blender/compositor/operations/COM_FlipOperation.cpp
+++ b/source/blender/compositor/operations/COM_FlipOperation.cpp
@@ -42,12 +42,12 @@ void FlipOperation::deinitExecution()
}
-void FlipOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void FlipOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float nx = this->m_flipX ? this->getWidth() - 1 - x : x;
float ny = this->m_flipY ? this->getHeight() - 1 - y : y;
- this->m_inputOperation->read(color, nx, ny, sampler, inputBuffers);
+ this->m_inputOperation->read(color, nx, ny, sampler);
}
bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
diff --git a/source/blender/compositor/operations/COM_FlipOperation.h b/source/blender/compositor/operations/COM_FlipOperation.h
index 5442774c94c..a13f7ecf752 100644
--- a/source/blender/compositor/operations/COM_FlipOperation.h
+++ b/source/blender/compositor/operations/COM_FlipOperation.h
@@ -33,7 +33,7 @@ private:
public:
FlipOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
index db8d54a2f3c..a4cc03ac380 100644
--- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
+++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
@@ -34,10 +34,10 @@ void GammaCorrectOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
-void GammaCorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void GammaCorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inputColor[4];
- this->m_inputProgram->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(inputColor, x, y, sampler);
if (inputColor[3] > 0.0f) {
inputColor[0] /= inputColor[3];
inputColor[1] /= inputColor[3];
@@ -75,10 +75,10 @@ void GammaUncorrectOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
-void GammaUncorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void GammaUncorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inputColor[4];
- this->m_inputProgram->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(inputColor, x, y, sampler);
if (inputColor[3] > 0.0f) {
inputColor[0] /= inputColor[3];
diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.h b/source/blender/compositor/operations/COM_GammaCorrectOperation.h
index 4db911bb9b5..2d4f2ea89d9 100644
--- a/source/blender/compositor/operations/COM_GammaCorrectOperation.h
+++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.h
@@ -38,7 +38,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
@@ -64,7 +64,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_GammaOperation.cpp b/source/blender/compositor/operations/COM_GammaOperation.cpp
index 9ccc76f4392..40c2ee0a1d4 100644
--- a/source/blender/compositor/operations/COM_GammaOperation.cpp
+++ b/source/blender/compositor/operations/COM_GammaOperation.cpp
@@ -37,13 +37,13 @@ void GammaOperation::initExecution()
this->m_inputGammaProgram = this->getInputSocketReader(1);
}
-void GammaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void GammaOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inputValue[4];
float inputGamma[4];
- this->m_inputProgram->read(inputValue, x, y, sampler, inputBuffers);
- this->m_inputGammaProgram->read(inputGamma, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(inputValue, x, y, sampler);
+ this->m_inputGammaProgram->read(inputGamma, x, y, sampler);
const float gamma = inputGamma[0];
/* check for negative to avoid nan's */
color[0] = inputValue[0] > 0.0f ? powf(inputValue[0], gamma) : inputValue[0];
diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h
index 758f7bda04d..8fc2599cba9 100644
--- a/source/blender/compositor/operations/COM_GammaOperation.h
+++ b/source/blender/compositor/operations/COM_GammaOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
index a138d4be1d9..9865c87cb07 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
@@ -34,13 +34,13 @@ GaussianAlphaXBlurOperation::GaussianAlphaXBlurOperation() : BlurBaseOperation(C
this->m_rad = 0;
}
-void *GaussianAlphaXBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *GaussianAlphaXBlurOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_sizeavailable) {
- updateGauss(memoryBuffers);
+ updateGauss();
}
- void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
+ void *buffer = getInputOperation(0)->initializeTileData(NULL);
unlockMutex();
return buffer;
}
@@ -62,10 +62,10 @@ void GaussianAlphaXBlurOperation::initExecution()
}
}
-void GaussianAlphaXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
+void GaussianAlphaXBlurOperation::updateGauss()
{
if (this->m_gausstab == NULL) {
- updateSize(memoryBuffers);
+ updateSize();
float rad = this->m_size * this->m_data->sizex;
if (rad < 1)
rad = 1;
@@ -75,7 +75,7 @@ void GaussianAlphaXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
}
if (this->m_distbuf_inv == NULL) {
- updateSize(memoryBuffers);
+ updateSize();
float rad = this->m_size * this->m_data->sizex;
if (rad < 1)
rad = 1;
@@ -90,7 +90,7 @@ BLI_INLINE float finv_test(const float f, const bool test)
return (LIKELY(test == false)) ? f : 1.0f - f;
}
-void GaussianAlphaXBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void GaussianAlphaXBlurOperation::executePixel(float *color, int x, int y, void *data)
{
const bool do_invert = this->m_do_subtract;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
index 59797c27952..6ea8b7e4371 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
@@ -33,14 +33,14 @@ private:
int m_falloff; /* falloff for distbuf_inv */
bool m_do_subtract;
int m_rad;
- void updateGauss(MemoryBuffer **memoryBuffers);
+ void updateGauss();
public:
GaussianAlphaXBlurOperation();
/**
* @brief the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* @brief initialize the execution
@@ -52,7 +52,7 @@ public:
*/
void deinitExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
/**
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
index ab5f8d33850..323a381c869 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -34,13 +34,13 @@ GaussianAlphaYBlurOperation::GaussianAlphaYBlurOperation() : BlurBaseOperation(C
this->m_rad = 0;
}
-void *GaussianAlphaYBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *GaussianAlphaYBlurOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_sizeavailable) {
- updateGauss(memoryBuffers);
+ updateGauss();
}
- void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
+ void *buffer = getInputOperation(0)->initializeTileData(NULL);
unlockMutex();
return buffer;
}
@@ -62,10 +62,10 @@ void GaussianAlphaYBlurOperation::initExecution()
}
}
-void GaussianAlphaYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
+void GaussianAlphaYBlurOperation::updateGauss()
{
if (this->m_gausstab == NULL) {
- updateSize(memoryBuffers);
+ updateSize();
float rad = this->m_size * this->m_data->sizey;
if (rad < 1)
rad = 1;
@@ -75,7 +75,7 @@ void GaussianAlphaYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
}
if (this->m_distbuf_inv == NULL) {
- updateSize(memoryBuffers);
+ updateSize();
float rad = this->m_size * this->m_data->sizex;
if (rad < 1)
rad = 1;
@@ -90,7 +90,7 @@ BLI_INLINE float finv_test(const float f, const bool test)
return (LIKELY(test == false)) ? f : 1.0f - f;
}
-void GaussianAlphaYBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void GaussianAlphaYBlurOperation::executePixel(float *color, int x, int y, void *data)
{
const bool do_invert = this->m_do_subtract;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
index e0789db7815..050b0c384cb 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
@@ -33,14 +33,14 @@ private:
bool m_do_subtract;
int m_falloff;
int m_rad;
- void updateGauss(MemoryBuffer **memoryBuffers);
+ void updateGauss();
public:
GaussianAlphaYBlurOperation();
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* @brief initialize the execution
@@ -52,7 +52,7 @@ public:
*/
void deinitExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
/**
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index ac91d3336e2..fd70d0d329a 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_GaussianBokehBlurOperation.h"
#include "BLI_math.h"
-
+#include "MEM_guardedalloc.h"
extern "C" {
#include "RE_pipeline.h"
}
@@ -32,13 +32,13 @@ GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation(COM
this->m_gausstab = NULL;
}
-void *GaussianBokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *GaussianBokehBlurOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_sizeavailable) {
- updateGauss(memoryBuffers);
+ updateGauss();
}
- void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
+ void *buffer = getInputOperation(0)->initializeTileData(NULL);
unlockMutex();
return buffer;
}
@@ -50,11 +50,11 @@ void GaussianBokehBlurOperation::initExecution()
initMutex();
if (this->m_sizeavailable) {
- updateGauss(NULL);
+ updateGauss();
}
}
-void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
+void GaussianBokehBlurOperation::updateGauss()
{
if (this->m_gausstab == NULL) {
float radxf;
@@ -67,7 +67,7 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
const float width = this->getWidth();
const float height = this->getHeight();
if (!this->m_sizeavailable) {
- updateSize(memoryBuffers);
+ updateSize();
}
radxf = this->m_size * (float)this->m_data->sizex;
if (radxf > width / 2.0f)
@@ -112,7 +112,7 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
}
}
-void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, void *data)
{
float tempColor[4];
tempColor[0] = 0;
@@ -138,8 +138,10 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, Memory
int index;
int step = QualityStepHelper::getStep();
int offsetadd = QualityStepHelper::getOffsetAdd();
+ const int addConst = (minx - x + this->m_radx);
+ const int mulConst = (this->m_radx * 2 + 1);
for (int ny = miny; ny < maxy; ny += step) {
- index = ((ny - y) + this->m_rady) * (this->m_radx * 2 + 1) + (minx - x + this->m_radx);
+ index = ((ny - y) + this->m_rady) * mulConst + addConst;
int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
for (int nx = minx; nx < maxx; nx += step) {
const float multiplier = this->m_gausstab[index];
@@ -194,3 +196,157 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R
return BlurBaseOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
}
+
+// reference image
+GaussianBlurReferenceOperation::GaussianBlurReferenceOperation() : BlurBaseOperation(COM_DT_COLOR)
+{
+ this->m_maintabs = NULL;
+}
+
+void *GaussianBlurReferenceOperation::initializeTileData(rcti *rect)
+{
+ void *buffer = getInputOperation(0)->initializeTileData(NULL);
+ return buffer;
+}
+
+void GaussianBlurReferenceOperation::initExecution()
+{
+ BlurBaseOperation::initExecution();
+ // setup gaustab
+ this->m_data->image_in_width = this->getWidth();
+ this->m_data->image_in_height = this->getHeight();
+ if (this->m_data->relative) {
+ switch (this->m_data->aspect) {
+ case CMP_NODE_BLUR_ASPECT_NONE:
+ this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width);
+ this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height);
+ break;
+ case CMP_NODE_BLUR_ASPECT_Y:
+ this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width);
+ this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_width);
+ break;
+ case CMP_NODE_BLUR_ASPECT_X:
+ this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_height);
+ this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height);
+ break;
+ }
+ }
+
+
+ /* horizontal */
+ m_radx = (float)this->m_data->sizex;
+ int imgx = getWidth()/2;
+ if (m_radx > imgx)
+ m_radx = imgx;
+ else if (m_radx < 1)
+ m_radx = 1;
+ m_radxf = (float)m_radx;
+
+ /* vertical */
+ m_rady = (float)this->m_data->sizey;
+ int imgy = getHeight()/2;
+ if (m_rady > imgy)
+ m_rady = imgy;
+ else if (m_rady < 1)
+ m_rady = 1;
+ m_radyf = (float)m_rady;
+ updateGauss();
+}
+
+void GaussianBlurReferenceOperation::updateGauss()
+{
+ int i;
+ int x = MAX2(m_radx, m_rady);
+ this->m_maintabs = (float**)MEM_mallocN(x * sizeof(float *), "gauss array");
+ for (i = 0; i < x; i++)
+ m_maintabs[i] = make_gausstab(i + 1);
+}
+
+void GaussianBlurReferenceOperation::executePixel(float *color, int x, int y, void *data)
+{
+ MemoryBuffer *memorybuffer = (MemoryBuffer*)data;
+ float *buffer = memorybuffer->getBuffer();
+ float *gausstabx, *gausstabcenty;
+ float *gausstaby, *gausstabcentx;
+ int i, j;
+ float *src;
+ register float sum, val;
+ float rval, gval, bval, aval;
+ int imgx = getWidth();
+ int imgy = getHeight();
+ float tempSize[4];
+ this->m_inputSize->read(tempSize, x, y, data);
+ float refSize = tempSize[0];
+ int refradx = (int)(refSize * m_radxf);
+ int refrady = (int)(refSize * m_radyf);
+ if (refradx > m_radx) refradx = m_radx;
+ else if (refradx < 1) refradx = 1;
+ if (refrady > m_rady) refrady = m_rady;
+ else if (refrady < 1) refrady = 1;
+
+ if (refradx == 1 && refrady == 1) {
+ memorybuffer->readNoCheck(color, x, y);
+ } else {
+ int minxr = x - refradx < 0 ? -x : -refradx;
+ int maxxr = x + refradx > imgx ? imgx - x : refradx;
+ int minyr = y - refrady < 0 ? -y : -refrady;
+ int maxyr = y + refrady > imgy ? imgy - y : refrady;
+
+ float *srcd = buffer + COM_NUMBER_OF_CHANNELS * ( (y + minyr) * imgx + x + minxr);
+
+ gausstabx = m_maintabs[refradx - 1];
+ gausstabcentx = gausstabx + refradx;
+ gausstaby = m_maintabs[refrady - 1];
+ gausstabcenty = gausstaby + refrady;
+
+ sum = gval = rval = bval = aval = 0.0f;
+ for (i = minyr; i < maxyr; i++, srcd += COM_NUMBER_OF_CHANNELS * imgx) {
+ src = srcd;
+ for (j = minxr; j < maxxr; j++, src += COM_NUMBER_OF_CHANNELS) {
+
+ val = gausstabcenty[i] * gausstabcentx[j];
+ sum += val;
+ rval += val * src[0];
+ gval += val * src[1];
+ bval += val * src[2];
+ aval += val * src[3];
+ }
+ }
+ sum = 1.0f / sum;
+ color[0] = rval * sum;
+ color[1] = gval * sum;
+ color[2] = bval * sum;
+ color[3] = aval * sum;
+ }
+
+}
+
+void GaussianBlurReferenceOperation::deinitExecution()
+{
+ int x, i;
+ x = MAX2(m_radx, m_rady);
+ for (i = 0; i < x; i++)
+ delete []m_maintabs[i];
+ MEM_freeN(m_maintabs);
+ BlurBaseOperation::deinitExecution();
+}
+
+bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+{
+ rcti newInput;
+ NodeOperation *operation = this->getInputOperation(1);
+
+ if (operation->determineDependingAreaOfInterest(input, readOperation, output)) {
+ return true;
+ }
+ else {
+ int addx = this->m_data->sizex+2;
+ int addy = this->m_data->sizey+2;
+ newInput.xmax = input->xmax + addx;
+ newInput.xmin = input->xmin - addx;
+ newInput.ymax = input->ymax + addy;
+ newInput.ymin = input->ymin - addy;
+ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+ }
+}
+
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h
index 54dc8caed53..45140855464 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h
@@ -30,16 +30,16 @@ class GaussianBokehBlurOperation : public BlurBaseOperation {
private:
float *m_gausstab;
int m_radx, m_rady;
- void updateGauss(MemoryBuffer **memoryBuffers);
+ void updateGauss();
public:
GaussianBokehBlurOperation();
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Deinitialize the execution
@@ -48,4 +48,32 @@ public:
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
};
+
+class GaussianBlurReferenceOperation : public BlurBaseOperation {
+private:
+ float **m_maintabs;
+
+ void updateGauss();
+ int m_radx;
+ int m_rady;
+ float m_radxf;
+ float m_radyf;
+
+public:
+ GaussianBlurReferenceOperation();
+ void initExecution();
+ void *initializeTileData(rcti *rect);
+ /**
+ * the inner loop of this program
+ */
+ void executePixel(float *color, int x, int y, void *data);
+
+ /**
+ * Deinitialize the execution
+ */
+ void deinitExecution();
+
+ bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
+};
+
#endif
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index d18dd17528d..1cf675a769a 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -33,13 +33,13 @@ GaussianXBlurOperation::GaussianXBlurOperation() : BlurBaseOperation(COM_DT_COLO
this->m_rad = 0;
}
-void *GaussianXBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *GaussianXBlurOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_sizeavailable) {
- updateGauss(memoryBuffers);
+ updateGauss();
}
- void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
+ void *buffer = getInputOperation(0)->initializeTileData(NULL);
unlockMutex();
return buffer;
}
@@ -60,10 +60,10 @@ void GaussianXBlurOperation::initExecution()
}
}
-void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
+void GaussianXBlurOperation::updateGauss()
{
if (this->m_gausstab == NULL) {
- updateSize(memoryBuffers);
+ updateSize();
float rad = this->m_size * this->m_data->sizex;
if (rad < 1)
rad = 1;
@@ -73,7 +73,7 @@ void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
}
}
-void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void GaussianXBlurOperation::executePixel(float *color, int x, int y, void *data)
{
float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float multiplier_accum = 0.0f;
@@ -92,12 +92,10 @@ void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuff
maxy = min(maxy, inputBuffer->getRect()->ymax);
maxx = min(maxx, inputBuffer->getRect()->xmax);
- int index;
int step = getStep();
int offsetadd = getOffsetAdd();
int bufferindex = ((minx - bufferstartx) * 4) + ((miny - bufferstarty) * 4 * bufferwidth);
- for (int nx = minx; nx < maxx; nx += step) {
- index = (nx - x) + this->m_rad;
+ for (int nx = minx, index = (minx - x) + this->m_rad; nx < maxx; nx += step, index += step) {
const float multiplier = this->m_gausstab[index];
madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier);
multiplier_accum += multiplier;
@@ -118,17 +116,19 @@ void GaussianXBlurOperation::deinitExecution()
bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInput;
- rcti sizeInput;
- sizeInput.xmin = 0;
- sizeInput.ymin = 0;
- sizeInput.xmax = 5;
- sizeInput.ymax = 5;
- NodeOperation *operation = this->getInputOperation(1);
- if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) {
- return true;
+ if (!this->m_sizeavailable) {
+ rcti sizeInput;
+ sizeInput.xmin = 0;
+ sizeInput.ymin = 0;
+ sizeInput.xmax = 5;
+ sizeInput.ymax = 5;
+ NodeOperation *operation = this->getInputOperation(1);
+ if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) {
+ return true;
+ }
}
- else {
+ {
if (this->m_sizeavailable && this->m_gausstab != NULL) {
newInput.xmax = input->xmax + this->m_rad;
newInput.xmin = input->xmin - this->m_rad;
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
index 9b5c2131b74..a4a0dc655e2 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
@@ -29,14 +29,14 @@ class GaussianXBlurOperation : public BlurBaseOperation {
private:
float *m_gausstab;
int m_rad;
- void updateGauss(MemoryBuffer **memoryBuffers);
+ void updateGauss();
public:
GaussianXBlurOperation();
/**
* @brief the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* @brief initialize the execution
@@ -48,7 +48,7 @@ public:
*/
void deinitExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
};
#endif
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index d2d30da8ddf..135dcf60872 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -33,13 +33,13 @@ GaussianYBlurOperation::GaussianYBlurOperation() : BlurBaseOperation(COM_DT_COLO
this->m_rad = 0;
}
-void *GaussianYBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *GaussianYBlurOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_sizeavailable) {
- updateGauss(memoryBuffers);
+ updateGauss();
}
- void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
+ void *buffer = getInputOperation(0)->initializeTileData(NULL);
unlockMutex();
return buffer;
}
@@ -60,10 +60,10 @@ void GaussianYBlurOperation::initExecution()
}
}
-void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
+void GaussianYBlurOperation::updateGauss()
{
if (this->m_gausstab == NULL) {
- updateSize(memoryBuffers);
+ updateSize();
float rad = this->m_size * this->m_data->sizey;
if (rad < 1)
rad = 1;
@@ -73,7 +73,7 @@ void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
}
}
-void GaussianYBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void GaussianYBlurOperation::executePixel(float *color, int x, int y, void *data)
{
float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float multiplier_accum = 0.0f;
@@ -94,9 +94,10 @@ void GaussianYBlurOperation::executePixel(float *color, int x, int y, MemoryBuff
int index;
int step = getStep();
+ const int bufferIndexx = ((minx - bufferstartx) * 4) ;
for (int ny = miny; ny < maxy; ny += step) {
index = (ny - y) + this->m_rad;
- int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
+ int bufferindex = bufferIndexx + ((ny - bufferstarty) * 4 * bufferwidth);
const float multiplier = this->m_gausstab[index];
madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier);
multiplier_accum += multiplier;
@@ -116,17 +117,19 @@ void GaussianYBlurOperation::deinitExecution()
bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInput;
- rcti sizeInput;
- sizeInput.xmin = 0;
- sizeInput.ymin = 0;
- sizeInput.xmax = 5;
- sizeInput.ymax = 5;
- NodeOperation *operation = this->getInputOperation(1);
- if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) {
- return true;
+ if (!m_sizeavailable) {
+ rcti sizeInput;
+ sizeInput.xmin = 0;
+ sizeInput.ymin = 0;
+ sizeInput.xmax = 5;
+ sizeInput.ymax = 5;
+ NodeOperation *operation = this->getInputOperation(1);
+ if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) {
+ return true;
+ }
}
- else {
+ {
if (this->m_sizeavailable && this->m_gausstab != NULL) {
newInput.xmax = input->xmax;
newInput.xmin = input->xmin;
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h
index f4d40c231dc..e3e0d8891d3 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h
@@ -29,14 +29,14 @@ class GaussianYBlurOperation : public BlurBaseOperation {
private:
float *m_gausstab;
int m_rad;
- void updateGauss(MemoryBuffer **memoryBuffers);
+ void updateGauss();
public:
GaussianYBlurOperation();
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* @brief initialize the execution
@@ -48,7 +48,7 @@ public:
*/
void deinitExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
};
#endif
diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
index a6678fdecef..8bfc3e436df 100644
--- a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
@@ -41,9 +41,9 @@ void GlareBaseOperation::deinitExecution()
SingleThreadedNodeOperation::deinitExecution();
}
-MemoryBuffer *GlareBaseOperation::createMemoryBuffer(rcti *rect2, MemoryBuffer **memoryBuffers)
+MemoryBuffer *GlareBaseOperation::createMemoryBuffer(rcti *rect2)
{
- MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect2, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect2);
rcti rect;
rect.xmin = 0;
rect.ymin = 0;
diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h
index 6104ec7a81e..f6a8f6879da 100644
--- a/source/blender/compositor/operations/COM_GlareBaseOperation.h
+++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h
@@ -68,7 +68,7 @@ protected:
virtual void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) = 0;
- MemoryBuffer *createMemoryBuffer(rcti *rect, MemoryBuffer **memoryBuffers);
+ MemoryBuffer *createMemoryBuffer(rcti *rect);
};
#endif
diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
index cb4c27a4c80..5452e779968 100644
--- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
@@ -379,7 +379,7 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile,
// temp. src image
// make the convolution kernel
rcti kernelRect;
- BLI_init_rcti(&kernelRect, 0, sz, 0, sz);
+ BLI_rcti_init(&kernelRect, 0, sz, 0, sz);
ckrn = new MemoryBuffer(NULL, &kernelRect);
scale = 0.25f * sqrtf((float)(sz * sz));
diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
index 6d8c567c1b5..7f32618d2af 100644
--- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
@@ -42,11 +42,11 @@ void GlareThresholdOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
-void GlareThresholdOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void GlareThresholdOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
const float threshold = this->m_settings->threshold;
- this->m_inputProgram->read(color, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(color, x, y, sampler);
if (rgb_to_luma_y(color) >= threshold) {
color[0] -= threshold, color[1] -= threshold, color[2] -= threshold;
color[0] = MAX2(color[0], 0.0f);
diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.h b/source/blender/compositor/operations/COM_GlareThresholdOperation.h
index d89f3a0f29d..faba6c6c47c 100644
--- a/source/blender/compositor/operations/COM_GlareThresholdOperation.h
+++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.h
@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
index 02914487072..df3d00278c3 100644
--- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
+++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
@@ -45,11 +45,11 @@ void HueSaturationValueCorrectOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
-void HueSaturationValueCorrectOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void HueSaturationValueCorrectOperation::executePixel(float *output, float x, float y, PixelSampler sampler)
{
float hsv[4], f;
- this->m_inputProgram->read(hsv, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(hsv, x, y, sampler);
/* adjust hue, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(this->m_curveMapping, 0, hsv[0]);
diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h
index 7ae5f53e370..ba565a9f752 100644
--- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h
+++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h
@@ -37,7 +37,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *Vector, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *Vector, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cpp b/source/blender/compositor/operations/COM_IDMaskOperation.cpp
index c84124368be..daa2ac9299e 100644
--- a/source/blender/compositor/operations/COM_IDMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_IDMaskOperation.cpp
@@ -33,11 +33,11 @@ void IDMaskOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
-void IDMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void IDMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inputValue[4];
- this->m_inputProgram->read(inputValue, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(inputValue, x, y, sampler);
const float a = (inputValue[0] == this->m_objectIndex) ? 1.0f : 0.0f;
color[0] = a;
}
diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.h b/source/blender/compositor/operations/COM_IDMaskOperation.h
index 23e8ec704e8..9d356536499 100644
--- a/source/blender/compositor/operations/COM_IDMaskOperation.h
+++ b/source/blender/compositor/operations/COM_IDMaskOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp
index eb2eaa8167a..729b3f8f18f 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_ImageOperation.cpp
@@ -108,7 +108,7 @@ void BaseImageOperation::determineResolution(unsigned int resolution[], unsigned
}
}
-void ImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
if (this->m_imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
zero_v4(color);
@@ -128,7 +128,7 @@ void ImageOperation::executePixel(float *color, float x, float y, PixelSampler s
}
}
-void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float tempcolor[4];
@@ -152,7 +152,7 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp
}
}
-void ImageDepthOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ImageDepthOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
if (this->m_depthBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
color[0] = 0.0f;
diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h
index c87b06b9c4d..847096c7d43 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.h
+++ b/source/blender/compositor/operations/COM_ImageOperation.h
@@ -73,7 +73,7 @@ public:
* Constructor
*/
ImageOperation();
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
class ImageAlphaOperation : public BaseImageOperation {
public:
@@ -81,7 +81,7 @@ public:
* Constructor
*/
ImageAlphaOperation();
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
class ImageDepthOperation : public BaseImageOperation {
public:
@@ -89,6 +89,6 @@ public:
* Constructor
*/
ImageDepthOperation();
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp
index 9e9c2522d66..0802d2d2523 100644
--- a/source/blender/compositor/operations/COM_InvertOperation.cpp
+++ b/source/blender/compositor/operations/COM_InvertOperation.cpp
@@ -39,12 +39,12 @@ void InvertOperation::initExecution()
this->m_inputColorProgram = this->getInputSocketReader(1);
}
-void InvertOperation::executePixel(float *out, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void InvertOperation::executePixel(float *out, float x, float y, PixelSampler sampler)
{
float inputValue[4];
float inputColor[4];
- this->m_inputValueProgram->read(inputValue, x, y, sampler, inputBuffers);
- this->m_inputColorProgram->read(inputColor, x, y, sampler, inputBuffers);
+ this->m_inputValueProgram->read(inputValue, x, y, sampler);
+ this->m_inputColorProgram->read(inputColor, x, y, sampler);
const float value = inputValue[0];
const float invertedValue = 1.0f - value;
diff --git a/source/blender/compositor/operations/COM_InvertOperation.h b/source/blender/compositor/operations/COM_InvertOperation.h
index f00a3fb739d..46a5d80b04a 100644
--- a/source/blender/compositor/operations/COM_InvertOperation.h
+++ b/source/blender/compositor/operations/COM_InvertOperation.h
@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp b/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp
index 3285bd32039..00ea5877d63 100644
--- a/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp
@@ -39,14 +39,14 @@ KeyingBlurOperation::KeyingBlurOperation() : NodeOperation()
this->setComplex(true);
}
-void *KeyingBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *KeyingBlurOperation::initializeTileData(rcti *rect)
{
- void *buffer = getInputOperation(0)->initializeTileData(rect, memoryBuffers);
+ void *buffer = getInputOperation(0)->initializeTileData(rect);
return buffer;
}
-void KeyingBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void KeyingBlurOperation::executePixel(float *color, int x, int y, void *data)
{
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.h b/source/blender/compositor/operations/COM_KeyingBlurOperation.h
index 6e08712bf39..aaacf66a656 100644
--- a/source/blender/compositor/operations/COM_KeyingBlurOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.h
@@ -27,7 +27,7 @@
#include "COM_NodeOperation.h"
/**
- * Class with implementation of bluring for keying node
+ * Class with implementation of blurring for keying node
*/
class KeyingBlurOperation : public NodeOperation {
protected:
@@ -45,9 +45,9 @@ public:
void setSize(int value) {this->m_size = value;}
void setAxis(int value) {this->m_axis = value;}
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
- void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
};
diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
index 8f7d7fbf625..d8afaceb37b 100644
--- a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
@@ -44,14 +44,14 @@ KeyingClipOperation::KeyingClipOperation() : NodeOperation()
this->setComplex(true);
}
-void *KeyingClipOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *KeyingClipOperation::initializeTileData(rcti *rect)
{
- void *buffer = getInputOperation(0)->initializeTileData(rect, memoryBuffers);
+ void *buffer = getInputOperation(0)->initializeTileData(rect);
return buffer;
}
-void KeyingClipOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void KeyingClipOperation::executePixel(float *color, int x, int y, void *data)
{
const int delta = this->m_kernelRadius;
const float tolerance = this->m_kernelTolerance;
diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.h b/source/blender/compositor/operations/COM_KeyingClipOperation.h
index 1a8e71a306b..eacbccc0818 100644
--- a/source/blender/compositor/operations/COM_KeyingClipOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingClipOperation.h
@@ -49,9 +49,9 @@ public:
void setIsEdgeMatte(bool value) {this->m_isEdgeMatte = value;}
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
- void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
};
diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
index 081d9f723e8..2f3fa2bd72a 100644
--- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
@@ -47,6 +47,7 @@ KeyingDespillOperation::KeyingDespillOperation() : NodeOperation()
this->addOutputSocket(COM_DT_COLOR);
this->m_despillFactor = 0.5f;
+ this->m_colorBalance = 0.5f;
this->m_pixelReader = NULL;
this->m_screenReader = NULL;
@@ -64,25 +65,31 @@ void KeyingDespillOperation::deinitExecution()
this->m_screenReader = NULL;
}
-void KeyingDespillOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void KeyingDespillOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float pixelColor[4];
float screenColor[4];
- this->m_pixelReader->read(pixelColor, x, y, sampler, inputBuffers);
- this->m_screenReader->read(screenColor, x, y, sampler, inputBuffers);
+ this->m_pixelReader->read(pixelColor, x, y, sampler);
+ this->m_screenReader->read(screenColor, x, y, sampler);
int screen_primary_channel = get_pixel_primary_channel(screenColor);
+ int other_1 = (screen_primary_channel + 1) % 3;
+ int other_2 = (screen_primary_channel + 2) % 3;
+
+ int min_channel = MIN2(other_1, other_2);
+ int max_channel = MAX2(other_1, other_2);
+
float average_value, amount;
- average_value = (pixelColor[0] + pixelColor[1] + pixelColor[2] - pixelColor[screen_primary_channel]) / 2.0f;
- amount = pixelColor[screen_primary_channel] - average_value;
+ average_value = this->m_colorBalance * pixelColor[min_channel] + (1.0f - this->m_colorBalance) * pixelColor[max_channel];
+ amount = (pixelColor[screen_primary_channel] - average_value);
color[0] = pixelColor[0];
color[1] = pixelColor[1];
color[2] = pixelColor[2];
color[3] = pixelColor[3];
-
+
if (this->m_despillFactor * amount > 0) {
color[screen_primary_channel] = pixelColor[screen_primary_channel] - this->m_despillFactor * amount;
}
diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.h b/source/blender/compositor/operations/COM_KeyingDespillOperation.h
index 4fea9b578a1..c6e489057c3 100644
--- a/source/blender/compositor/operations/COM_KeyingDespillOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.h
@@ -34,6 +34,7 @@ protected:
SocketReader *m_pixelReader;
SocketReader *m_screenReader;
float m_despillFactor;
+ float m_colorBalance;
public:
KeyingDespillOperation();
@@ -42,8 +43,9 @@ public:
void deinitExecution();
void setDespillFactor(float value) {this->m_despillFactor = value;}
+ void setColorBalance(float value) {this->m_colorBalance = value;}
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp
index e92e5c84c2d..5912c206a84 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp
@@ -45,9 +45,10 @@ static float get_pixel_saturation(float pixelColor[4], float screen_balance, int
int other_1 = (primary_channel + 1) % 3;
int other_2 = (primary_channel + 2) % 3;
- float min = MIN2(pixelColor[other_1], pixelColor[other_2]);
- float max = MAX2(pixelColor[other_1], pixelColor[other_2]);
- float val = screen_balance * min + (1.0f - screen_balance) * max;
+ int min_channel = MIN2(other_1, other_2);
+ int max_channel = MAX2(other_1, other_2);
+
+ float val = screen_balance * pixelColor[min_channel] + (1.0f - screen_balance) * pixelColor[max_channel];
return (pixelColor[primary_channel] - val) * fabsf(1.0f - val);
}
@@ -84,17 +85,17 @@ void KeyingOperation::deinitExecution()
this->m_coreReader = NULL;
}
-void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float pixelColor[4];
float screenColor[4];
float garbageValue[4];
float coreValue[4];
- this->m_pixelReader->read(pixelColor, x, y, sampler, inputBuffers);
- this->m_screenReader->read(screenColor, x, y, sampler, inputBuffers);
- this->m_garbageReader->read(garbageValue, x, y, sampler, inputBuffers);
- this->m_coreReader->read(coreValue, x, y, sampler, inputBuffers);
+ this->m_pixelReader->read(pixelColor, x, y, sampler);
+ this->m_screenReader->read(screenColor, x, y, sampler);
+ this->m_garbageReader->read(garbageValue, x, y, sampler);
+ this->m_coreReader->read(coreValue, x, y, sampler);
int primary_channel = get_pixel_primary_channel(screenColor);
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.h b/source/blender/compositor/operations/COM_KeyingOperation.h
index 736db54850a..413aaf6a81e 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingOperation.h
@@ -51,7 +51,7 @@ public:
void setScreenBalance(float value) {this->m_screenBalance = value;}
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
index 53572162b9e..87a8fd22758 100644
--- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
@@ -104,10 +104,20 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
/* count sites */
for (track = (MovieTrackingTrack *) tracksbase->first, sites_total = 0; track; track = track->next) {
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_frame);
+ float pos[2];
- if ((marker->flag & MARKER_DISABLED) == 0) {
- sites_total++;
+ if (marker->flag & MARKER_DISABLED)
+ continue;
+
+ add_v2_v2v2(pos, marker->pos, track->offset);
+
+ if (!IN_RANGE_INCL(pos[0], 0.0f, 1.0f) ||
+ !IN_RANGE_INCL(pos[1], 0.0f, 1.0f))
+ {
+ continue;
}
+
+ sites_total++;
}
if (!sites_total)
@@ -128,10 +138,19 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
VoronoiSite *site;
ImBuf *pattern_ibuf;
int j;
+ float pos[2];
if (marker->flag & MARKER_DISABLED)
continue;
+ add_v2_v2v2(pos, marker->pos, track->offset);
+
+ if (!IN_RANGE_INCL(pos[0], 0.0f, 1.0f) ||
+ !IN_RANGE_INCL(pos[1], 0.0f, 1.0f))
+ {
+ continue;
+ }
+
site = &sites[i];
pattern_ibuf = BKE_tracking_get_pattern_imbuf(ibuf, track, marker, TRUE, FALSE);
@@ -153,8 +172,8 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
IMB_freeImBuf(pattern_ibuf);
- site->co[0] = marker->pos[0] * width;
- site->co[1] = marker->pos[1] * height;
+ site->co[0] = pos[0] * width;
+ site->co[1] = pos[1] * height;
}
IMB_freeImBuf(ibuf);
@@ -198,7 +217,7 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
return triangulation;
}
-void *KeyingScreenOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *KeyingScreenOperation::initializeTileData(rcti *rect)
{
TileData *tile_data;
TriangulationData *triangulation;
@@ -223,12 +242,12 @@ void *KeyingScreenOperation::initializeTileData(rcti *rect, MemoryBuffer **memor
if (!triangulation)
return NULL;
- BLI_init_rctf(&rect_float, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+ BLI_rctf_init(&rect_float, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
tile_data = (TileData *) MEM_callocN(sizeof(TileData), "keying screen tile data");
for (i = 0; i < triangulation->triangles_total; i++) {
- bool ok = BLI_isect_rctf(&rect_float, &triangulation->triangles_AABB[i], NULL);
+ bool ok = BLI_rctf_isect(&rect_float, &triangulation->triangles_AABB[i], NULL);
if (ok) {
tile_data->triangles_total++;
@@ -253,7 +272,7 @@ void *KeyingScreenOperation::initializeTileData(rcti *rect, MemoryBuffer **memor
return tile_data;
}
-void KeyingScreenOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
+void KeyingScreenOperation::deinitializeTileData(rcti *rect, void *data)
{
TileData *tile_data = (TileData *) data;
@@ -282,7 +301,7 @@ void KeyingScreenOperation::determineResolution(unsigned int resolution[], unsig
}
}
-void KeyingScreenOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void KeyingScreenOperation::executePixel(float *color, int x, int y, void *data)
{
color[0] = 0.0f;
color[1] = 0.0f;
@@ -308,9 +327,11 @@ void KeyingScreenOperation::executePixel(float *color, int x, int y, MemoryBuffe
if (barycentric_coords_v2(a->co, b->co, c->co, co, w)) {
if (barycentric_inside_triangle_v2(w)) {
- color[0] += a->color[0] * w[0] + b->color[0] * w[1] + c->color[0] * w[2];
- color[1] += a->color[1] * w[0] + b->color[1] * w[1] + c->color[1] * w[2];
- color[2] += a->color[2] * w[0] + b->color[2] * w[1] + c->color[2] * w[2];
+ color[0] = a->color[0] * w[0] + b->color[0] * w[1] + c->color[0] * w[2];
+ color[1] = a->color[1] * w[0] + b->color[1] * w[1] + c->color[1] * w[2];
+ color[2] = a->color[2] * w[0] + b->color[2] * w[1] + c->color[2] * w[2];
+
+ break;
}
}
}
diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.h b/source/blender/compositor/operations/COM_KeyingScreenOperation.h
index 95815cd3930..f6982ef09f3 100644
--- a/source/blender/compositor/operations/COM_KeyingScreenOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.h
@@ -73,14 +73,14 @@ public:
void initExecution();
void deinitExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
- void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
+ void *initializeTileData(rcti *rect);
+ void deinitializeTileData(rcti *rect, void *data);
void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;}
void setTrackingObject(const char *object) {strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject));}
void setFramenumber(int framenumber) {this->m_framenumber = framenumber;}
- void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
};
#endif
diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
index 233f903c3e3..7f637c127c1 100644
--- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
@@ -40,7 +40,7 @@ void LuminanceMatteOperation::deinitExecution()
this->m_inputImageProgram = NULL;
}
-void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inColor[4];
@@ -49,7 +49,7 @@ void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y,
float alpha;
- this->m_inputImageProgram->read(inColor, x, y, sampler, inputBuffers);
+ this->m_inputImageProgram->read(inColor, x, y, sampler);
/* one line thread-friend algorithm:
* outputValue[0] = max(inputValue[3], min(high, max(low, ((inColor[0]-low)/(high-low))))
diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h
index 041fd0d7ee9..c1ab628f787 100644
--- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h
+++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h
@@ -41,7 +41,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp
index dec2d0849c9..a5f503a669b 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp
@@ -40,7 +40,7 @@ void MapUVOperation::initExecution()
this->m_inputUVProgram = this->getInputSocketReader(1);
}
-void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float inputUV[4];
float uv_a[4], uv_b[4];
@@ -50,30 +50,30 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s
float uv_l, uv_r;
float uv_u, uv_d;
- this->m_inputUVProgram->read(inputUV, x, y, sampler, inputBuffers);
+ this->m_inputUVProgram->read(inputUV, x, y, sampler);
if (inputUV[2] == 0.f) {
zero_v4(color);
return;
}
/* adaptive sampling, red (U) channel */
- this->m_inputUVProgram->read(uv_a, x - 1, y, COM_PS_NEAREST, inputBuffers);
- this->m_inputUVProgram->read(uv_b, x + 1, y, COM_PS_NEAREST, inputBuffers);
+ this->m_inputUVProgram->read(uv_a, x - 1, y, COM_PS_NEAREST);
+ this->m_inputUVProgram->read(uv_b, x + 1, y, COM_PS_NEAREST);
uv_l = uv_a[2] != 0.f ? fabsf(inputUV[0] - uv_a[0]) : 0.f;
uv_r = uv_b[2] != 0.f ? fabsf(inputUV[0] - uv_b[0]) : 0.f;
dx = 0.5f * (uv_l + uv_r);
/* adaptive sampling, green (V) channel */
- this->m_inputUVProgram->read(uv_a, x, y - 1, COM_PS_NEAREST, inputBuffers);
- this->m_inputUVProgram->read(uv_b, x, y + 1, COM_PS_NEAREST, inputBuffers);
+ this->m_inputUVProgram->read(uv_a, x, y - 1, COM_PS_NEAREST);
+ this->m_inputUVProgram->read(uv_b, x, y + 1, COM_PS_NEAREST);
uv_u = uv_a[2] != 0.f ? fabsf(inputUV[1] - uv_a[1]) : 0.f;
uv_d = uv_b[2] != 0.f ? fabsf(inputUV[1] - uv_b[1]) : 0.f;
dy = 0.5f * (uv_u + uv_d);
/* more adaptive sampling, red and green (UV) channels */
- this->m_inputUVProgram->read(uv_a, x - 1, y - 1, COM_PS_NEAREST, inputBuffers);
- this->m_inputUVProgram->read(uv_b, x - 1, y + 1, COM_PS_NEAREST, inputBuffers);
+ this->m_inputUVProgram->read(uv_a, x - 1, y - 1, COM_PS_NEAREST);
+ this->m_inputUVProgram->read(uv_b, x - 1, y + 1, COM_PS_NEAREST);
uv_l = uv_a[2] != 0.f ? fabsf(inputUV[0] - uv_a[0]) : 0.f;
uv_r = uv_b[2] != 0.f ? fabsf(inputUV[0] - uv_b[0]) : 0.f;
uv_u = uv_a[2] != 0.f ? fabsf(inputUV[1] - uv_a[1]) : 0.f;
@@ -82,8 +82,8 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s
dx += 0.25f * (uv_l + uv_r);
dy += 0.25f * (uv_u + uv_d);
- this->m_inputUVProgram->read(uv_a, x + 1, y - 1, COM_PS_NEAREST, inputBuffers);
- this->m_inputUVProgram->read(uv_b, x + 1, y + 1, COM_PS_NEAREST, inputBuffers);
+ this->m_inputUVProgram->read(uv_a, x + 1, y - 1, COM_PS_NEAREST);
+ this->m_inputUVProgram->read(uv_b, x + 1, y + 1, COM_PS_NEAREST);
uv_l = uv_a[2] != 0.f ? fabsf(inputUV[0] - uv_a[0]) : 0.f;
uv_r = uv_b[2] != 0.f ? fabsf(inputUV[0] - uv_b[0]) : 0.f;
uv_u = uv_a[2] != 0.f ? fabsf(inputUV[1] - uv_a[1]) : 0.f;
@@ -107,7 +107,7 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s
u = inputUV[0] * this->m_inputColorProgram->getWidth();
v = inputUV[1] * this->m_inputColorProgram->getHeight();
- this->m_inputColorProgram->read(color, u, v, dx, dy, inputBuffers);
+ this->m_inputColorProgram->read(color, u, v, dx, dy);
/* "premul" */
if (alpha < 1.0f) {
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.h b/source/blender/compositor/operations/COM_MapUVOperation.h
index c14640da61c..ae042f60789 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.h
+++ b/source/blender/compositor/operations/COM_MapUVOperation.h
@@ -45,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp
index 17d82e85723..96e586ccef8 100644
--- a/source/blender/compositor/operations/COM_MapValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp
@@ -34,10 +34,10 @@ void MapValueOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
-void MapValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MapValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float src[4];
- this->m_inputOperation->read(src, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(src, x, y, sampler);
TexMapping *texmap = this->m_settings;
float value = (src[0] + texmap->loc[0]) * texmap->size[0];
if (texmap->flag & TEXMAP_CLIP_MIN)
diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h
index fb50d0fbe4d..a2664c32a4e 100644
--- a/source/blender/compositor/operations/COM_MapValueOperation.h
+++ b/source/blender/compositor/operations/COM_MapValueOperation.h
@@ -45,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp
index 2b45cd53fd5..c648f3e6f08 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_MaskOperation.cpp
@@ -30,8 +30,9 @@
#include "DNA_scene_types.h"
+#ifdef USE_RASKTER
+
extern "C" {
- #include "BKE_mask.h"
#include "../../../../intern/raskter/raskter.h"
}
@@ -68,7 +69,7 @@ void MaskOperation::deinitExecution()
}
}
-void *MaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *MaskOperation::initializeTileData(rcti *rect)
{
if (this->m_rasterizedMask)
return this->m_rasterizedMask;
@@ -115,7 +116,7 @@ void MaskOperation::determineResolution(unsigned int resolution[], unsigned int
}
}
-void MaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void MaskOperation::executePixel(float *color, int x, int y, void *data)
{
if (!data) {
color[0] = 0.0f;
@@ -127,3 +128,68 @@ void MaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *input
color[0] = buffer[index];
}
}
+
+#else /* mask rasterizer by campbell wip */
+
+MaskOperation::MaskOperation() : NodeOperation()
+{
+ this->addOutputSocket(COM_DT_VALUE);
+ this->m_mask = NULL;
+ this->m_maskWidth = 0;
+ this->m_maskHeight = 0;
+ this->m_framenumber = 0;
+ this->m_rasterMaskHandle = NULL;
+}
+
+void MaskOperation::initExecution()
+{
+ if (this->m_mask) {
+ if (this->m_rasterMaskHandle == NULL) {
+ const int width = this->getWidth();
+ const int height = this->getHeight();
+
+ this->m_rasterMaskHandle = BKE_maskrasterize_handle_new();
+
+ BKE_maskrasterize_handle_init(this->m_rasterMaskHandle, this->m_mask, width, height, TRUE, this->m_do_smooth, this->m_do_feather);
+ }
+ }
+}
+
+void MaskOperation::deinitExecution()
+{
+ if (this->m_rasterMaskHandle) {
+ BKE_maskrasterize_handle_free(this->m_rasterMaskHandle);
+ this->m_rasterMaskHandle = NULL;
+ }
+}
+
+void MaskOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
+{
+ if (this->m_maskWidth == 0 || this->m_maskHeight == 0) {
+ NodeOperation::determineResolution(resolution, preferredResolution);
+ }
+ else {
+ unsigned int nr[2];
+
+ nr[0] = this->m_maskWidth;
+ nr[1] = this->m_maskHeight;
+
+ NodeOperation::determineResolution(resolution, nr);
+
+ resolution[0] = this->m_maskWidth;
+ resolution[1] = this->m_maskHeight;
+ }
+}
+
+void MaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
+{
+ const float xy[2] = {x / (float)this->m_maskWidth, y / (float)this->m_maskHeight};
+ if (this->m_rasterMaskHandle) {
+ color[0] = BKE_maskrasterize_handle_sample(this->m_rasterMaskHandle, xy);
+ }
+ else {
+ color[0] = 0.0f;
+ }
+}
+
+#endif /* USE_RASKTER */
diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h
index df1cad3c0f6..f367298b3d6 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.h
+++ b/source/blender/compositor/operations/COM_MaskOperation.h
@@ -25,12 +25,21 @@
#ifndef _COM_MaskOperation_h
#define _COM_MaskOperation_h
+/* XXX, remove when the USE_RASKTER option is also removed */
+extern "C" {
+ #include "BKE_mask.h"
+}
+
#include "COM_NodeOperation.h"
#include "DNA_scene_types.h"
#include "DNA_mask_types.h"
#include "BLI_listbase.h"
#include "IMB_imbuf_types.h"
+#ifdef __PLX_RASKTER_MT__
+#include "../../../../intern/raskter/raskter.h"
+#endif
+
/**
* Class with implementation of mask rasterization
*/
@@ -42,9 +51,16 @@ protected:
int m_framenumber;
bool m_do_smooth;
bool m_do_feather;
+
+#ifdef USE_RASKTER
float *m_rasterizedMask;
+
ListBase m_maskLayers;
+#else /* USE_RASKTER */
+ struct MaskRasterHandle *m_rasterMaskHandle;
+#endif /* USE_RASKTER */
+
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
@@ -56,7 +72,6 @@ public:
void initExecution();
void deinitExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
void setMask(Mask *mask) { this->m_mask = mask; }
void setMaskWidth(int width) { this->m_maskWidth = width; }
@@ -65,7 +80,12 @@ public:
void setSmooth(bool smooth) { this->m_do_smooth = smooth; }
void setFeather(bool feather) { this->m_do_feather = feather; }
- void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
+#ifdef USE_RASKTER
+ void *initializeTileData(rcti *rect);
+ void executePixel(float *color, int x, int y, void *data);
+#else /* USE_RASKTER */
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
+#endif /* USE_RASKTER */
};
#endif
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index 1bf89be57b5..6c0c27c2522 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -64,132 +64,159 @@ void MathBaseOperation::determineResolution(unsigned int resolution[], unsigned
NodeOperation::determineResolution(resolution, preferredResolution);
}
-void MathAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathBaseOperation::clampIfNeeded(float *color)
+{
+ if (this->m_useClamp) {
+ CLAMP(color[0], 0.0f, 1.0f);
+ }
+}
+
+void MathAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] + inputValue2[0];
+
+ clampIfNeeded(outputValue);
}
-void MathSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] - inputValue2[0];
+
+ clampIfNeeded(outputValue);
}
-void MathMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] * inputValue2[0];
+
+ clampIfNeeded(outputValue);
}
-void MathDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue2[0] == 0) /* We don't want to divide by zero. */
outputValue[0] = 0.0;
else
outputValue[0] = inputValue1[0] / inputValue2[0];
+
+ clampIfNeeded(outputValue);
}
-void MathSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = sin(inputValue1[0]);
+
+ clampIfNeeded(outputValue);
}
-void MathCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = cos(inputValue1[0]);
+
+ clampIfNeeded(outputValue);
}
-void MathTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = tan(inputValue1[0]);
+
+ clampIfNeeded(outputValue);
}
-void MathArcSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathArcSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue1[0] <= 1 && inputValue1[0] >= -1)
outputValue[0] = asin(inputValue1[0]);
else
outputValue[0] = 0.0;
+
+ clampIfNeeded(outputValue);
}
-void MathArcCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathArcCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue1[0] <= 1 && inputValue1[0] >= -1)
outputValue[0] = acos(inputValue1[0]);
else
outputValue[0] = 0.0;
+
+ clampIfNeeded(outputValue);
}
-void MathArcTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathArcTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = atan(inputValue1[0]);
+
+ clampIfNeeded(outputValue);
}
-void MathPowerOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathPowerOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue1[0] >= 0) {
outputValue[0] = pow(inputValue1[0], inputValue2[0]);
@@ -204,75 +231,89 @@ void MathPowerOperation::executePixel(float *outputValue, float x, float y, Pixe
outputValue[0] = 0.0;
}
}
+
+ clampIfNeeded(outputValue);
}
-void MathLogarithmOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathLogarithmOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue1[0] > 0 && inputValue2[0] > 0)
outputValue[0] = log(inputValue1[0]) / log(inputValue2[0]);
else
outputValue[0] = 0.0;
+
+ clampIfNeeded(outputValue);
}
-void MathMinimumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathMinimumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = min(inputValue1[0], inputValue2[0]);
+
+ clampIfNeeded(outputValue);
}
-void MathMaximumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathMaximumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = max(inputValue1[0], inputValue2[0]);
+
+ clampIfNeeded(outputValue);
}
-void MathRoundOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathRoundOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = round(inputValue1[0]);
+
+ clampIfNeeded(outputValue);
}
-void MathLessThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathLessThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] < inputValue2[0] ? 1.0f : 0.0f;
+
+ clampIfNeeded(outputValue);
}
-void MathGreaterThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MathGreaterThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
- this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
- this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
+ this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
+ this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f;
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h
index be06537cbf0..8fc6c762b16 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.h
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.h
@@ -37,16 +37,20 @@ protected:
SocketReader *m_inputValue1Operation;
SocketReader *m_inputValue2Operation;
+ bool m_useClamp;
+
protected:
/**
* Default constructor
*/
MathBaseOperation();
+
+ void clampIfNeeded(float *color);
public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]) = 0;
+ void executePixel(float *color, float x, float y, PixelSampler sampler) = 0;
/**
* Initialize the execution
@@ -62,93 +66,95 @@ public:
* Determine resolution
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
+
+ void setUseClamp(bool value) { this->m_useClamp = value; }
};
class MathAddOperation : public MathBaseOperation {
public:
MathAddOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathSubtractOperation : public MathBaseOperation {
public:
MathSubtractOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathMultiplyOperation : public MathBaseOperation {
public:
MathMultiplyOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathDivideOperation : public MathBaseOperation {
public:
MathDivideOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathSineOperation : public MathBaseOperation {
public:
MathSineOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathCosineOperation : public MathBaseOperation {
public:
MathCosineOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathTangentOperation : public MathBaseOperation {
public:
MathTangentOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathArcSineOperation : public MathBaseOperation {
public:
MathArcSineOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathArcCosineOperation : public MathBaseOperation {
public:
MathArcCosineOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathArcTangentOperation : public MathBaseOperation {
public:
MathArcTangentOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathPowerOperation : public MathBaseOperation {
public:
MathPowerOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathLogarithmOperation : public MathBaseOperation {
public:
MathLogarithmOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathMinimumOperation : public MathBaseOperation {
public:
MathMinimumOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathMaximumOperation : public MathBaseOperation {
public:
MathMaximumOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathRoundOperation : public MathBaseOperation {
public:
MathRoundOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathLessThanOperation : public MathBaseOperation {
public:
MathLessThanOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
class MathGreaterThanOperation : public MathBaseOperation {
public:
MathGreaterThanOperation() : MathBaseOperation() {}
- void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixAddOperation.cpp b/source/blender/compositor/operations/COM_MixAddOperation.cpp
index 7f7315fb3ff..b49c65cc010 100644
--- a/source/blender/compositor/operations/COM_MixAddOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixAddOperation.cpp
@@ -27,15 +27,15 @@ MixAddOperation::MixAddOperation() : MixBaseOperation()
/* pass */
}
-void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float inputValue[4];
- this->m_inputValueOperation->read(inputValue, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(inputColor2, x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(inputValue, x, y, sampler);
+ this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
+ this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
float value = inputValue[0];
@@ -46,5 +46,7 @@ void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSa
outputValue[1] = inputColor1[1] + value * inputColor2[1];
outputValue[2] = inputColor1[2] + value * inputColor2[2];
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixAddOperation.h b/source/blender/compositor/operations/COM_MixAddOperation.h
index c5eaf0a4d77..8fc41706073 100644
--- a/source/blender/compositor/operations/COM_MixAddOperation.h
+++ b/source/blender/compositor/operations/COM_MixAddOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.cpp b/source/blender/compositor/operations/COM_MixBaseOperation.cpp
index fbe92f54aa8..9f9c432895e 100644
--- a/source/blender/compositor/operations/COM_MixBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixBaseOperation.cpp
@@ -32,6 +32,7 @@ MixBaseOperation::MixBaseOperation() : NodeOperation()
this->m_inputColor1Operation = NULL;
this->m_inputColor2Operation = NULL;
this->setUseValueAlphaMultiply(false);
+ this->setUseClamp(false);
}
void MixBaseOperation::initExecution()
@@ -41,16 +42,17 @@ void MixBaseOperation::initExecution()
this->m_inputColor2Operation = this->getInputSocketReader(2);
}
-void MixBaseOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixBaseOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
- float value;
+ float inputValue[4];
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(inputValue, x, y, sampler);
+ this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
+ this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
+ float value = inputValue[0];
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
}
@@ -93,4 +95,3 @@ void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned i
}
NodeOperation::determineResolution(resolution, preferredResolution);
}
-
diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.h b/source/blender/compositor/operations/COM_MixBaseOperation.h
index 268d4832243..0a8ed4fa0e1 100644
--- a/source/blender/compositor/operations/COM_MixBaseOperation.h
+++ b/source/blender/compositor/operations/COM_MixBaseOperation.h
@@ -38,6 +38,18 @@ protected:
SocketReader *m_inputColor1Operation;
SocketReader *m_inputColor2Operation;
bool m_valueAlphaMultiply;
+ bool m_useClamp;
+
+ inline void clampIfNeeded(float *color)
+ {
+ if (m_useClamp) {
+ CLAMP(color[0], 0.0f, 1.0f);
+ CLAMP(color[1], 0.0f, 1.0f);
+ CLAMP(color[2], 0.0f, 1.0f);
+ CLAMP(color[3], 0.0f, 1.0f);
+ }
+ }
+
public:
/**
* Default constructor
@@ -47,7 +59,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
@@ -63,5 +75,6 @@ public:
void setUseValueAlphaMultiply(const bool value) { this->m_valueAlphaMultiply = value; }
bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; }
+ void setUseClamp(bool value) { this->m_useClamp = value; }
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixBlendOperation.cpp b/source/blender/compositor/operations/COM_MixBlendOperation.cpp
index 341aba0e7fc..090343e8450 100644
--- a/source/blender/compositor/operations/COM_MixBlendOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixBlendOperation.cpp
@@ -27,16 +27,16 @@ MixBlendOperation::MixBlendOperation() : MixBaseOperation()
/* pass */
}
-void MixBlendOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixBlendOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float inputValue[4];
float value;
- this->m_inputValueOperation->read(inputValue, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(inputColor2, x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(inputValue, x, y, sampler);
+ this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
+ this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
value = inputValue[0];
if (this->useValueAlphaMultiply()) {
@@ -47,4 +47,6 @@ void MixBlendOperation::executePixel(float *outputValue, float x, float y, Pixel
outputValue[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
outputValue[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixBlendOperation.h b/source/blender/compositor/operations/COM_MixBlendOperation.h
index 16ad635bebd..6073ca1fc52 100644
--- a/source/blender/compositor/operations/COM_MixBlendOperation.h
+++ b/source/blender/compositor/operations/COM_MixBlendOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixBurnOperation.cpp b/source/blender/compositor/operations/COM_MixBurnOperation.cpp
index 039915ab66a..fbb3cb7b27b 100644
--- a/source/blender/compositor/operations/COM_MixBurnOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixBurnOperation.cpp
@@ -27,16 +27,16 @@ MixBurnOperation::MixBurnOperation() : MixBaseOperation()
/* pass */
}
-void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
float tmp;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -83,5 +83,7 @@ void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelS
}
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixBurnOperation.h b/source/blender/compositor/operations/COM_MixBurnOperation.h
index 7412f651ab3..88435f05503 100644
--- a/source/blender/compositor/operations/COM_MixBurnOperation.h
+++ b/source/blender/compositor/operations/COM_MixBurnOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixColorOperation.cpp b/source/blender/compositor/operations/COM_MixColorOperation.cpp
index cb5791c02bb..378cfbd9b6c 100644
--- a/source/blender/compositor/operations/COM_MixColorOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixColorOperation.cpp
@@ -31,15 +31,15 @@ MixColorOperation::MixColorOperation() : MixBaseOperation()
/* pass */
}
-void MixColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -58,5 +58,7 @@ void MixColorOperation::executePixel(float *outputValue, float x, float y, Pixel
outputValue[2] = valuem * (inputColor1[2]) + value * tmpb;
}
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixColorOperation.h b/source/blender/compositor/operations/COM_MixColorOperation.h
index 028ff517132..fb91a426f40 100644
--- a/source/blender/compositor/operations/COM_MixColorOperation.h
+++ b/source/blender/compositor/operations/COM_MixColorOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp
index db243cf4a87..68f9c023733 100644
--- a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp
@@ -27,15 +27,15 @@ MixDarkenOperation::MixDarkenOperation() : MixBaseOperation()
/* pass */
}
-void MixDarkenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixDarkenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -53,5 +53,7 @@ void MixDarkenOperation::executePixel(float *outputValue, float x, float y, Pixe
else outputValue[2] = inputColor1[2];
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.h b/source/blender/compositor/operations/COM_MixDarkenOperation.h
index 337fa1a7024..8b5afaecbd5 100644
--- a/source/blender/compositor/operations/COM_MixDarkenOperation.h
+++ b/source/blender/compositor/operations/COM_MixDarkenOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp
index 9fe1a3cb94b..48964e8b78b 100644
--- a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp
@@ -28,15 +28,15 @@ MixDifferenceOperation::MixDifferenceOperation() : MixBaseOperation()
/* pass */
}
-void MixDifferenceOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixDifferenceOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -46,5 +46,7 @@ void MixDifferenceOperation::executePixel(float *outputValue, float x, float y,
outputValue[1] = valuem * inputColor1[1] + value *fabsf(inputColor1[1] - inputColor2[1]);
outputValue[2] = valuem * inputColor1[2] + value *fabsf(inputColor1[2] - inputColor2[2]);
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixDifferenceOperation.h b/source/blender/compositor/operations/COM_MixDifferenceOperation.h
index 503fbb691d3..f4ad5d07586 100644
--- a/source/blender/compositor/operations/COM_MixDifferenceOperation.h
+++ b/source/blender/compositor/operations/COM_MixDifferenceOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.cpp b/source/blender/compositor/operations/COM_MixDivideOperation.cpp
index 0e1bd408b89..d9d2383001b 100644
--- a/source/blender/compositor/operations/COM_MixDivideOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixDivideOperation.cpp
@@ -27,15 +27,15 @@ MixDivideOperation::MixDivideOperation() : MixBaseOperation()
/* pass */
}
-void MixDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -56,5 +56,7 @@ void MixDivideOperation::executePixel(float *outputValue, float x, float y, Pixe
outputValue[2] = 0.0f;
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.h b/source/blender/compositor/operations/COM_MixDivideOperation.h
index db60a39f93f..8f94fc2d510 100644
--- a/source/blender/compositor/operations/COM_MixDivideOperation.h
+++ b/source/blender/compositor/operations/COM_MixDivideOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp
index ea01806267b..34c6e4043f2 100644
--- a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp
@@ -27,16 +27,16 @@ MixDodgeOperation::MixDodgeOperation() : MixBaseOperation()
/* pass */
}
-void MixDodgeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixDodgeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
float tmp;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -88,5 +88,7 @@ void MixDodgeOperation::executePixel(float *outputValue, float x, float y, Pixel
outputValue[2] = 0.0f;
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixDodgeOperation.h b/source/blender/compositor/operations/COM_MixDodgeOperation.h
index 32aa8593657..f99a82dca8d 100644
--- a/source/blender/compositor/operations/COM_MixDodgeOperation.h
+++ b/source/blender/compositor/operations/COM_MixDodgeOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixGlareOperation.cpp b/source/blender/compositor/operations/COM_MixGlareOperation.cpp
index 7cd24b3bf06..4a569404ddc 100644
--- a/source/blender/compositor/operations/COM_MixGlareOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixGlareOperation.cpp
@@ -27,16 +27,16 @@ MixGlareOperation::MixGlareOperation() : MixBaseOperation()
/* pass */
}
-void MixGlareOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixGlareOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float inputValue[4];
float value;
- this->m_inputValueOperation->read(inputValue, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(inputColor2, x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(inputValue, x, y, sampler);
+ this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
+ this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
value = inputValue[0];
float mf = 2.f - 2.f * fabsf(value - 0.5f);
@@ -44,4 +44,6 @@ void MixGlareOperation::executePixel(float *outputValue, float x, float y, Pixel
outputValue[1] = mf * ((inputColor1[1]) + value * (inputColor2[1] - inputColor1[1]));
outputValue[2] = mf * ((inputColor1[2]) + value * (inputColor2[2] - inputColor1[2]));
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixGlareOperation.h b/source/blender/compositor/operations/COM_MixGlareOperation.h
index 1c715d7414b..23b9f2420a0 100644
--- a/source/blender/compositor/operations/COM_MixGlareOperation.h
+++ b/source/blender/compositor/operations/COM_MixGlareOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixHueOperation.cpp b/source/blender/compositor/operations/COM_MixHueOperation.cpp
index e7b444616f4..3745f502709 100644
--- a/source/blender/compositor/operations/COM_MixHueOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixHueOperation.cpp
@@ -31,15 +31,15 @@ MixHueOperation::MixHueOperation() : MixBaseOperation()
/* pass */
}
-void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -58,4 +58,6 @@ void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSa
outputValue[2] = valuem * (inputColor1[2]) + value * tmpb;
}
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixHueOperation.h b/source/blender/compositor/operations/COM_MixHueOperation.h
index ff1ef369440..1c8eadabbbd 100644
--- a/source/blender/compositor/operations/COM_MixHueOperation.h
+++ b/source/blender/compositor/operations/COM_MixHueOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.cpp b/source/blender/compositor/operations/COM_MixLightenOperation.cpp
index 89166637f9f..868459db8bf 100644
--- a/source/blender/compositor/operations/COM_MixLightenOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixLightenOperation.cpp
@@ -27,15 +27,15 @@ MixLightenOperation::MixLightenOperation() : MixBaseOperation()
/* pass */
}
-void MixLightenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixLightenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -51,5 +51,7 @@ void MixLightenOperation::executePixel(float *outputValue, float x, float y, Pix
if (tmp > inputColor1[2]) outputValue[2] = tmp;
else outputValue[2] = inputColor1[2];
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.h b/source/blender/compositor/operations/COM_MixLightenOperation.h
index dd51215b26a..d03ab317035 100644
--- a/source/blender/compositor/operations/COM_MixLightenOperation.h
+++ b/source/blender/compositor/operations/COM_MixLightenOperation.h
@@ -39,6 +39,6 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp
index 5406a3cbcc1..2fff05fbbc9 100644
--- a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp
@@ -27,15 +27,15 @@ MixLinearLightOperation::MixLinearLightOperation() : MixBaseOperation()
/* pass */
}
-void MixLinearLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixLinearLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -54,4 +54,6 @@ void MixLinearLightOperation::executePixel(float *outputValue, float x, float y,
outputValue[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f);
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixLinearLightOperation.h b/source/blender/compositor/operations/COM_MixLinearLightOperation.h
index e96e2b7eaf7..7a9acbe00b0 100644
--- a/source/blender/compositor/operations/COM_MixLinearLightOperation.h
+++ b/source/blender/compositor/operations/COM_MixLinearLightOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp b/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp
index 978e96eb2f6..911c0c83b90 100644
--- a/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp
@@ -27,15 +27,15 @@ MixMultiplyOperation::MixMultiplyOperation() : MixBaseOperation()
/* pass */
}
-void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float inputValue[4];
- this->m_inputValueOperation->read(inputValue, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(inputColor2, x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(inputValue, x, y, sampler);
+ this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
+ this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
float value = inputValue[0];
if (this->useValueAlphaMultiply()) {
@@ -46,5 +46,7 @@ void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, Pi
outputValue[1] = inputColor1[1] * (valuem + value * inputColor2[1]);
outputValue[2] = inputColor1[2] * (valuem + value * inputColor2[2]);
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixMultiplyOperation.h b/source/blender/compositor/operations/COM_MixMultiplyOperation.h
index 4c89a8f2957..ab7d06aecf6 100644
--- a/source/blender/compositor/operations/COM_MixMultiplyOperation.h
+++ b/source/blender/compositor/operations/COM_MixMultiplyOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp
index f4f96747acd..ba7a86a80a7 100644
--- a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp
@@ -27,15 +27,15 @@ MixOverlayOperation::MixOverlayOperation() : MixBaseOperation()
/* pass */
}
-void MixOverlayOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixOverlayOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -62,5 +62,7 @@ void MixOverlayOperation::executePixel(float *outputValue, float x, float y, Pix
outputValue[2] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
}
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.h b/source/blender/compositor/operations/COM_MixOverlayOperation.h
index 7de955b9f4f..d31396f471b 100644
--- a/source/blender/compositor/operations/COM_MixOverlayOperation.h
+++ b/source/blender/compositor/operations/COM_MixOverlayOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp
index c9c6f691fdb..403dac57615 100644
--- a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp
@@ -31,15 +31,15 @@ MixSaturationOperation::MixSaturationOperation() : MixBaseOperation()
/* pass */
}
-void MixSaturationOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixSaturationOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -54,4 +54,6 @@ void MixSaturationOperation::executePixel(float *outputValue, float x, float y,
hsv_to_rgb(rH, (valuem * rS + value * colS), rV, &outputValue[0], &outputValue[1], &outputValue[2]);
}
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.h b/source/blender/compositor/operations/COM_MixSaturationOperation.h
index 241009e2645..f89f03c0e18 100644
--- a/source/blender/compositor/operations/COM_MixSaturationOperation.h
+++ b/source/blender/compositor/operations/COM_MixSaturationOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixScreenOperation.cpp b/source/blender/compositor/operations/COM_MixScreenOperation.cpp
index 9bc9144f4ff..781bc87ece7 100644
--- a/source/blender/compositor/operations/COM_MixScreenOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixScreenOperation.cpp
@@ -27,15 +27,15 @@ MixScreenOperation::MixScreenOperation() : MixBaseOperation()
/* pass */
}
-void MixScreenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixScreenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float valuev[4];
- this->m_inputValueOperation->read(valuev, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(valuev, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
float value = valuev[0];
if (this->useValueAlphaMultiply()) {
@@ -47,5 +47,7 @@ void MixScreenOperation::executePixel(float *outputValue, float x, float y, Pixe
outputValue[1] = 1.0f - (valuem + value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
outputValue[2] = 1.0f - (valuem + value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixScreenOperation.h b/source/blender/compositor/operations/COM_MixScreenOperation.h
index 4d0c1fded3d..843adc870f8 100644
--- a/source/blender/compositor/operations/COM_MixScreenOperation.h
+++ b/source/blender/compositor/operations/COM_MixScreenOperation.h
@@ -39,6 +39,6 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp
index 52c2e8829dc..b1374aa7f32 100644
--- a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp
@@ -27,15 +27,15 @@ MixSoftLightOperation::MixSoftLightOperation() : MixBaseOperation()
/* pass */
}
-void MixSoftLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) \
- {
+void MixSoftLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler) \
+{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -52,5 +52,7 @@ void MixSoftLightOperation::executePixel(float *outputValue, float x, float y, P
outputValue[1] = valuem * (inputColor1[1]) + value * (((1.0f - inputColor1[1]) * inputColor2[1] * (inputColor1[1])) + (inputColor1[1] * scg));
outputValue[2] = valuem * (inputColor1[2]) + value * (((1.0f - inputColor1[2]) * inputColor2[2] * (inputColor1[2])) + (inputColor1[2] * scb));
outputValue[3] = inputColor1[3];
- }
+
+ clampIfNeeded(outputValue);
+}
diff --git a/source/blender/compositor/operations/COM_MixSoftLightOperation.h b/source/blender/compositor/operations/COM_MixSoftLightOperation.h
index bcb718027b2..570cf2cb6ef 100644
--- a/source/blender/compositor/operations/COM_MixSoftLightOperation.h
+++ b/source/blender/compositor/operations/COM_MixSoftLightOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp
index 60f54ab478d..f7b558e5c7a 100644
--- a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp
@@ -27,15 +27,15 @@ MixSubtractOperation::MixSubtractOperation() : MixBaseOperation()
/* pass */
}
-void MixSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -44,5 +44,7 @@ void MixSubtractOperation::executePixel(float *outputValue, float x, float y, Pi
outputValue[1] = inputColor1[1] - value * (inputColor2[1]);
outputValue[2] = inputColor1[2] - value * (inputColor2[2]);
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixSubtractOperation.h b/source/blender/compositor/operations/COM_MixSubtractOperation.h
index 3c8112b0e36..a9198cf3400 100644
--- a/source/blender/compositor/operations/COM_MixSubtractOperation.h
+++ b/source/blender/compositor/operations/COM_MixSubtractOperation.h
@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MixValueOperation.cpp b/source/blender/compositor/operations/COM_MixValueOperation.cpp
index 2651b0d7dee..8f8d3305ee9 100644
--- a/source/blender/compositor/operations/COM_MixValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixValueOperation.cpp
@@ -31,15 +31,15 @@ MixValueOperation::MixValueOperation() : MixBaseOperation()
/* pass */
}
-void MixValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MixValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
float value;
- this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers);
- this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers);
- this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers);
+ this->m_inputValueOperation->read(&value, x, y, sampler);
+ this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
+ this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
@@ -52,4 +52,6 @@ void MixValueOperation::executePixel(float *outputValue, float x, float y, Pixel
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
hsv_to_rgb(rH, rS, (valuem * rV + value * colV), &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor1[3];
+
+ clampIfNeeded(outputValue);
}
diff --git a/source/blender/compositor/operations/COM_MixValueOperation.h b/source/blender/compositor/operations/COM_MixValueOperation.h
index c0f3ce10f29..06316afcd73 100644
--- a/source/blender/compositor/operations/COM_MixValueOperation.h
+++ b/source/blender/compositor/operations/COM_MixValueOperation.h
@@ -39,6 +39,6 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
index 1af206920c5..14d7fa7e649 100644
--- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
@@ -33,7 +33,7 @@ MovieClipAttributeOperation::MovieClipAttributeOperation() : NodeOperation()
this->m_attribute = MCA_X;
}
-void MovieClipAttributeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MovieClipAttributeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
if (!this->m_valueSet) {
float loc[2], scale, angle;
diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
index c6422fbbfc2..28028ab6fd4 100644
--- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
+++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
@@ -51,7 +51,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void setMovieClip(MovieClip *clip) { this->m_clip = clip; }
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
index f53bb66d478..8b88f5c7d14 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
@@ -48,7 +48,16 @@ void MovieClipOperation::initExecution()
if (this->m_movieClip) {
BKE_movieclip_user_set_frame(this->m_movieClipUser, this->m_framenumber);
ImBuf *ibuf;
- ibuf = BKE_movieclip_get_ibuf(this->m_movieClip, this->m_movieClipUser);
+
+ if (this->m_cacheFrame) {
+ ibuf = BKE_movieclip_get_ibuf(this->m_movieClip, this->m_movieClipUser);
+ }
+ else {
+ int flag = this->m_movieClip->flag & MCLIP_TIMECODE_FLAGS;
+
+ ibuf = BKE_movieclip_get_ibuf_flag(this->m_movieClip, this->m_movieClipUser, flag, MOVIECLIP_CACHE_SKIP);
+ }
+
if (ibuf) {
this->m_movieClipBuffer = ibuf;
if (ibuf->rect_float == NULL || ibuf->userflags & IB_RECT_INVALID) {
@@ -83,7 +92,7 @@ void MovieClipOperation::determineResolution(unsigned int resolution[], unsigned
}
}
-void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
if (this->m_movieClipBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
zero_v4(color);
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h
index 2e824009ab6..f3e95818bd7 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.h
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.h
@@ -43,6 +43,7 @@ protected:
int m_movieClipheight;
int m_movieClipwidth;
int m_framenumber;
+ bool m_cacheFrame;
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
@@ -56,9 +57,10 @@ public:
void deinitExecution();
void setMovieClip(MovieClip *image) { this->m_movieClip = image; }
void setMovieClipUser(MovieClipUser *imageuser) { this->m_movieClipUser = imageuser; }
+ void setCacheFrame(bool value) { this->m_cacheFrame = value; }
void setFramenumber(int framenumber) { this->m_framenumber = framenumber; }
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
index 6b423cadcc6..964d4352bc0 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
@@ -78,16 +78,16 @@ void MovieDistortionOperation::deinitExecution()
}
-void MovieDistortionOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MovieDistortionOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
if (this->m_cache != NULL) {
float u, v;
this->m_cache->getUV(&this->m_movieClip->tracking, x, y, &u, &v);
- this->m_inputOperation->read(color, u, v, sampler, inputBuffers);
+ this->m_inputOperation->read(color, u, v, sampler);
}
else {
- this->m_inputOperation->read(color, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(color, x, y, sampler);
}
}
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
index ab81ae44597..8cd9e98da2d 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
@@ -130,7 +130,7 @@ protected:
public:
MovieDistortionOperation(bool distortion);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
index 363c0379770..27214acd0d4 100644
--- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
@@ -43,7 +43,7 @@ ImBuf *MultilayerBaseOperation::getImBuf()
return NULL;
}
-void MultilayerColorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MultilayerColorOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
int yi = y;
int xi = x;
@@ -74,7 +74,7 @@ void MultilayerColorOperation::executePixel(float *color, float x, float y, Pixe
}
}
-void MultilayerValueOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MultilayerValueOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
int yi = y;
int xi = x;
@@ -87,7 +87,7 @@ void MultilayerValueOperation::executePixel(float *color, float x, float y, Pixe
}
}
-void MultilayerVectorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void MultilayerVectorOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
int yi = y;
int xi = x;
diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.h b/source/blender/compositor/operations/COM_MultilayerImageOperation.h
index f946c44dd35..82bd8c455df 100644
--- a/source/blender/compositor/operations/COM_MultilayerImageOperation.h
+++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.h
@@ -46,7 +46,7 @@ public:
MultilayerColorOperation(int pass) : MultilayerBaseOperation(pass) {
this->addOutputSocket(COM_DT_COLOR);
}
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
class MultilayerValueOperation : public MultilayerBaseOperation {
@@ -54,7 +54,7 @@ public:
MultilayerValueOperation(int pass) : MultilayerBaseOperation(pass) {
this->addOutputSocket(COM_DT_VALUE);
}
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
class MultilayerVectorOperation : public MultilayerBaseOperation {
@@ -62,7 +62,7 @@ public:
MultilayerVectorOperation(int pass) : MultilayerBaseOperation(pass) {
this->addOutputSocket(COM_DT_VECTOR);
}
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
index 8a83ef7f3ae..02ea7f2b257 100644
--- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp
+++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
@@ -35,13 +35,13 @@ void NormalizeOperation::initExecution()
NodeOperation::initMutex();
}
-void NormalizeOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void NormalizeOperation::executePixel(float *color, int x, int y, void *data)
{
/* using generic two floats struct to store x: min y: mult */
NodeTwoFloats *minmult = (NodeTwoFloats *)data;
float output[4];
- this->m_imageReader->read(output, x, y, inputBuffers, NULL);
+ this->m_imageReader->read(output, x, y, NULL);
color[0] = (output[0] - minmult->x) * minmult->y;
}
@@ -75,11 +75,11 @@ bool NormalizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
/* The code below assumes all data is inside range +- this, and that input buffer is single channel */
#define BLENDER_ZMAX 10000.0f
-void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *NormalizeOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (this->m_cachedInstance == NULL) {
- MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect);
/* using generic two floats struct to store x: min y: mult */
NodeTwoFloats *minmult = new NodeTwoFloats();
@@ -113,7 +113,7 @@ void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
return this->m_cachedInstance;
}
-void NormalizeOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
+void NormalizeOperation::deinitializeTileData(rcti *rect, void *data)
{
/* pass */
}
diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.h b/source/blender/compositor/operations/COM_NormalizeOperation.h
index 1f4a403434e..f36d69a3018 100644
--- a/source/blender/compositor/operations/COM_NormalizeOperation.h
+++ b/source/blender/compositor/operations/COM_NormalizeOperation.h
@@ -47,15 +47,15 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
- void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
+ void *initializeTileData(rcti *rect);
+ void deinitializeTileData(rcti *rect, void *data);
/**
* Deinitialize the execution
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl
index 1f3b28f15d3..4f43650370d 100644
--- a/source/blender/compositor/operations/COM_OpenCLKernels.cl
+++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl
@@ -1,7 +1,30 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ */
+
/// This file contains all opencl kernels for node-operation implementations
// Global SAMPLERS
-const sampler_t SAMPLER_NEAREST = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
+const sampler_t SAMPLER_NEAREST = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
+const sampler_t SAMPLER_NEAREST_CLAMP = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
__constant const int2 zero = {0,0};
@@ -21,7 +44,7 @@ __kernel void bokehBlurKernel(__read_only image2d_t boundingBox, __read_only ima
tempBoundingBox = read_imagef(boundingBox, SAMPLER_NEAREST, coords).s0;
- if (tempBoundingBox > 0.0f) {
+ if (tempBoundingBox > 0.0f && radius > 0 ) {
const int2 bokehImageDim = get_image_dim(bokehImage);
const int2 bokehImageCenter = bokehImageDim/2;
const int2 minXY = max(realCoordinate - radius, zero);
@@ -78,18 +101,18 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
float size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);
- for (int ny = miny; ny < maxy; ny += step) {
- for (int nx = minx; nx < maxx; nx += step) {
- if (nx >= 0 && nx < dimension.s0 && ny >= 0 && ny < dimension.s1) {
- inputCoordinate.s0 = nx - offsetInput.s0;
- inputCoordinate.s1 = ny - offsetInput.s1;
- tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
- if (size > threshold && tempSize > threshold) {
- float dx = nx - realCoordinate.s0;
- float dy = ny - realCoordinate.s1;
- if (dx != 0 || dy != 0) {
+ if (size > threshold) {
+ for (int ny = miny; ny < maxy; ny += step) {
+ inputCoordinate.s1 = ny - offsetInput.s1;
+ float dy = ny - realCoordinate.s1;
+ for (int nx = minx; nx < maxx; nx += step) {
+ float dx = nx - realCoordinate.s0;
+ if (dx != 0 || dy != 0) {
+ inputCoordinate.s0 = nx - offsetInput.s0;
+ tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
+ if (tempSize > threshold) {
if (tempSize >= fabs(dx) && tempSize >= fabs(dy)) {
- float2 uv = { 256.0f + dx * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize};
+ float2 uv = { 256.0f + dx * 255.0f / tempSize, 256.0f + dy * 255.0f / tempSize};
bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);
readColor = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);
color_accum += bokeh*readColor;
@@ -98,8 +121,8 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
}
}
}
- }
- }
+ }
+ }
}
color = color_accum * (1.0f / multiplier_accum);
@@ -168,3 +191,44 @@ __kernel void erodeKernel(__read_only image2d_t inputImage, __write_only image2
float4 color = {value,0.0f,0.0f,0.0f};
write_imagef(output, coords, color);
}
+
+// KERNEL --- DIRECTIONAL BLUR ---
+__kernel void directionalBlurKernel(__read_only image2d_t inputImage, __write_only image2d_t output,
+ int2 offsetOutput, int iterations, float scale, float rotation, float2 translate,
+ float2 center, int2 offset)
+{
+ int2 coords = {get_global_id(0), get_global_id(1)};
+ coords += offset;
+ const int2 realCoordinate = coords + offsetOutput;
+
+ float4 col;
+ float2 ltxy = translate;
+ float lsc = scale;
+ float lrot = rotation;
+
+ col = read_imagef(inputImage, SAMPLER_NEAREST, realCoordinate);
+
+ /* blur the image */
+ for (int i = 0; i < iterations; ++i) {
+ const float cs = cos(lrot), ss = sin(lrot);
+ const float isc = 1.0f / (1.0f + lsc);
+
+ const float v = isc * (realCoordinate.s1 - center.s1) + ltxy.s1;
+ const float u = isc * (realCoordinate.s0 - center.s0) + ltxy.s0;
+ float2 uv = {
+ cs * u + ss * v + center.s0,
+ cs * v - ss * u + center.s1
+ };
+
+ col += read_imagef(inputImage, SAMPLER_NEAREST_CLAMP, uv);
+
+ /* double transformations */
+ ltxy += translate;
+ lrot += rotation;
+ lsc += scale;
+ }
+
+ col *= (1.0f/(iterations+1));
+
+ write_imagef(output, coords, col);
+}
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h
index 1c223a527ca..cc18039c5b1 100644
--- a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h
+++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h
@@ -1,9 +1,32 @@
/* clkernelstoh output of file <COM_OpenCLKernels_cl> */
-const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all opencl kernels for node-operation implementations\n" \
+const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \
+" * Copyright 2011, Blender Foundation.\n" \
+" *\n" \
+" * This program is free software; you can redistribute it and/or\n" \
+" * modify it under the terms of the GNU General Public License\n" \
+" * as published by the Free Software Foundation; either version 2\n" \
+" * of the License, or (at your option) any later version.\n" \
+" *\n" \
+" * This program is distributed in the hope that it will be useful,\n" \
+" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \
+" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \
+" * GNU General Public License for more details.\n" \
+" *\n" \
+" * You should have received a copy of the GNU General Public License\n" \
+" * along with this program; if not, write to the Free Software Foundation,\n" \
+" * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n" \
+" *\n" \
+" * Contributor:\n" \
+" * Jeroen Bakker\n" \
+" * Monique Dewanchand\n" \
+" */\n" \
+"\n" \
+"/// This file contains all opencl kernels for node-operation implementations\n" \
"\n" \
"// Global SAMPLERS\n" \
-"const sampler_t SAMPLER_NEAREST = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;\n" \
+"const sampler_t SAMPLER_NEAREST = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;\n" \
+"const sampler_t SAMPLER_NEAREST_CLAMP = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;\n" \
"\n" \
"__constant const int2 zero = {0,0};\n" \
"\n" \
@@ -23,7 +46,7 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope
"\n" \
" tempBoundingBox = read_imagef(boundingBox, SAMPLER_NEAREST, coords).s0;\n" \
"\n" \
-" if (tempBoundingBox > 0.0f) {\n" \
+" if (tempBoundingBox > 0.0f && radius > 0 ) {\n" \
" const int2 bokehImageDim = get_image_dim(bokehImage);\n" \
" const int2 bokehImageCenter = bokehImageDim/2;\n" \
" const int2 minXY = max(realCoordinate - radius, zero);\n" \
@@ -80,16 +103,16 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope
" float size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \
" color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);\n" \
"\n" \
-" for (int ny = miny; ny < maxy; ny += step) {\n" \
-" for (int nx = minx; nx < maxx; nx += step) {\n" \
-" if (nx >= 0 && nx < dimension.s0 && ny >= 0 && ny < dimension.s1) {\n" \
-" inputCoordinate.s0 = nx - offsetInput.s0;\n" \
-" inputCoordinate.s1 = ny - offsetInput.s1;\n" \
-" tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \
-" if (size > threshold && tempSize > threshold) {\n" \
-" float dx = nx - realCoordinate.s0;\n" \
-" float dy = ny - realCoordinate.s1;\n" \
-" if (dx != 0 || dy != 0) {\n" \
+" if (size > threshold) {\n" \
+" for (int ny = miny; ny < maxy; ny += step) {\n" \
+" inputCoordinate.s1 = ny - offsetInput.s1;\n" \
+" float dy = ny - realCoordinate.s1;\n" \
+" for (int nx = minx; nx < maxx; nx += step) {\n" \
+" float dx = nx - realCoordinate.s0;\n" \
+" if (dx != 0 || dy != 0) {\n" \
+" inputCoordinate.s0 = nx - offsetInput.s0;\n" \
+" tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \
+" if (tempSize > threshold) {\n" \
" if (tempSize >= fabs(dx) && tempSize >= fabs(dy)) {\n" \
" float2 uv = { 256.0f + dx * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize};\n" \
" bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);\n" \
@@ -170,4 +193,45 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope
" float4 color = {value,0.0f,0.0f,0.0f};\n" \
" write_imagef(output, coords, color);\n" \
"}\n" \
+"\n" \
+"// KERNEL --- DIRECTIONAL BLUR ---\n" \
+"__kernel void directionalBlurKernel(__read_only image2d_t inputImage, __write_only image2d_t output,\n" \
+" int2 offsetOutput, int iterations, float scale, float rotation, float2 translate,\n" \
+" float2 center, int2 offset)\n" \
+"{\n" \
+" int2 coords = {get_global_id(0), get_global_id(1)};\n" \
+" coords += offset;\n" \
+" const int2 realCoordinate = coords + offsetOutput;\n" \
+"\n" \
+" float4 col;\n" \
+" float2 ltxy = translate;\n" \
+" float lsc = scale;\n" \
+" float lrot = rotation;\n" \
+"\n" \
+" col = read_imagef(inputImage, SAMPLER_NEAREST, realCoordinate);\n" \
+"\n" \
+" /* blur the image */\n" \
+" for (int i = 0; i < iterations; ++i) {\n" \
+" const float cs = cos(lrot), ss = sin(lrot);\n" \
+" const float isc = 1.0f / (1.0f + lsc);\n" \
+"\n" \
+" const float v = isc * (realCoordinate.s1 - center.s1) + ltxy.s1;\n" \
+" const float u = isc * (realCoordinate.s0 - center.s0) + ltxy.s0;\n" \
+" float2 uv = {\n" \
+" cs * u + ss * v + center.s0,\n" \
+" cs * v - ss * u + center.s1\n" \
+" };\n" \
+"\n" \
+" col += read_imagef(inputImage, SAMPLER_NEAREST_CLAMP, uv);\n" \
+"\n" \
+" /* double transformations */\n" \
+" ltxy += translate;\n" \
+" lrot += rotation;\n" \
+" lsc += scale;\n" \
+" }\n" \
+"\n" \
+" col *= (1.0f/(iterations+1));\n" \
+"\n" \
+" write_imagef(output, coords, col);\n" \
+"}\n" \
"\0";
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index 087e7a15e39..83dae7475fb 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -59,7 +59,7 @@ static float *init_buffer(unsigned int width, unsigned int height, DataType data
return NULL;
}
-static void write_buffer_rect(rcti *rect, MemoryBuffer **memoryBuffers, const bNodeTree *tree,
+static void write_buffer_rect(rcti *rect, const bNodeTree *tree,
SocketReader *reader, float *buffer, unsigned int width, DataType datatype)
{
float color[4];
@@ -77,7 +77,7 @@ static void write_buffer_rect(rcti *rect, MemoryBuffer **memoryBuffers, const bN
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2 && (!breaked); x++) {
- reader->read(color, x, y, COM_PS_NEAREST, memoryBuffers);
+ reader->read(color, x, y, COM_PS_NEAREST);
for (i = 0; i < size; ++i)
buffer[offset + i] = color[i];
@@ -113,9 +113,9 @@ void OutputSingleLayerOperation::initExecution()
this->m_outputBuffer = init_buffer(this->getWidth(), this->getHeight(), this->m_datatype);
}
-void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
+void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
- write_buffer_rect(rect, memoryBuffers, this->m_tree, this->m_imageInput, this->m_outputBuffer, this->getWidth(), this->m_datatype);
+ write_buffer_rect(rect, this->m_tree, this->m_imageInput, this->m_outputBuffer, this->getWidth(), this->m_datatype);
}
void OutputSingleLayerOperation::deinitExecution()
@@ -183,10 +183,10 @@ void OutputOpenExrMultiLayerOperation::initExecution()
}
}
-void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
+void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
- write_buffer_rect(rect, memoryBuffers, this->m_tree, this->m_layers[i].imageInput, this->m_layers[i].outputBuffer, this->getWidth(), this->m_layers[i].datatype);
+ write_buffer_rect(rect, this->m_tree, this->m_layers[i].imageInput, this->m_layers[i].outputBuffer, this->getWidth(), this->m_layers[i].datatype);
}
}
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h
index 60244a8bf72..0d6e5bfa61a 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.h
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.h
@@ -45,7 +45,7 @@ private:
public:
OutputSingleLayerOperation(const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path);
- void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
+ void executeRegion(rcti *rect, unsigned int tileNumber);
bool isOutputOperation(bool rendering) const { return true; }
void initExecution();
void deinitExecution();
@@ -79,7 +79,7 @@ public:
void add_layer(const char *name, DataType datatype);
- void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
+ void executeRegion(rcti *rect, unsigned int tileNumber);
bool isOutputOperation(bool rendering) const { return true; }
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp
index 55e94568688..8008c95c734 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.cpp
+++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp
@@ -79,7 +79,7 @@ void PreviewOperation::deinitExecution()
this->m_input = NULL;
}
-void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
+void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
int offset;
float color[4];
@@ -93,7 +93,7 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, Memory
color[1] = 0.0f;
color[2] = 0.0f;
color[3] = 1.0f;
- this->m_input->read(color, rx, ry, COM_PS_NEAREST, memoryBuffers);
+ this->m_input->read(color, rx, ry, COM_PS_NEAREST);
linearrgb_to_srgb_v4(color, color);
F4TOCHAR4(color, this->m_outputBuffer + offset);
offset += 4;
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h
index e7b8ba55ae0..7183ea64fff 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.h
+++ b/source/blender/compositor/operations/COM_PreviewOperation.h
@@ -44,7 +44,7 @@ public:
void deinitExecution();
const CompositorPriority getRenderPriority() const;
- void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
+ void executeRegion(rcti *rect, unsigned int tileNumber);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void setbNode(bNode *node) { this->m_node = node; }
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
index 12674153bc8..daf517876e5 100644
--- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
@@ -40,14 +40,14 @@ void ProjectorLensDistortionOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
-void *ProjectorLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *ProjectorLensDistortionOperation::initializeTileData(rcti *rect)
{
- updateDispersion(memoryBuffers);
- void *buffer = this->m_inputProgram->initializeTileData(NULL, memoryBuffers);
+ updateDispersion();
+ void *buffer = this->m_inputProgram->initializeTileData(NULL);
return buffer;
}
-void ProjectorLensDistortionOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void ProjectorLensDistortionOperation::executePixel(float *color, int x, int y, void *data)
{
float inputValue[4];
const float height = this->getHeight();
@@ -87,13 +87,13 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *in
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
-void ProjectorLensDistortionOperation::updateDispersion(MemoryBuffer **inputBuffers)
+void ProjectorLensDistortionOperation::updateDispersion()
{
if (this->m_dispersionAvailable) return;
this->lockMutex();
if (!this->m_dispersionAvailable) {
float result[4];
- this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, inputBuffers);
+ this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST);
this->m_dispersion = result[0];
this->m_kr = 0.25f * MAX2(MIN2(this->m_dispersion, 1.f), 0.f);
this->m_kr2 = this->m_kr * 20;
diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h
index c658d66429a..ac64b35ed32 100644
--- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h
@@ -44,14 +44,14 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
/**
* Deinitialize the execution
*/
@@ -61,7 +61,7 @@ public:
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void updateDispersion(MemoryBuffer **inputBuffers);
+ void updateDispersion();
};
#endif
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
index 76e6921503e..2473ad8303e 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
@@ -28,11 +28,12 @@ ReadBufferOperation::ReadBufferOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_COLOR);
this->m_offset = 0;
+ this->m_buffer = NULL;
}
-void *ReadBufferOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *ReadBufferOperation::initializeTileData(rcti *rect)
{
- return getInputMemoryBuffer(memoryBuffers);
+ return m_buffer;
}
void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
@@ -48,38 +49,25 @@ void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigne
}
}
}
-void ReadBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ReadBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
- if (inputBuffers) {
- MemoryBuffer *inputBuffer = inputBuffers[this->m_offset];
- if (inputBuffer) {
- if (sampler == COM_PS_NEAREST) {
- inputBuffer->read(color, x, y);
- }
- else {
- inputBuffer->readCubic(color, x, y);
- }
- }
- } else {
- color[0] = 0.0f;
- color[1] = 0.0f;
- color[2] = 0.0f;
- color[3] = 0.0f;
+ if (sampler == COM_PS_NEAREST) {
+ m_buffer->read(color, x, y);
+ }
+ else {
+ m_buffer->readCubic(color, x, y);
}
}
-void ReadBufferOperation::executePixel(float *color, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[])
+void ReadBufferOperation::executePixel(float *color, float x, float y, float dx, float dy)
{
- MemoryBuffer *inputBuffer = inputBuffers[this->m_offset];
- if (inputBuffer) {
- inputBuffer->readEWA(color, x, y, dx, dy);
- }
+ m_buffer->readEWA(color, x, y, dx, dy);
}
bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
if (this == readOperation) {
- BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
+ BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
return true;
}
return false;
@@ -93,3 +81,9 @@ void ReadBufferOperation::readResolutionFromWriteBuffer()
this->setHeight(operation->getHeight());
}
}
+
+void ReadBufferOperation::updateMemoryBuffer()
+{
+ this->m_buffer = this->getMemoryProxy()->getBuffer();
+
+}
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h
index de0c69c0ecc..f52b732b076 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.h
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h
@@ -30,6 +30,7 @@ class ReadBufferOperation : public NodeOperation {
private:
MemoryProxy *m_memoryProxy;
unsigned int m_offset;
+ MemoryBuffer *m_buffer;
public:
ReadBufferOperation();
int isBufferOperation() { return true; }
@@ -37,15 +38,16 @@ public:
MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; }
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
- void executePixel(float *color, float x, float y, float dx, float dy, MemoryBuffer * inputBuffers[]);
+ void *initializeTileData(rcti *rect);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
+ void executePixel(float *color, float x, float y, float dx, float dy);
const bool isReadBufferOperation() const { return true; }
void setOffset(unsigned int offset) { this->m_offset = offset; }
unsigned int getOffset() { return this->m_offset; }
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
MemoryBuffer *getInputMemoryBuffer(MemoryBuffer **memoryBuffers) { return memoryBuffers[this->m_offset]; }
void readResolutionFromWriteBuffer();
+ void updateMemoryBuffer();
};
#endif
diff --git a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp
index 35f787cb59f..908c3d11b06 100644
--- a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp
@@ -27,7 +27,7 @@ RenderLayersAlphaProg::RenderLayersAlphaProg() : RenderLayersBaseProg(SCE_PASS_C
this->addOutputSocket(COM_DT_VALUE);
}
-void RenderLayersAlphaProg::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void RenderLayersAlphaProg::executePixel(float *output, float x, float y, PixelSampler sampler)
{
int ix = x;
int iy = y;
diff --git a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.h b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.h
index 846e337c572..1733f3bd3ba 100644
--- a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.h
+++ b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.h
@@ -28,7 +28,7 @@
class RenderLayersAlphaProg : public RenderLayersBaseProg {
public:
RenderLayersAlphaProg();
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
index e4543c06d9b..a036e8e7231 100644
--- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
@@ -69,7 +69,7 @@ void RenderLayersBaseProg::initExecution()
}
}
-void RenderLayersBaseProg::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void RenderLayersBaseProg::executePixel(float *output, float x, float y, PixelSampler sampler)
{
int ix = x;
int iy = y;
diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.h b/source/blender/compositor/operations/COM_RenderLayersBaseProg.h
index a18b515bd7b..ead1eb183b3 100644
--- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.h
+++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.h
@@ -92,7 +92,7 @@ public:
short getLayerId() { return this->m_layerId; }
void initExecution();
void deinitExecution();
- void executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
+ void executePixel(float *output, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp
index 086ce917e7e..a39828e4560 100644
--- a/source/blender/compositor/operations/COM_RotateOperation.cpp
+++ b/source/blender/compositor/operations/COM_RotateOperation.cpp
@@ -52,7 +52,7 @@ inline void RotateOperation::ensureDegree()
{
if (!this->m_isDegreeSet) {
float degree[4];
- this->m_degreeSocket->read(degree, 0, 0, COM_PS_NEAREST, NULL);
+ this->m_degreeSocket->read(degree, 0, 0, COM_PS_NEAREST);
double rad;
if (this->m_doDegree2RadConversion) {
rad = DEG2RAD((double)degree[0]);
@@ -68,14 +68,14 @@ inline void RotateOperation::ensureDegree()
}
-void RotateOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void RotateOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
ensureDegree();
const float dy = y - this->m_centerY;
const float dx = x - this->m_centerX;
const float nx = this->m_centerX + (this->m_cosine * dx + this->m_sine * dy);
const float ny = this->m_centerY + (-this->m_sine * dx + this->m_cosine * dy);
- this->m_imageSocket->read(color, nx, ny, sampler, inputBuffers);
+ this->m_imageSocket->read(color, nx, ny, sampler);
}
bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
diff --git a/source/blender/compositor/operations/COM_RotateOperation.h b/source/blender/compositor/operations/COM_RotateOperation.h
index 9e6dd3987d1..d011ac0ecc9 100644
--- a/source/blender/compositor/operations/COM_RotateOperation.h
+++ b/source/blender/compositor/operations/COM_RotateOperation.h
@@ -38,7 +38,7 @@ private:
public:
RotateOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
void setDoDegree2RadConversion(bool abool) { this->m_doDegree2RadConversion = abool; }
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cpp b/source/blender/compositor/operations/COM_ScaleOperation.cpp
index 6a1f7b62203..f4a3dc5fa25 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScaleOperation.cpp
@@ -54,7 +54,7 @@ void ScaleOperation::deinitExecution()
}
-void ScaleOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ScaleOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
#ifdef USE_FORCE_BICUBIC
sampler = COM_PS_BICUBIC;
@@ -63,15 +63,15 @@ void ScaleOperation::executePixel(float *color, float x, float y, PixelSampler s
float scaleX[4];
float scaleY[4];
- this->m_inputXOperation->read(scaleX, x, y, sampler, inputBuffers);
- this->m_inputYOperation->read(scaleY, x, y, sampler, inputBuffers);
+ this->m_inputXOperation->read(scaleX, x, y, sampler);
+ this->m_inputYOperation->read(scaleY, x, y, sampler);
const float scx = scaleX[0];
const float scy = scaleY[0];
float nx = this->m_centerX + (x - this->m_centerX) / scx;
float ny = this->m_centerY + (y - this->m_centerY) / scy;
- this->m_inputOperation->read(color, nx, ny, sampler, inputBuffers);
+ this->m_inputOperation->read(color, nx, ny, sampler);
}
bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -80,8 +80,8 @@ bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOpe
float scaleX[4];
float scaleY[4];
- this->m_inputXOperation->read(scaleX, 0, 0, COM_PS_NEAREST, NULL);
- this->m_inputYOperation->read(scaleY, 0, 0, COM_PS_NEAREST, NULL);
+ this->m_inputXOperation->read(scaleX, 0, 0, COM_PS_NEAREST);
+ this->m_inputYOperation->read(scaleY, 0, 0, COM_PS_NEAREST);
const float scx = scaleX[0];
const float scy = scaleY[0];
@@ -124,7 +124,7 @@ void ScaleAbsoluteOperation::deinitExecution()
}
-void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
#ifdef USE_FORCE_BICUBIC
sampler = COM_PS_BICUBIC;
@@ -133,8 +133,8 @@ void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelS
float scaleX[4];
float scaleY[4];
- this->m_inputXOperation->read(scaleX, x, y, sampler, inputBuffers);
- this->m_inputYOperation->read(scaleY, x, y, sampler, inputBuffers);
+ this->m_inputXOperation->read(scaleX, x, y, sampler);
+ this->m_inputYOperation->read(scaleY, x, y, sampler);
const float scx = scaleX[0]; // target absolute scale
const float scy = scaleY[0]; // target absolute scale
@@ -148,7 +148,7 @@ void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelS
float nx = this->m_centerX + (x - this->m_centerX) / relativeXScale;
float ny = this->m_centerY + (y - this->m_centerY) / relativeYScale;
- this->m_inputOperation->read(color, nx, ny, sampler, inputBuffers);
+ this->m_inputOperation->read(color, nx, ny, sampler);
}
bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -157,8 +157,8 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadB
float scaleX[4];
float scaleY[4];
- this->m_inputXOperation->read(scaleX, 0, 0, COM_PS_NEAREST, NULL);
- this->m_inputYOperation->read(scaleY, 0, 0, COM_PS_NEAREST, NULL);
+ this->m_inputXOperation->read(scaleX, 0, 0, COM_PS_NEAREST);
+ this->m_inputYOperation->read(scaleY, 0, 0, COM_PS_NEAREST);
const float scx = scaleX[0];
const float scy = scaleY[0];
@@ -244,7 +244,7 @@ void ScaleFixedSizeOperation::deinitExecution()
}
-void ScaleFixedSizeOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ScaleFixedSizeOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
#ifdef USE_FORCE_BICUBIC
sampler = COM_PS_BICUBIC;
@@ -253,10 +253,10 @@ void ScaleFixedSizeOperation::executePixel(float *color, float x, float y, Pixel
if (this->m_is_offset) {
float nx = ((x - this->m_offsetX) * this->m_relX);
float ny = ((y - this->m_offsetY) * this->m_relY);
- this->m_inputOperation->read(color, nx, ny, sampler, inputBuffers);
+ this->m_inputOperation->read(color, nx, ny, sampler);
}
else {
- this->m_inputOperation->read(color, x * this->m_relX, y * this->m_relY, sampler, inputBuffers);
+ this->m_inputOperation->read(color, x * this->m_relX, y * this->m_relY, sampler);
}
}
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h
index 8cd44810bbd..075fb6e7064 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.h
+++ b/source/blender/compositor/operations/COM_ScaleOperation.h
@@ -35,7 +35,7 @@ private:
public:
ScaleOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
@@ -51,7 +51,7 @@ class ScaleAbsoluteOperation : public NodeOperation {
public:
ScaleAbsoluteOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
@@ -76,7 +76,7 @@ public:
ScaleFixedSizeOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
index e70185f8fba..d431ce29554 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
@@ -48,14 +48,14 @@ void ScreenLensDistortionOperation::initExecution()
}
-void *ScreenLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *ScreenLensDistortionOperation::initializeTileData(rcti *rect)
{
- void *buffer = this->m_inputProgram->initializeTileData(NULL, memoryBuffers);
- updateDispersionAndDistortion(memoryBuffers);
+ void *buffer = this->m_inputProgram->initializeTileData(NULL);
+ updateDispersionAndDistortion();
return buffer;
}
-void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int y, void *data)
{
const float height = this->getHeight();
const float width = this->getWidth();
@@ -316,16 +316,16 @@ void ScreenLensDistortionOperation::updateVariables(float distortion, float disp
this->m_kb4 = this->m_kb * 4.0f;
}
-void ScreenLensDistortionOperation::updateDispersionAndDistortion(MemoryBuffer **inputBuffers)
+void ScreenLensDistortionOperation::updateDispersionAndDistortion()
{
if (this->m_valuesAvailable) return;
this->lockMutex();
if (!this->m_valuesAvailable) {
float result[4];
- this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, inputBuffers);
+ this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST);
this->m_distortion = result[0];
- this->getInputSocketReader(2)->read(result, 0, 0, COM_PS_NEAREST, inputBuffers);
+ this->getInputSocketReader(2)->read(result, 0, 0, COM_PS_NEAREST);
this->m_dispersion = result[0];
updateVariables(this->m_distortion, this->m_dispersion);
this->m_valuesAvailable = true;
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
index f80b938818c..a88717a116e 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
@@ -49,14 +49,14 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
/**
* Deinitialize the execution
*/
@@ -81,7 +81,7 @@ public:
private:
void determineUV(float result[4], float x, float y) const;
void determineUV(float result[4], float x, float y, float distortion, float dispersion);
- void updateDispersionAndDistortion(MemoryBuffer **inputBuffers);
+ void updateDispersionAndDistortion();
void updateVariables(float distortion, float dispersion);
};
diff --git a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp b/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp
index 6ae4fc4cfe5..0b080dcc426 100644
--- a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp
+++ b/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp
@@ -39,9 +39,9 @@ void SeparateChannelOperation::deinitExecution()
}
-void SeparateChannelOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void SeparateChannelOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float input[4];
- this->m_inputOperation->read(input, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(input, x, y, sampler);
color[0] = input[this->m_channel];
}
diff --git a/source/blender/compositor/operations/COM_SeparateChannelOperation.h b/source/blender/compositor/operations/COM_SeparateChannelOperation.h
index 65a54f91252..01fee3ca57d 100644
--- a/source/blender/compositor/operations/COM_SeparateChannelOperation.h
+++ b/source/blender/compositor/operations/COM_SeparateChannelOperation.h
@@ -31,7 +31,7 @@ private:
int m_channel;
public:
SeparateChannelOperation();
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
index d383fb638ae..0f707473f9d 100644
--- a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
@@ -38,12 +38,12 @@ void SetAlphaOperation::initExecution()
this->m_inputAlpha = getInputSocketReader(1);
}
-void SetAlphaOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void SetAlphaOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
float alphaInput[4];
- this->m_inputColor->read(outputValue, x, y, sampler, inputBuffers);
- this->m_inputAlpha->read(alphaInput, x, y, sampler, inputBuffers);
+ this->m_inputColor->read(outputValue, x, y, sampler);
+ this->m_inputAlpha->read(alphaInput, x, y, sampler);
outputValue[3] = alphaInput[0];
}
diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.h b/source/blender/compositor/operations/COM_SetAlphaOperation.h
index 21968c930e7..3d8eb5b9493 100644
--- a/source/blender/compositor/operations/COM_SetAlphaOperation.h
+++ b/source/blender/compositor/operations/COM_SetAlphaOperation.h
@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_SetColorOperation.cpp b/source/blender/compositor/operations/COM_SetColorOperation.cpp
index 55a6a3800ca..0665073840c 100644
--- a/source/blender/compositor/operations/COM_SetColorOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetColorOperation.cpp
@@ -27,7 +27,7 @@ SetColorOperation::SetColorOperation() : NodeOperation()
this->addOutputSocket(COM_DT_COLOR);
}
-void SetColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void SetColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
outputValue[0] = this->m_channel1;
outputValue[1] = this->m_channel2;
diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h
index a51311837ee..72708800f1e 100644
--- a/source/blender/compositor/operations/COM_SetColorOperation.h
+++ b/source/blender/compositor/operations/COM_SetColorOperation.h
@@ -61,7 +61,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
const bool isSetOperation() const { return true; }
diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp
index c235bd81e58..f7c1ef8f6f5 100644
--- a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp
@@ -37,7 +37,7 @@ void SetSamplerOperation::deinitExecution()
this->m_reader = NULL;
}
-void SetSamplerOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void SetSamplerOperation::executePixel(float *output, float x, float y, PixelSampler sampler)
{
- this->m_reader->read(output, x, y, this->m_sampler, inputBuffers);
+ this->m_reader->read(output, x, y, this->m_sampler);
}
diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.h b/source/blender/compositor/operations/COM_SetSamplerOperation.h
index 273eac159bc..7b53cd8d38e 100644
--- a/source/blender/compositor/operations/COM_SetSamplerOperation.h
+++ b/source/blender/compositor/operations/COM_SetSamplerOperation.h
@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
};
diff --git a/source/blender/compositor/operations/COM_SetValueOperation.cpp b/source/blender/compositor/operations/COM_SetValueOperation.cpp
index 98a21112c5b..d88257226f5 100644
--- a/source/blender/compositor/operations/COM_SetValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetValueOperation.cpp
@@ -27,7 +27,7 @@ SetValueOperation::SetValueOperation() : NodeOperation()
this->addOutputSocket(COM_DT_VALUE);
}
-void SetValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void SetValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
outputValue[0] = this->m_value;
}
diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h
index 642940e03cd..a2c3e8eaa0b 100644
--- a/source/blender/compositor/operations/COM_SetValueOperation.h
+++ b/source/blender/compositor/operations/COM_SetValueOperation.h
@@ -46,7 +46,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
const bool isSetOperation() const { return true; }
diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cpp b/source/blender/compositor/operations/COM_SetVectorOperation.cpp
index f37bc489e75..651add0453f 100644
--- a/source/blender/compositor/operations/COM_SetVectorOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetVectorOperation.cpp
@@ -28,7 +28,7 @@ SetVectorOperation::SetVectorOperation() : NodeOperation()
this->addOutputSocket(COM_DT_VECTOR);
}
-void SetVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void SetVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
{
outputValue[0] = this->m_x;
outputValue[1] = this->m_y;
diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h
index d1b9fe25085..0868213a109 100644
--- a/source/blender/compositor/operations/COM_SetVectorOperation.h
+++ b/source/blender/compositor/operations/COM_SetVectorOperation.h
@@ -54,7 +54,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
const bool isSetOperation() const { return true; }
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
index 8b39406fd83..0e670d9268e 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
@@ -39,9 +39,9 @@ void SocketProxyOperation::deinitExecution()
this->m_inputOperation = NULL;
}
-void SocketProxyOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void SocketProxyOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
if (this->m_inputOperation) {
- this->m_inputOperation->read(color, x, y, sampler, inputBuffers);
+ this->m_inputOperation->read(color, x, y, sampler);
}
}
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h
index a4177efbd8e..219483aa92d 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.h
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h
@@ -30,7 +30,7 @@ private:
SocketReader *m_inputOperation;
public:
SocketProxyOperation(DataType type);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp
index 00f854b2ba9..80de4e71fce 100644
--- a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp
@@ -60,7 +60,7 @@ void SplitViewerOperation::deinitExecution()
}
-void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
+void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
float *buffer = this->m_outputBuffer;
unsigned char *bufferDisplay = this->m_outputBufferDisplay;
@@ -80,10 +80,10 @@ void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
float srgb[4];
image1 = this->m_xSplit ? x > perc : y > perc;
if (image1) {
- this->m_image1Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
+ this->m_image1Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST);
}
else {
- this->m_image2Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
+ this->m_image2Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST);
}
/// @todo: linear conversion only when scene color management is selected, also check predivide.
if (this->m_doColorManagement) {
diff --git a/source/blender/compositor/operations/COM_SplitViewerOperation.h b/source/blender/compositor/operations/COM_SplitViewerOperation.h
index 92275606105..c759e14e1dd 100644
--- a/source/blender/compositor/operations/COM_SplitViewerOperation.h
+++ b/source/blender/compositor/operations/COM_SplitViewerOperation.h
@@ -35,7 +35,7 @@ private:
bool m_xSplit;
public:
SplitViewerOperation();
- void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
+ void executeRegion(rcti *rect, unsigned int tileNumber);
void initExecution();
void deinitExecution();
void setSplitPercentage(float splitPercentage) { this->m_splitPercentage = splitPercentage; }
diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp
index 6098cfc3e5c..4cf935799cb 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.cpp
+++ b/source/blender/compositor/operations/COM_TextureOperation.cpp
@@ -68,16 +68,16 @@ void TextureBaseOperation::determineResolution(unsigned int resolution[], unsign
}
}
-void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
- TextureBaseOperation::executePixel(color, x, y, sampler, inputBuffers);
+ TextureBaseOperation::executePixel(color, x, y, sampler);
color[0] = color[3];
color[1] = 0.0f;
color[2] = 0.0f;
color[3] = 0.0f;
}
-void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
float textureSize[4];
@@ -89,8 +89,8 @@ void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSam
const float u = (cx - x) / this->getWidth() * 2;
const float v = (cy - y) / this->getHeight() * 2;
- this->m_inputSize->read(textureSize, x, y, sampler, inputBuffers);
- this->m_inputOffset->read(textureOffset, x, y, sampler, inputBuffers);
+ this->m_inputSize->read(textureSize, x, y, sampler);
+ this->m_inputOffset->read(textureOffset, x, y, sampler);
vec[0] = textureSize[0] * (u + textureOffset[0]);
vec[1] = textureSize[1] * (v + textureOffset[1]);
diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h
index d42da697b08..8735aff19dc 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.h
+++ b/source/blender/compositor/operations/COM_TextureOperation.h
@@ -60,7 +60,7 @@ protected:
TextureBaseOperation();
public:
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void setTexture(Tex *texture) { this->m_texture = texture; }
void initExecution();
@@ -76,7 +76,7 @@ public:
class TextureAlphaOperation : public TextureBaseOperation {
public:
TextureAlphaOperation();
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp
index b5daf85b390..0dc30ebfcb9 100644
--- a/source/blender/compositor/operations/COM_TonemapOperation.cpp
+++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp
@@ -41,12 +41,12 @@ void TonemapOperation::initExecution()
NodeOperation::initMutex();
}
-void TonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void TonemapOperation::executePixel(float *color, int x, int y, void *data)
{
AvgLogLum *avg = (AvgLogLum *)data;
float output[4];
- this->m_imageReader->read(output, x, y, inputBuffers, NULL);
+ this->m_imageReader->read(output, x, y, NULL);
mul_v3_fl(output, avg->al);
float dr = output[0] + this->m_data->offset;
float dg = output[1] + this->m_data->offset;
@@ -63,7 +63,7 @@ void TonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *in
copy_v4_v4(color, output);
}
-void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, void *data)
{
AvgLogLum *avg = (AvgLogLum *)data;
NodeTonemap *ntm = this->m_data;
@@ -73,7 +73,7 @@ void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, Mem
const float ic = 1.0f - ntm->c, ia = 1.0f - ntm->a;
float output[4];
- this->m_imageReader->read(output, x, y, inputBuffers, NULL);
+ this->m_imageReader->read(output, x, y, NULL);
const float L = rgb_to_luma_y(output);
float I_l = output[0] + ic * (L - output[0]);
@@ -116,11 +116,11 @@ bool TonemapOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferO
return false;
}
-void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *TonemapOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (this->m_cachedInstance == NULL) {
- MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect);
AvgLogLum *data = new AvgLogLum();
float *buffer = tile->getBuffer();
@@ -154,7 +154,7 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff
return this->m_cachedInstance;
}
-void TonemapOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
+void TonemapOperation::deinitializeTileData(rcti *rect, void *data)
{
/* pass */
}
diff --git a/source/blender/compositor/operations/COM_TonemapOperation.h b/source/blender/compositor/operations/COM_TonemapOperation.h
index ed9018d0a09..4e591276c76 100644
--- a/source/blender/compositor/operations/COM_TonemapOperation.h
+++ b/source/blender/compositor/operations/COM_TonemapOperation.h
@@ -64,15 +64,15 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
- void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
+ void *initializeTileData(rcti *rect);
+ void deinitializeTileData(rcti *rect, void *data);
/**
* Deinitialize the execution
@@ -97,7 +97,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
};
#endif
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
new file mode 100644
index 00000000000..cf516401a3c
--- /dev/null
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Sergey Sharybin
+ */
+
+#include "COM_TrackPositionOperation.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_math_color.h"
+
+#include "DNA_scene_types.h"
+
+extern "C" {
+ #include "BKE_movieclip.h"
+ #include "BKE_tracking.h"
+}
+
+TrackPositionOperation::TrackPositionOperation() : NodeOperation()
+{
+ this->addOutputSocket(COM_DT_VALUE);
+ this->movieClip = NULL;
+ this->framenumber = 0;
+ this->trackingObject[0] = 0;
+ this->trackName[0] = 0;
+ this->axis = 0;
+ this->relative = false;
+}
+
+void TrackPositionOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
+ MovieClipUser user = {0};
+ MovieTracking *tracking = &movieClip->tracking;
+ MovieTrackingObject *object = BKE_tracking_object_get_named(tracking, this->trackingObject);
+ MovieTrackingTrack *track;
+ MovieTrackingMarker *marker;
+ int width, height;
+
+ outputValue[0] = 0.0f;
+
+ if (!object)
+ return;
+
+ track = BKE_tracking_track_get_named(tracking, object, this->trackName);
+
+ if (!track)
+ return;
+
+ BKE_movieclip_user_set_frame(&user, this->framenumber);
+ BKE_movieclip_get_size(this->movieClip, &user, &width, &height);
+
+ marker = BKE_tracking_marker_get(track, this->framenumber);
+
+ outputValue[0] = marker->pos[this->axis];
+
+ if (this->relative) {
+ int i;
+
+ for (i = 0; i < track->markersnr; i++) {
+ marker = &track->markers[i];
+
+ if ((marker->flag & MARKER_DISABLED) == 0) {
+ outputValue[0] -= marker->pos[this->axis];
+
+ break;
+ }
+ }
+ }
+
+ if (this->axis == 0)
+ outputValue[0] *= width;
+ else
+ outputValue[0] *= height;
+}
+
+void TrackPositionOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
+{
+ resolution[0] = preferredResolution[0];
+ resolution[1] = preferredResolution[1];
+}
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.h b/source/blender/compositor/operations/COM_TrackPositionOperation.h
new file mode 100644
index 00000000000..caf444db0d5
--- /dev/null
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Sergey Sharybin
+ */
+
+
+#ifndef _COM_TrackPositionOperation_h
+#define _COM_TrackPositionOperation_h
+
+#include <string.h>
+
+#include "COM_NodeOperation.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_movieclip_types.h"
+
+#include "BLI_listbase.h"
+
+/**
+ * Class with implementation of green screen gradient rasterization
+ */
+class TrackPositionOperation : public NodeOperation {
+protected:
+ MovieClip *movieClip;
+ int framenumber;
+ char trackingObject[64];
+ char trackName[64];
+ int axis;
+ bool relative;
+
+ /**
+ * Determine the output resolution. The resolution is retrieved from the Renderer
+ */
+ void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
+
+public:
+ TrackPositionOperation();
+
+ void setMovieClip(MovieClip *clip) {this->movieClip = clip;}
+ void setTrackingObject(char *object) {strncpy(this->trackingObject, object, sizeof(this->trackingObject));}
+ void setTrackName(char *track) {strncpy(this->trackName, track, sizeof(this->trackName));}
+ void setFramenumber(int framenumber) {this->framenumber = framenumber;}
+ void setAxis(int value) {this->axis = value;}
+ void setRelative(bool value) {this->relative = value;}
+
+ void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+
+ const bool isSetOperation() const { return true; }
+};
+
+#endif
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp
index e43a8e55130..fda50ac24d1 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.cpp
+++ b/source/blender/compositor/operations/COM_TranslateOperation.cpp
@@ -50,10 +50,10 @@ void TranslateOperation::deinitExecution()
}
-void TranslateOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void TranslateOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
ensureDelta();
- this->m_inputOperation->read(color, x - this->getDeltaX(), y - this->getDeltaY(), sampler, inputBuffers);
+ this->m_inputOperation->read(color, x - this->getDeltaX(), y - this->getDeltaY(), sampler);
}
bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h
index 8af4ffe8967..83e3befdfeb 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.h
+++ b/source/blender/compositor/operations/COM_TranslateOperation.h
@@ -36,7 +36,7 @@ private:
public:
TranslateOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
@@ -47,9 +47,9 @@ public:
inline void ensureDelta() {
if (!this->m_isDeltaSet) {
float tempDelta[4];
- this->m_inputXOperation->read(tempDelta, 0, 0, COM_PS_NEAREST, NULL);
+ this->m_inputXOperation->read(tempDelta, 0, 0, COM_PS_NEAREST);
this->m_deltaX = tempDelta[0];
- this->m_inputYOperation->read(tempDelta, 0, 0, COM_PS_NEAREST, NULL);
+ this->m_inputYOperation->read(tempDelta, 0, 0, COM_PS_NEAREST);
this->m_deltaY = tempDelta[0];
this->m_isDeltaSet = true;
}
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
index 61538fde258..8faa571dc38 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
@@ -57,13 +57,34 @@ void VariableSizeBokehBlurOperation::initExecution()
this->m_inputBokehProgram = getInputSocketReader(1);
this->m_inputSizeProgram = getInputSocketReader(2);
#ifdef COM_DEFOCUS_SEARCH
- this->m_inputSearchProgram = getInputSocketReader(4);
+ this->m_inputSearchProgram = getInputSocketReader(3);
#endif
QualityStepHelper::initExecution(COM_QH_INCREASE);
}
-void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void *VariableSizeBokehBlurOperation::initializeTileData(rcti *rect)
{
+ MemoryBuffer** result = new MemoryBuffer*[3];
+ result[0] = (MemoryBuffer*)this->m_inputProgram->initializeTileData(rect);
+ result[1] = (MemoryBuffer*)this->m_inputBokehProgram->initializeTileData(rect);
+ result[2] = (MemoryBuffer*)this->m_inputSizeProgram->initializeTileData(rect);
+ return result;
+}
+
+void VariableSizeBokehBlurOperation::deinitializeTileData(rcti *rect, void *data)
+{
+ MemoryBuffer** result = (MemoryBuffer**)data;
+ delete[] result;
+}
+
+void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, void *data)
+{
+ MemoryBuffer** buffers = (MemoryBuffer**)data;
+ MemoryBuffer* inputProgramBuffer = buffers[0];
+ MemoryBuffer* inputBokehBuffer = buffers[1];
+ MemoryBuffer* inputSizeBuffer = buffers[2];
+ float* inputSizeFloatBuffer = inputSizeBuffer->getBuffer();
+ float* inputProgramFloatBuffer = inputProgramBuffer->getBuffer();
float readColor[4];
float bokeh[4];
float tempSize[4];
@@ -72,7 +93,7 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
#ifdef COM_DEFOCUS_SEARCH
float search[4];
- this->inputSearchProgram->read(search, x/InverseSearchRadiusOperation::DIVIDER, y / InverseSearchRadiusOperation::DIVIDER, inputBuffers, NULL);
+ this->m_inputSearchProgram->read(search, x/InverseSearchRadiusOperation::DIVIDER, y / InverseSearchRadiusOperation::DIVIDER, NULL);
int minx = search[0];
int miny = search[1];
int maxx = search[2];
@@ -84,32 +105,37 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
int maxy = MIN2(y + this->m_maxBlur, m_height);
#endif
{
- this->m_inputSizeProgram->read(tempSize, x, y, COM_PS_NEAREST, inputBuffers);
- this->m_inputProgram->read(readColor, x, y, COM_PS_NEAREST, inputBuffers);
+ inputSizeBuffer->readNoCheck(tempSize, x, y);
+ inputProgramBuffer->readNoCheck(readColor, x, y);
+
add_v4_v4(color_accum, readColor);
add_v4_fl(multiplier_accum, 1.0f);
float sizeCenter = tempSize[0];
- for (int ny = miny; ny < maxy; ny += QualityStepHelper::getStep()) {
- for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
- if (nx >= 0 && nx < this->getWidth() && ny >= 0 && ny < getHeight()) {
- this->m_inputSizeProgram->read(tempSize, nx, ny, COM_PS_NEAREST, inputBuffers);
- float size = tempSize[0];
- float fsize = fabsf(size);
- if (sizeCenter > this->m_threshold && size > this->m_threshold) {
- float dx = nx - x;
- float dy = ny - y;
- if (nx == x && ny == y) {
- }
- else if (fsize > fabsf(dx) && fsize > fabsf(dy)) {
- float u = (256 + (dx/size) * 256);
- float v = (256 + (dy/size) * 256);
- this->m_inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers);
- this->m_inputProgram->read(readColor, nx, ny, COM_PS_NEAREST, inputBuffers);
- madd_v4_v4v4(color_accum, bokeh, readColor);
- add_v4_v4(multiplier_accum, bokeh);
+ const int addXStep = QualityStepHelper::getStep()*COM_NUMBER_OF_CHANNELS;
+
+ if (sizeCenter > this->m_threshold) {
+ for (int ny = miny; ny < maxy; ny += QualityStepHelper::getStep()) {
+ float dy = ny - y;
+ int offsetNy = ny * inputSizeBuffer->getWidth() * COM_NUMBER_OF_CHANNELS;
+ int offsetNxNy = offsetNy + (minx*COM_NUMBER_OF_CHANNELS);
+ for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
+ if (nx != x || ny != y)
+ {
+ float size = inputSizeFloatBuffer[offsetNxNy];
+ if (size > this->m_threshold) {
+ float fsize = fabsf(size);
+ float dx = nx - x;
+ if (fsize > fabsf(dx) && fsize > fabsf(dy)) {
+ float u = (256.0f + (dx/size) * 255.0f);
+ float v = (256.0f + (dy/size) * 255.0f);
+ inputBokehBuffer->readNoCheck(bokeh, u, v);
+ madd_v4_v4v4(color_accum, bokeh, &inputProgramFloatBuffer[offsetNxNy]);
+ add_v4_v4(multiplier_accum, bokeh);
+ }
}
}
+ offsetNxNy += addXStep;
}
}
}
@@ -185,7 +211,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu
searchInput.xmin = (input->xmin / InverseSearchRadiusOperation::DIVIDER) - 1;
searchInput.ymax = (input->ymax / InverseSearchRadiusOperation::DIVIDER) + 1;
searchInput.ymin = (input->ymin / InverseSearchRadiusOperation::DIVIDER) - 1;
- operation = getInputOperation(4);
+ operation = getInputOperation(3);
if (operation->determineDependingAreaOfInterest(&searchInput, readOperation, output) ) {
return true;
}
@@ -202,68 +228,77 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu
InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // radius
- this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // depth
this->addOutputSocket(COM_DT_COLOR);
this->setComplex(true);
- this->inputRadius = NULL;
- this->inputDepth = NULL;
+ this->m_inputRadius = NULL;
}
void InverseSearchRadiusOperation::initExecution()
{
- this->inputRadius = this->getInputSocketReader(0);
- this->inputDepth = this->getInputSocketReader(1);
+ this->m_inputRadius = this->getInputSocketReader(0);
}
-void* InverseSearchRadiusOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void* InverseSearchRadiusOperation::initializeTileData(rcti *rect)
{
MemoryBuffer * data = new MemoryBuffer(NULL, rect);
+ float* buffer = data->getBuffer();
int x, y;
- float width = this->inputRadius->getWidth();
- float height = this->inputRadius->getHeight();
-
- for (x = rect->xmin; x < rect->xmax ; x++) {
- for (y = rect->ymin; y < rect->ymax ; y++) {
- float[4] temp;
+ int width = this->m_inputRadius->getWidth();
+ int height = this->m_inputRadius->getHeight();
+ float temp[4];
+ int offset = 0;
+ for (y = rect->ymin; y < rect->ymax ; y++) {
+ for (x = rect->xmin; x < rect->xmax ; x++) {
int rx = x * DIVIDER;
int ry = y * DIVIDER;
- this->inputRadius->read(temp, rx, ry, memoryBuffers, NULL);
- float centerRadius = temp[0];
- this->inputDepth->read(temp, rx, ry, memoryBuffers, NULL);
- float centerDepth = temp[0];
- t[0] = MAX2(rx - this->maxBlur, 0.0f);
- t[1] = MAX2(ry - this->maxBlur, 0.0f);
- t[2] = MIN2(rx + this->maxBlur, width);
- t[3] = MIN2(ry + this->maxBlur, height);
- int minx = t[0];
- int miny = t[1];
- int maxx = t[2];
- int maxy = t[3];
- int sminx = rx;
- int smaxx = rx;
- int sminy = ry;
- int smaxy = ry;
- for (int nx = minx ; nx < maxx ; nx ++) {
- for (int ny = miny ; ny < maxy ; ny ++) {
- this->inputRadius->read(temp, nx, ny, memoryBuffers, NULL);
- if (nx < rx && temp[0])
-
- }
- }
- float t[4];
- data->writePixel(x, y, t);
+ buffer[offset] = MAX2(rx - m_maxBlur, 0);
+ buffer[offset+1] = MAX2(ry- m_maxBlur, 0);
+ buffer[offset+2] = MIN2(rx+DIVIDER + m_maxBlur, width);
+ buffer[offset+3] = MIN2(ry+DIVIDER + m_maxBlur, height);
+ offset += 4;
}
}
+// for (x = rect->xmin; x < rect->xmax ; x++) {
+// for (y = rect->ymin; y < rect->ymax ; y++) {
+// int rx = x * DIVIDER;
+// int ry = y * DIVIDER;
+// float radius = 0.0f;
+// float maxx = x;
+// float maxy = y;
+
+// for (int x2 = 0 ; x2 < DIVIDER ; x2 ++) {
+// for (int y2 = 0 ; y2 < DIVIDER ; y2 ++) {
+// this->m_inputRadius->read(temp, rx+x2, ry+y2, COM_PS_NEAREST);
+// if (radius < temp[0]) {
+// radius = temp[0];
+// maxx = x2;
+// maxy = y2;
+// }
+// }
+// }
+// int impactRadius = ceil(radius / DIVIDER);
+// for (int x2 = x - impactRadius ; x2 < x + impactRadius ; x2 ++) {
+// for (int y2 = y - impactRadius ; y2 < y + impactRadius ; y2 ++) {
+// data->read(temp, x2, y2);
+// temp[0] = MIN2(temp[0], maxx);
+// temp[1] = MIN2(temp[1], maxy);
+// temp[2] = MAX2(temp[2], maxx);
+// temp[3] = MAX2(temp[3], maxy);
+// data->writePixel(x2, y2, temp);
+// }
+// }
+// }
+// }
return data;
}
-void InverseSearchRadiusOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void InverseSearchRadiusOperation::executePixel(float *color, int x, int y, void *data)
{
MemoryBuffer *buffer = (MemoryBuffer*)data;
- buffer->read(color, x, y);
+ buffer->readNoCheck(color, x, y);
}
-void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
+void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data)
{
if (data) {
MemoryBuffer* mb = (MemoryBuffer*)data;
@@ -273,8 +308,7 @@ void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, MemoryBuffer
void InverseSearchRadiusOperation::deinitExecution()
{
- this->inputRadius = NULL;
- this->inputDepth = NULL;
+ this->m_inputRadius = NULL;
}
void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
@@ -287,10 +321,10 @@ void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[]
bool InverseSearchRadiusOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newRect;
- newRect.ymin = input->ymin*DIVIDER;
- newRect.ymax = input->ymax*DIVIDER;
- newRect.xmin = input->xmin*DIVIDER;
- newRect.xmax = input->xmax*DIVIDER;
+ newRect.ymin = input->ymin*DIVIDER - m_maxBlur;
+ newRect.ymax = input->ymax*DIVIDER + m_maxBlur;
+ newRect.xmin = input->xmin*DIVIDER - m_maxBlur;
+ newRect.xmax = input->xmax*DIVIDER + m_maxBlur;
return NodeOperation::determineDependingAreaOfInterest(&newRect, readOperation, output);
}
#endif
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h
index 6c9196c3eab..e5430545323 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h
@@ -25,6 +25,7 @@
#include "COM_NodeOperation.h"
#include "COM_QualityStepHelper.h"
+//#define COM_DEFOCUS_SEARCH
class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepHelper {
private:
@@ -34,7 +35,7 @@ private:
SocketReader *m_inputBokehProgram;
SocketReader *m_inputSizeProgram;
#ifdef COM_DEFOCUS_SEARCH
- SocketReader *inputSearchProgram;
+ SocketReader *m_inputSearchProgram;
#endif
public:
@@ -43,13 +44,17 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
*/
void initExecution();
+ void *initializeTileData(rcti *rect);
+
+ void deinitializeTileData(rcti *rect, void *data);
+
/**
* Deinitialize the execution
*/
@@ -67,10 +72,8 @@ public:
#ifdef COM_DEFOCUS_SEARCH
class InverseSearchRadiusOperation : public NodeOperation {
private:
- int maxBlur;
- float threshold;
- SocketReader *inputDepth;
- SocketReader *inputRadius;
+ int m_maxBlur;
+ SocketReader *m_inputRadius;
public:
static const int DIVIDER = 4;
@@ -85,8 +88,8 @@ public:
* Initialize the execution
*/
void initExecution();
- void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
- void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
+ void* initializeTileData(rcti *rect);
+ void deinitializeTileData(rcti *rect, void *data);
/**
* Deinitialize the execution
@@ -96,9 +99,7 @@ public:
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
- void setMaxBlur(int maxRadius) { this->maxBlur = maxRadius; }
-
- void setThreshold(float threshold) { this->threshold = threshold; }
+ void setMaxBlur(int maxRadius) { this->m_maxBlur = maxRadius; }
};
#endif
#endif
diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
index 48be72561ba..8934dd80ad8 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
@@ -52,7 +52,7 @@ void VectorBlurOperation::initExecution()
}
-void VectorBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void VectorBlurOperation::executePixel(float *color, int x, int y, void *data)
{
float *buffer = (float *) data;
int index = (y * this->getWidth() + x) * COM_NUMBER_OF_CHANNELS;
@@ -70,7 +70,7 @@ void VectorBlurOperation::deinitExecution()
this->m_cachedInstance = NULL;
}
}
-void *VectorBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+void *VectorBlurOperation::initializeTileData(rcti *rect)
{
if (this->m_cachedInstance) {
return this->m_cachedInstance;
@@ -78,9 +78,9 @@ void *VectorBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB
lockMutex();
if (this->m_cachedInstance == NULL) {
- MemoryBuffer *tile = (MemoryBuffer *)this->m_inputImageProgram->initializeTileData(rect, memoryBuffers);
- MemoryBuffer *speed = (MemoryBuffer *)this->m_inputSpeedProgram->initializeTileData(rect, memoryBuffers);
- MemoryBuffer *z = (MemoryBuffer *)this->m_inputZProgram->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_inputImageProgram->initializeTileData(rect);
+ MemoryBuffer *speed = (MemoryBuffer *)this->m_inputSpeedProgram->initializeTileData(rect);
+ MemoryBuffer *z = (MemoryBuffer *)this->m_inputZProgram->initializeTileData(rect);
float *data = new float[this->getWidth() * this->getHeight() * COM_NUMBER_OF_CHANNELS];
memcpy(data, tile->getBuffer(), this->getWidth() * this->getHeight() * COM_NUMBER_OF_CHANNELS * sizeof(float));
this->generateVectorBlur(data, tile, speed, z);
diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h
index a2e72fa3232..2743baf8500 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.h
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h
@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+ void executePixel(float *color, int x, int y, void *data);
/**
* Initialize the execution
@@ -60,7 +60,7 @@ public:
*/
void deinitExecution();
- void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ void *initializeTileData(rcti *rect);
void setVectorBlurSettings(NodeBlurData *settings) { this->m_settings = settings; }
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
index ee3f44d8979..ed86c842fc9 100644
--- a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
@@ -43,12 +43,12 @@ void VectorCurveOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
-void VectorCurveOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void VectorCurveOperation::executePixel(float *output, float x, float y, PixelSampler sampler)
{
float input[4];
- this->m_inputProgram->read(input, x, y, sampler, inputBuffers);
+ this->m_inputProgram->read(input, x, y, sampler);
curvemapping_evaluate_premulRGBF(this->m_curveMapping, output, input);
output[3] = input[3];
diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.h b/source/blender/compositor/operations/COM_VectorCurveOperation.h
index 2fbaf170986..b76f8880fc6 100644
--- a/source/blender/compositor/operations/COM_VectorCurveOperation.h
+++ b/source/blender/compositor/operations/COM_VectorCurveOperation.h
@@ -37,7 +37,7 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *Vector, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *Vector, float x, float y, PixelSampler sampler);
/**
* Initialize the execution
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
index 446b169763c..2470b239987 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
@@ -62,6 +62,8 @@ void ViewerBaseOperation::initImage()
if (!ibuf) return;
if (ibuf->x != (int)getWidth() || ibuf->y != (int)getHeight()) {
+ BLI_lock_thread(LOCK_DRAW_IMAGE);
+
imb_freerectImBuf(ibuf);
imb_freerectfloatImBuf(ibuf);
IMB_freezbuffloatImBuf(ibuf);
@@ -70,6 +72,8 @@ void ViewerBaseOperation::initImage()
imb_addrectImBuf(ibuf);
imb_addrectfloatImBuf(ibuf);
anImage->ok = IMA_OK_LOADED;
+
+ BLI_unlock_thread(LOCK_DRAW_IMAGE);
}
/* now we combine the input with ibuf */
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index 9278ddd6ead..f7c2ff93b3e 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -64,7 +64,7 @@ void ViewerOperation::deinitExecution()
}
-void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
+void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
float *buffer = this->m_outputBuffer;
unsigned char *bufferDisplay = this->m_outputBufferDisplay;
@@ -82,12 +82,11 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryB
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2; x++) {
- this->m_imageInput->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
+ this->m_imageInput->read(&(buffer[offset]), x, y, COM_PS_NEAREST);
if (this->m_alphaInput != NULL) {
- this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST, memoryBuffers);
+ this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST);
buffer[offset + 3] = alpha[0];
}
- /// @todo: linear conversion only when scene color management is selected, also check predivide.
if (this->m_doColorManagement) {
if (this->m_doColorPredivide) {
linearrgb_to_srgb_predivide_v4(srgb, buffer + offset);
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h
index fd83c3957f1..d900d8db408 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerOperation.h
@@ -34,7 +34,7 @@ private:
public:
ViewerOperation();
- void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
+ void executeRegion(rcti *rect, unsigned int tileNumber);
void initExecution();
void deinitExecution();
};
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
index 8decb73615b..0a31a6e170b 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
@@ -40,9 +40,9 @@ WriteBufferOperation::~WriteBufferOperation()
}
}
-void WriteBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void WriteBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
- this->m_input->read(color, x, y, sampler, inputBuffers);
+ this->m_input->read(color, x, y, sampler);
}
void WriteBufferOperation::initExecution()
@@ -57,13 +57,12 @@ void WriteBufferOperation::deinitExecution()
this->m_memoryProxy->free();
}
-void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
+void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
- //MemoryBuffer *memoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), tileNumber);
MemoryBuffer *memoryBuffer = this->m_memoryProxy->getBuffer();
float *buffer = memoryBuffer->getBuffer();
if (this->m_input->isComplex()) {
- void *data = this->m_input->initializeTileData(rect, memoryBuffers);
+ void *data = this->m_input->initializeTileData(rect);
int x1 = rect->xmin;
int y1 = rect->ymin;
int x2 = rect->xmax;
@@ -74,7 +73,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
for (y = y1; y < y2 && (!breaked); y++) {
int offset4 = (y * memoryBuffer->getWidth() + x1) * COM_NUMBER_OF_CHANNELS;
for (x = x1; x < x2; x++) {
- this->m_input->read(&(buffer[offset4]), x, y, memoryBuffers, data);
+ this->m_input->read(&(buffer[offset4]), x, y, data);
offset4 += COM_NUMBER_OF_CHANNELS;
}
@@ -84,7 +83,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
}
if (data) {
- this->m_input->deinitializeTileData(rect, memoryBuffers, data);
+ this->m_input->deinitializeTileData(rect, data);
data = NULL;
}
}
@@ -100,7 +99,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
for (y = y1; y < y2 && (!breaked); y++) {
int offset4 = (y * memoryBuffer->getWidth() + x1) * COM_NUMBER_OF_CHANNELS;
for (x = x1; x < x2; x++) {
- this->m_input->read(&(buffer[offset4]), x, y, COM_PS_NEAREST, memoryBuffers);
+ this->m_input->read(&(buffer[offset4]), x, y, COM_PS_NEAREST);
offset4 += COM_NUMBER_OF_CHANNELS;
}
if (isBreaked()) {
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h
index d77814a9dc4..1aa93c658cb 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.h
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h
@@ -38,10 +38,10 @@ public:
~WriteBufferOperation();
int isBufferOperation() { return true; }
MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; }
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
const bool isWriteBufferOperation() const { return true; }
- void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
+ void executeRegion(rcti *rect, unsigned int tileNumber);
void initExecution();
void deinitExecution();
void executeOpenCLRegion(OpenCLDevice* device, rcti *rect, unsigned int chunkNumber, MemoryBuffer **memoryBuffers, MemoryBuffer *outputBuffer);
diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp
index c1ea63432b9..28dbcd9f017 100644
--- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp
+++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp
@@ -46,36 +46,36 @@ void ZCombineOperation::initExecution()
this->m_depth2Reader = this->getInputSocketReader(3);
}
-void ZCombineOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ZCombineOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float depth1[4];
float depth2[4];
- this->m_depth1Reader->read(depth1, x, y, sampler, inputBuffers);
- this->m_depth2Reader->read(depth2, x, y, sampler, inputBuffers);
+ this->m_depth1Reader->read(depth1, x, y, sampler);
+ this->m_depth2Reader->read(depth2, x, y, sampler);
if (depth1[0] < depth2[0]) {
- this->m_image1Reader->read(color, x, y, sampler, inputBuffers);
+ this->m_image1Reader->read(color, x, y, sampler);
}
else {
- this->m_image2Reader->read(color, x, y, sampler, inputBuffers);
+ this->m_image2Reader->read(color, x, y, sampler);
}
}
-void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
{
float depth1[4];
float depth2[4];
float color1[4];
float color2[4];
- this->m_depth1Reader->read(depth1, x, y, sampler, inputBuffers);
- this->m_depth2Reader->read(depth2, x, y, sampler, inputBuffers);
+ this->m_depth1Reader->read(depth1, x, y, sampler);
+ this->m_depth2Reader->read(depth2, x, y, sampler);
if (depth1[0] < depth2[0]) {
- this->m_image1Reader->read(color1, x, y, sampler, inputBuffers);
- this->m_image2Reader->read(color2, x, y, sampler, inputBuffers);
+ this->m_image1Reader->read(color1, x, y, sampler);
+ this->m_image2Reader->read(color2, x, y, sampler);
}
else {
- this->m_image1Reader->read(color2, x, y, sampler, inputBuffers);
- this->m_image2Reader->read(color1, x, y, sampler, inputBuffers);
+ this->m_image1Reader->read(color2, x, y, sampler);
+ this->m_image2Reader->read(color1, x, y, sampler);
}
float fac = color1[3];
float ifac = 1.0f - fac;
diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.h b/source/blender/compositor/operations/COM_ZCombineOperation.h
index 422a946b98f..9ee0899ee28 100644
--- a/source/blender/compositor/operations/COM_ZCombineOperation.h
+++ b/source/blender/compositor/operations/COM_ZCombineOperation.h
@@ -47,11 +47,11 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
class ZCombineAlphaOperation : public ZCombineOperation {
- void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
+ void executePixel(float *color, float x, float y, PixelSampler sampler);
};
#endif
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index a21154bde1b..d4b30814403 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -851,7 +851,7 @@ static int acf_group_setting_flag(bAnimContext *ac, int setting, short *neg)
// *neg = 1; - if we change this to edtiability
return AGRP_PROTECTED;
- case ACHANNEL_SETTING_VISIBLE: /* visiblity - graph editor */
+ case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
*neg = 1;
return AGRP_NOTVISIBLE;
}
@@ -939,7 +939,7 @@ static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, short
// *neg = 1; - if we change this to edtiability
return FCURVE_PROTECTED;
- case ACHANNEL_SETTING_VISIBLE: /* visiblity - graph editor */
+ case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
return FCURVE_VISIBLE;
default: /* unsupported */
@@ -2507,11 +2507,11 @@ static bAnimChannelType ACF_GPL =
acf_generic_channel_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */
acf_generic_group_offset, /* offset */
-
+
acf_gpl_name, /* name */
acf_gpl_name_prop, /* name prop */
NULL, /* icon */
-
+
acf_gpl_setting_valid, /* has setting */
acf_gpl_setting_flag, /* flag for setting */
acf_gpl_setting_ptr /* pointer for setting */
@@ -2541,7 +2541,7 @@ static short acf_mask_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNU
case ACHANNEL_SETTING_SELECT:
case ACHANNEL_SETTING_EXPAND:
return 1;
-
+
default:
return 0;
}
@@ -2552,15 +2552,15 @@ static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), int setting, short *n
{
/* clear extra return data first */
*neg = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return AGRP_SELECTED;
-
+
case ACHANNEL_SETTING_EXPAND: /* expanded */
return MASK_ANIMF_EXPAND;
}
-
+
/* this shouldn't happen */
return 0;
}
@@ -2569,7 +2569,7 @@ static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), int setting, short *n
static void *acf_mask_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type)
{
Mask *mask = (Mask *)ale->data;
-
+
/* all flags are just in mask->flag for now... */
return GET_ACF_FLAG_PTR(mask->flag, type);
}
@@ -2578,16 +2578,16 @@ static void *acf_mask_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short
static bAnimChannelType ACF_MASKDATA =
{
"Mask Datablock", /* type name */
-
+
acf_mask_color, /* backdrop color */
acf_group_backdrop, /* backdrop */
acf_generic_indention_0, /* indent level */
acf_generic_group_offset, /* offset */
-
+
acf_generic_idblock_name, /* name */
acf_generic_idfill_nameprop, /* name prop */
acf_mask_icon, /* icon */
-
+
acf_mask_setting_valid, /* has setting */
acf_mask_setting_flag, /* flag for setting */
acf_mask_setting_ptr /* pointer for setting */
@@ -2599,7 +2599,7 @@ static bAnimChannelType ACF_MASKDATA =
static void acf_masklay_name(bAnimListElem *ale, char *name)
{
MaskLayer *masklay = (MaskLayer *)ale->data;
-
+
if (masklay && name)
BLI_strncpy(name, masklay->name, ANIM_CHAN_NAME_SIZE);
}
@@ -2610,7 +2610,7 @@ static short acf_masklay_name_prop(bAnimListElem *ale, PointerRNA *ptr, Property
if (ale->data) {
RNA_pointer_create(ale->id, &RNA_MaskLayer, ale->data, ptr);
*prop = RNA_struct_name_property(ptr->type);
-
+
return (*prop != NULL);
}
@@ -2625,7 +2625,7 @@ static short acf_masklay_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *
case ACHANNEL_SETTING_EXPAND: /* mask layers are more like F-Curves than groups */
case ACHANNEL_SETTING_VISIBLE: /* graph editor only */
return 0;
-
+
/* always available */
default:
return 1;
@@ -2637,18 +2637,18 @@ static int acf_masklay_setting_flag(bAnimContext *UNUSED(ac), int setting, short
{
/* clear extra return data first */
*neg = 0;
-
+
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return MASK_LAYERFLAG_SELECT;
-
+
// case ACHANNEL_SETTING_MUTE: /* muted */
// return GP_LAYER_HIDE;
-
+
case ACHANNEL_SETTING_PROTECT: /* protected */
// *neg = 1; - if we change this to edtiability
return MASK_LAYERFLAG_LOCKED;
-
+
default: /* unsupported */
return 0;
}
@@ -2702,17 +2702,17 @@ static void ANIM_init_channel_typeinfo_data(void)
animchannelTypeInfo[type++] = NULL; /* None */
animchannelTypeInfo[type++] = NULL; /* AnimData */
animchannelTypeInfo[type++] = NULL; /* Special */
-
+
animchannelTypeInfo[type++] = &ACF_SUMMARY; /* Motion Summary */
-
+
animchannelTypeInfo[type++] = &ACF_SCENE; /* Scene */
animchannelTypeInfo[type++] = &ACF_OBJECT; /* Object */
animchannelTypeInfo[type++] = &ACF_GROUP; /* Group */
animchannelTypeInfo[type++] = &ACF_FCURVE; /* F-Curve */
-
+
animchannelTypeInfo[type++] = &ACF_FILLACTD; /* Object Action Expander */
animchannelTypeInfo[type++] = &ACF_FILLDRIVERS; /* Drivers Expander */
-
+
animchannelTypeInfo[type++] = &ACF_DSMAT; /* Material Channel */
animchannelTypeInfo[type++] = &ACF_DSLAM; /* Lamp Channel */
animchannelTypeInfo[type++] = &ACF_DSCAM; /* Camera Channel */
@@ -2727,15 +2727,15 @@ static void ANIM_init_channel_typeinfo_data(void)
animchannelTypeInfo[type++] = &ACF_DSTEX; /* Texture Channel */
animchannelTypeInfo[type++] = &ACF_DSLAT; /* Lattice Channel */
animchannelTypeInfo[type++] = &ACF_DSSPK; /* Speaker Channel */
-
+
animchannelTypeInfo[type++] = &ACF_SHAPEKEY; /* ShapeKey */
-
+
animchannelTypeInfo[type++] = &ACF_GPD; /* Grease Pencil Datablock */
animchannelTypeInfo[type++] = &ACF_GPL; /* Grease Pencil Layer */
-
+
animchannelTypeInfo[type++] = &ACF_MASKDATA; /* Mask Datablock */
animchannelTypeInfo[type++] = &ACF_MASKLAYER; /* Mask Layer */
-
+
// TODO: these types still need to be implemented!!!
// probably need a few extra flags for these special cases...
animchannelTypeInfo[type++] = NULL; /* NLA Track */
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 32cbbc79496..50bdbd6673c 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -178,7 +178,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
char *bone_name;
/* get bone-name, and check if this bone is selected */
- bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
+ bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
if (bone_name) MEM_freeN(bone_name);
@@ -201,7 +201,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
char *seq_name;
/* get strip name, and check if this strip is selected */
- seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
+ seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
if (seq_name) MEM_freeN(seq_name);
@@ -223,7 +223,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
char *node_name;
/* get strip name, and check if this strip is selected */
- node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
+ node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
node = nodeFindNodebyName(ntree, node_name);
if (node_name) MEM_freeN(node_name);
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index e239719d894..1dcb9f79a09 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -417,16 +417,16 @@ short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
*
* For this to work correctly, a standard set of data needs to be available within the scope that this
* gets called in:
- * - ListBase anim_data;
- * - bDopeSheet *ads;
- * - bAnimListElem *ale;
+ * - ListBase anim_data;
+ * - bDopeSheet *ads;
+ * - bAnimListElem *ale;
* - size_t items;
*
* - id: ID block which should have an AnimData pointer following it immediately, to use
- * - adtOk: line or block of code to execute for AnimData-blocks case (usually ANIMDATA_ADD_ANIMDATA)
- * - nlaOk: line or block of code to execute for NLA tracks+strips case
- * - driversOk: line or block of code to execute for Drivers case
- * - keysOk: line or block of code for Keyframes case
+ * - adtOk: line or block of code to execute for AnimData-blocks case (usually ANIMDATA_ADD_ANIMDATA)
+ * - nlaOk: line or block of code to execute for NLA tracks+strips case
+ * - driversOk: line or block of code to execute for Drivers case
+ * - keysOk: line or block of code for Keyframes case
*
* The checks for the various cases are as follows:
* 0) top level: checks for animdata and also that all the F-Curves for the block will be visible
@@ -880,7 +880,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
char *bone_name;
/* get bone-name, and check if this bone is selected */
- bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
+ bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
if (bone_name) MEM_freeN(bone_name);
@@ -916,7 +916,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
char *seq_name;
/* get strip name, and check if this strip is selected */
- seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
+ seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
if (seq_name) MEM_freeN(seq_name);
@@ -936,7 +936,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
char *node_name;
/* get strip name, and check if this strip is selected */
- node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
+ node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
node = nodeFindNodebyName(ntree, node_name);
if (node_name) MEM_freeN(node_name);
@@ -1316,6 +1316,7 @@ static size_t animdata_filter_shapekey(bAnimContext *ac, ListBase *anim_data, Ke
return items;
}
+/* Helper for Grease Pencil - layers within a datablock */
static size_t animdata_filter_gpencil_data(ListBase *anim_data, bGPdata *gpd, int filter_mode)
{
bGPDlayer *gpl;
@@ -1382,6 +1383,7 @@ static size_t animdata_filter_gpencil(ListBase *anim_data, void *UNUSED(data), i
return items;
}
+/* Helper for Mask Editing - mask layers */
static size_t animdata_filter_mask_data(ListBase *anim_data, Mask *mask, const int filter_mode)
{
MaskLayer *masklay_act = BKE_mask_layer_active(mask);
@@ -1398,18 +1400,6 @@ static size_t animdata_filter_mask_data(ListBase *anim_data, Mask *mask, const i
if (!(filter_mode & ANIMFILTER_ACTIVE) || (masklay_act == masklay)) {
/* add to list */
ANIMCHANNEL_NEW_CHANNEL(masklay, ANIMTYPE_MASKLAYER, mask);
-
-
-// if (filter_mode & ANIMFILTER_TMP_PEEK)
-// return 1;
-// else {
-// bAnimListElem *ale = make_new_animlistelem(masklay, channel_type, (ID *)owner_id);
-// if (ale) {
-// BLI_addtail(anim_data, ale);
-// items ++;
-// }
-// }
-
}
// }
}
@@ -1418,28 +1408,29 @@ static size_t animdata_filter_mask_data(ListBase *anim_data, Mask *mask, const i
return items;
}
+/* Grab all mask data */
static size_t animdata_filter_mask(ListBase *anim_data, void *UNUSED(data), int filter_mode)
{
Mask *mask;
size_t items = 0;
-
- /* for now, grab grease pencil datablocks directly from main */
+
+ /* for now, grab mask datablocks directly from main */
// XXX: this is not good...
for (mask = G.main->mask.first; mask; mask = mask->id.next) {
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
-
- /* only show if gpd is used by something... */
+
+ /* only show if mask is used by something... */
if (ID_REAL_USERS(mask) < 1)
continue;
-
- /* add gpencil animation channels */
+
+ /* add mask animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_MASK(mask))
{
tmp_items += animdata_filter_mask_data(&tmp_data, mask, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
-
+
/* did we find anything? */
if (tmp_items) {
/* include data-expand widget first */
@@ -1447,14 +1438,14 @@ static size_t animdata_filter_mask(ListBase *anim_data, void *UNUSED(data), int
/* add gpd as channel too (if for drawing, and it has layers) */
ANIMCHANNEL_NEW_CHANNEL(mask, ANIMTYPE_MASKDATABLOCK, NULL);
}
-
+
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
items += tmp_items;
}
}
-
+
/* return the number of items added to the list */
return items;
}
@@ -2386,7 +2377,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
items += animfilter_action(ac, anim_data, ads, data, filter_mode, (ID *)obact);
}
break;
-
+
case ANIMCONT_SHAPEKEY: /* 'ShapeKey Editor' */
{
/* the check for the DopeSheet summary is included here since the summary works here too */
@@ -2401,14 +2392,14 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
items = animdata_filter_gpencil(anim_data, data, filter_mode);
}
break;
-
+
case ANIMCONT_MASK:
{
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
items = animdata_filter_mask(anim_data, data, filter_mode);
}
break;
-
+
case ANIMCONT_DOPESHEET: /* 'DopeSheet Editor' */
{
/* the DopeSheet editor is the primary place where the DopeSheet summaries are useful */
diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h
index 7d1209a3033..cf84eb04b10 100644
--- a/source/blender/editors/animation/anim_intern.h
+++ b/source/blender/editors/animation/anim_intern.h
@@ -55,6 +55,7 @@ void ANIM_OT_keyframe_delete_v3d(struct wmOperatorType *ot);
/* Keyframe managment operators for UI buttons (RMB menu). */
void ANIM_OT_keyframe_insert_button(struct wmOperatorType *ot);
void ANIM_OT_keyframe_delete_button(struct wmOperatorType *ot);
+void ANIM_OT_keyframe_clear_button(struct wmOperatorType *ot);
/* .......... */
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 35782c3b3ae..5295950546d 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -104,8 +104,8 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
*/
if (strstr(fcu->rna_path, "bones") && strstr(fcu->rna_path, "constraints")) {
/* perform string 'chopping' to get "Bone Name : Constraint Name" */
- char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones[");
- char *constName = BLI_getQuotedStr(fcu->rna_path, "constraints[");
+ char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
+ char *constName = BLI_str_quoted_substrN(fcu->rna_path, "constraints[");
/* assemble the string to display in the UI... */
structname = BLI_sprintfN("%s : %s", pchanName, constName);
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index ea344e7e332..96044e2408e 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -848,14 +848,14 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
}
if (evt->val == KM_PRESS) {
- float vec[3];
- char str_tx[256];
+ float vec;
+ char str_tx[NUM_STR_REP_LEN];
if (handleNumInput(&mm->num, evt)) {
- applyNumInput(&mm->num, vec);
+ applyNumInput(&mm->num, &vec);
outputNumInput(&mm->num, str_tx);
- RNA_int_set(op->ptr, "frames", vec[0]);
+ RNA_int_set(op->ptr, "frames", vec);
ed_marker_move_apply(op);
// ed_marker_header_update(C, op, str, (int)vec[0]);
// strcat(str, str_tx);
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 119df33dd91..13741a99d99 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -294,6 +294,7 @@ void ED_operatortypes_anim(void)
WM_operatortype_append(ANIM_OT_keyframe_delete_v3d);
WM_operatortype_append(ANIM_OT_keyframe_insert_button);
WM_operatortype_append(ANIM_OT_keyframe_delete_button);
+ WM_operatortype_append(ANIM_OT_keyframe_clear_button);
WM_operatortype_append(ANIM_OT_driver_button_add);
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 84711b97729..85731933168 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -674,15 +674,15 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
if (keys) {
/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
/* TODO: allow this opacity factor to be themed? */
- float kalpha = (channelLocked) ? 0.35f : 1.0f;
-
+ float kalpha = (channelLocked) ? 0.25f : 1.0f;
+
for (ak = keys->first; ak; ak = ak->next) {
/* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw
* - this might give some improvements, since we current have to flip between view/region matrices
*/
if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax) == 0)
continue;
-
+
/* draw using OpenGL - uglier but faster */
/* NOTE1: a previous version of this didn't work nice for some intel cards
* NOTE2: if we wanted to go back to icons, these are icon = (ak->sel & SELECT) ? ICON_SPACE2 : ICON_SPACE3; */
@@ -753,6 +753,10 @@ void draw_fcurve_channel(View2D *v2d, AnimData *adt, FCurve *fcu, float ypos)
{
DLRBT_Tree keys, blocks;
+ short locked = (fcu->flag & FCURVE_PROTECTED) ||
+ ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ||
+ ((adt && adt->action) && (adt->action->id.lib));
+
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
@@ -761,7 +765,7 @@ void draw_fcurve_channel(View2D *v2d, AnimData *adt, FCurve *fcu, float ypos)
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
- draw_keylist(v2d, &keys, &blocks, ypos, (fcu->flag & FCURVE_PROTECTED));
+ draw_keylist(v2d, &keys, &blocks, ypos, locked);
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
@@ -771,6 +775,9 @@ void draw_agroup_channel(View2D *v2d, AnimData *adt, bActionGroup *agrp, float y
{
DLRBT_Tree keys, blocks;
+ short locked = (agrp->flag & AGRP_PROTECTED) ||
+ ((adt && adt->action) && (adt->action->id.lib));
+
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
@@ -779,7 +786,7 @@ void draw_agroup_channel(View2D *v2d, AnimData *adt, bActionGroup *agrp, float y
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
- draw_keylist(v2d, &keys, &blocks, ypos, (agrp->flag & AGRP_PROTECTED));
+ draw_keylist(v2d, &keys, &blocks, ypos, locked);
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
@@ -789,6 +796,8 @@ void draw_action_channel(View2D *v2d, AnimData *adt, bAction *act, float ypos)
{
DLRBT_Tree keys, blocks;
+ short locked = (act->id.lib != 0);
+
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
@@ -797,7 +806,7 @@ void draw_action_channel(View2D *v2d, AnimData *adt, bAction *act, float ypos)
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
- draw_keylist(v2d, &keys, &blocks, ypos, 0);
+ draw_keylist(v2d, &keys, &blocks, ypos, locked);
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 88627a6dabd..78ac729f16e 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -505,7 +505,7 @@ static short ok_bezier_region(KeyframeEditData *ked, BezTriple *bezt)
if (ked->data) {
short ok = 0;
- #define KEY_CHECK_OK(_index) BLI_in_rctf(ked->data, bezt->vec[_index][0], bezt->vec[_index][1])
+ #define KEY_CHECK_OK(_index) BLI_in_rctf_v(ked->data, bezt->vec[_index])
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
#undef KEY_CHECK_OK
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 7600e1d4690..3ef686910e6 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1079,6 +1079,91 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
return ret;
}
+/* ************************************************** */
+/* KEYFRAME CLEAR */
+
+/* Main Keyframing API call:
+ * Use this when validation of necessary animation data isn't necessary as it
+ * already exists. It will clear the current buttons fcurve(s).
+ *
+ * The flag argument is used for special settings that alter the behavior of
+ * the keyframe deletion. These include the quick refresh options.
+ */
+short clear_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, short UNUSED(flag))
+{
+ AnimData *adt = BKE_animdata_from_id(id);
+ PointerRNA id_ptr, ptr;
+ PropertyRNA *prop;
+ int array_index_max = array_index + 1;
+ int ret = 0;
+
+ /* sanity checks */
+ if (ELEM(NULL, id, adt)) {
+ BKE_report(reports, RPT_ERROR, "No ID-Block and/Or AnimData to delete keyframe from");
+ return 0;
+ }
+
+ /* validate pointer first - exit if failure */
+ RNA_id_pointer_create(id, &id_ptr);
+ if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
+ BKE_reportf(reports, RPT_ERROR, "Could not clear keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)", id->name, rna_path);
+ return 0;
+ }
+
+ /* get F-Curve
+ * Note: here is one of the places where we don't want new Action + F-Curve added!
+ * so 'add' var must be 0
+ */
+ if (act == NULL) {
+ /* if no action is provided, use the default one attached to this ID-block
+ * - if it doesn't exist, then we're out of options...
+ */
+ if (adt->action) {
+ act = adt->action;
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "No Action to delete keyframes from for ID = %s\n", id->name);
+ return 0;
+ }
+ }
+
+ /* key entire array convenience method */
+ if (array_index == -1) {
+ array_index = 0;
+ array_index_max = RNA_property_array_length(&ptr, prop);
+
+ /* for single properties, increase max_index so that the property itself gets included,
+ * but don't do this for standard arrays since that can cause corruption issues
+ * (extra unused curves)
+ */
+ if (array_index_max == array_index)
+ array_index_max++;
+ }
+
+ /* will only loop once unless the array index was -1 */
+ for (; array_index < array_index_max; array_index++) {
+ FCurve *fcu = verify_fcurve(act, group, &ptr, rna_path, array_index, 0);
+
+ /* check if F-Curve exists and/or whether it can be edited */
+ if (fcu == NULL)
+ continue;
+
+ if ( (fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ) {
+ if (G.debug & G_DEBUG)
+ printf("WARNING: not deleting keyframe for locked F-Curve\n");
+ continue;
+ }
+
+ ANIM_fcurve_delete_from_animdata(NULL, adt, fcu);
+
+ /* return success */
+ ret++;
+ }
+
+ /* return success/failure */
+ return ret;
+}
+
/* ******************************************* */
/* KEYFRAME MODIFICATION */
@@ -1584,6 +1669,78 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "all", 1, "All", "Delete keyframes from all elements of the array");
}
+
+/* Clear Key Button Operator ------------------------ */
+
+static int clear_key_button_exec(bContext *C, wmOperator *op)
+{
+ Main *bmain = CTX_data_main(C);
+ PointerRNA ptr = {{NULL}};
+ PropertyRNA *prop = NULL;
+ char *path;
+ short success = 0;
+ int a, index, length, all = RNA_boolean_get(op->ptr, "all");
+
+ /* try to insert keyframe using property retrieved from UI */
+ uiContextActiveProperty(C, &ptr, &prop, &index);
+
+ if (ptr.id.data && ptr.data && prop) {
+ path = RNA_path_from_ID_to_property(&ptr, prop);
+
+ if (path) {
+ if (all) {
+ length = RNA_property_array_length(&ptr, prop);
+
+ if (length) index = 0;
+ else length = 1;
+ }
+ else
+ length = 1;
+
+ for (a = 0; a < length; a++)
+ success += clear_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, 0);
+
+ MEM_freeN(path);
+ }
+ else if (G.debug & G_DEBUG)
+ printf("Button Clear-Key: no path to property\n");
+ }
+ else if (G.debug & G_DEBUG) {
+ printf("ptr.data = %p, prop = %p\n", (void *)ptr.data, (void *)prop);
+ }
+
+
+ if (success) {
+ /* send updates */
+ uiContextAnimUpdate(C);
+
+ DAG_ids_flush_update(bmain, 0);
+
+ /* send notifiers that keyframes have been changed */
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ }
+
+ return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+}
+
+void ANIM_OT_keyframe_clear_button(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Clear Keyframe (Buttons)";
+ ot->idname = "ANIM_OT_keyframe_clear_button";
+ ot->description = "Clear all keyframes on the currently active property";
+
+ /* callbacks */
+ ot->exec = clear_key_button_exec;
+ ot->poll = modify_key_op_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_boolean(ot->srna, "all", 1, "All", "Clear keyframes from all elements of the array");
+}
+
/* ******************************************* */
/* AUTO KEYFRAME */
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 2a3f2182fdf..e0aa33d0207 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -1213,6 +1213,8 @@ static int separate_armature_exec(bContext *C, wmOperator *UNUSED(op))
/* 2) duplicate base */
newbase = ED_object_add_duplicate(bmain, scene, oldbase, USER_DUP_ARM); /* only duplicate linked armature */
+ DAG_scene_sort(bmain, scene);
+
newob = newbase->object;
newbase->flag &= ~SELECT;
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 91c342ec070..caadee5f941 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -25,7 +25,6 @@
* \ingroup edarmature
*/
-
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
@@ -49,8 +48,6 @@
#include "BLI_rand.h"
#include "BLI_threads.h"
-//#include "BDR_editobject.h"
-
#include "BKE_constraint.h"
#include "BKE_armature.h"
#include "BKE_context.h"
@@ -60,10 +57,7 @@
#include "BIF_retarget.h"
-
-//#include "mydevice.h"
-#include "reeb.h" // FIX ME
-//#include "blendef.h"
+#include "reeb.h" /* FIX ME */
#include "armature_intern.h"
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 06ecf76ba3e..78d3d8dc64d 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -22,7 +22,6 @@
* \ingroup edarmature
*/
-
#include <string.h>
#include <math.h>
#include <float.h>
@@ -49,27 +48,18 @@
#include "ED_screen.h"
#include "BIF_gl.h"
-//#include "BIF_screen.h"
-//#include "BIF_space.h"
-//#include "BIF_mywindow.h"
#include "ED_armature.h"
#include "armature_intern.h"
-//#include "BIF_sketch.h"
#include "BIF_retarget.h"
#include "BIF_generate.h"
-//#include "BIF_interface.h"
#include "ED_transform.h"
#include "WM_api.h"
#include "WM_types.h"
-//#include "blendef.h"
-//#include "mydevice.h"
#include "reeb.h"
-
-
typedef int (*GestureDetectFct)(bContext *, SK_Gesture *, SK_Sketch *);
typedef void (*GestureApplyFct)(bContext *, SK_Gesture *, SK_Sketch *);
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index f837d8a726e..cd2ca16fec5 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -694,7 +694,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
/* only items related to this object will be relevant */
if ((ksp->id == &ob->id) && (ksp->rna_path != NULL)) {
if (strstr(ksp->rna_path, "bones")) {
- char *boneName = BLI_getQuotedStr(ksp->rna_path, "bones[");
+ char *boneName = BLI_str_quoted_substrN(ksp->rna_path, "bones[");
if (boneName) {
bPoseChannel *pchan = BKE_pose_channel_find_name(pose, boneName);
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index af252ffe60c..ce4e1db23b5 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -24,11 +24,10 @@
* \ingroup edarmature
*/
-
#include <math.h>
-#include <string.h> // for memcpy
+#include <string.h> /* for memcpy */
#include <stdio.h>
-#include <stdlib.h> // for qsort
+#include <stdlib.h> /* for qsort */
#include <float.h>
#include "DNA_scene_types.h"
@@ -45,16 +44,8 @@
#include "BLI_ghash.h"
#include "BLI_heap.h"
-//#include "BDR_editobject.h"
-
-//#include "BIF_interface.h"
-//#include "BIF_toolbox.h"
-//#include "BIF_graphics.h"
-
#include "BKE_mesh.h"
-//#include "blendef.h"
-
#include "ONL_opennl.h"
#include "reeb.h"
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index e8a71a35576..a9646aaabf4 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1369,6 +1369,8 @@ static int separate_exec(bContext *C, wmOperator *op)
/* 1. duplicate the object and data */
newbase = ED_object_add_duplicate(bmain, scene, oldbase, 0); /* 0 = fully linked */
+ DAG_scene_sort(bmain, scene);
+
ED_base_object_select(newbase, BA_DESELECT);
newob = newbase->object;
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index bc912fc8c76..7906d632f86 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -769,7 +769,7 @@ void draw_gpencil_view3d(Scene *scene, View3D *v3d, ARegion *ar, short only3d)
if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
rctf rectf;
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, TRUE); /* no shift */
- BLI_copy_rcti_rctf(&rect, &rectf);
+ BLI_rcti_rctf_copy(&rect, &rectf);
}
else {
rect.xmin = 0;
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index b2e8ecd09c9..35284b26d29 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -104,14 +104,14 @@ struct BMFace *EDBM_face_at_index(struct BMEditMesh *em, int index);
void EDBM_select_more(struct BMEditMesh *em);
void EDBM_select_less(struct BMEditMesh *em);
-void EDBM_selectmode_flush_ex(struct BMEditMesh *em, int selectmode);
+void EDBM_selectmode_flush_ex(struct BMEditMesh *em, const short selectmode);
void EDBM_selectmode_flush(struct BMEditMesh *em);
void EDBM_deselect_flush(struct BMEditMesh *em);
void EDBM_select_flush(struct BMEditMesh *em);
void EDBM_selectmode_set(struct BMEditMesh *em);
-void EDBM_selectmode_convert(struct BMEditMesh *em, short oldmode, short selectmode);
+void EDBM_selectmode_convert(struct BMEditMesh *em, short oldmode, const short selectmode);
void undo_push_mesh(struct bContext *C, const char *name);
int EDBM_vert_color_check(struct BMEditMesh *em);
diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h
index 411df88fb28..126ea13f0b2 100644
--- a/source/blender/editors/include/ED_numinput.h
+++ b/source/blender/editors/include/ED_numinput.h
@@ -57,6 +57,7 @@ typedef struct NumInput {
/*********************** NumInput ********************************/
void initNumInput(NumInput *n);
+#define NUM_STR_REP_LEN 20 /* str must be NUM_STR_LEN * (idx_max + 1) length. */
void outputNumInput(NumInput *n, char *str);
short hasNumInput(NumInput *n);
void applyNumInput(NumInput *n, float *vec);
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 9209bbb2db7..38f0077c368 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -84,7 +84,8 @@ typedef enum eParentType {
extern struct EnumPropertyItem prop_clear_parent_types[];
extern struct EnumPropertyItem prop_make_parent_types[];
-int ED_object_parent_set(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct Object *par, int partype);
+int ED_object_parent_set(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob,
+ struct Object *par, int partype, int xmirror);
void ED_object_parent_clear(struct Object *ob, int type);
struct Base *ED_object_scene_link(struct Scene *scene, struct Object *ob);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 9715fb93c27..0b0ad83ab21 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -198,6 +198,7 @@ typedef struct uiLayout uiLayout;
/* button reqyires a pointer */
#define BUTPOIN (FLO | SHO | CHA)
+/* assigned to but->type, OR'd with the flags above when passing args */
#define BUT (1 << 9)
#define ROW (2 << 9)
#define TOG (3 << 9)
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 5039a30b61a..f0bdb2fc2ea 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -120,8 +120,8 @@ enum {
/* Macros: */
/* test if mouse in a scrollbar (assume that scroller availability has been tested) */
-#define IN_2D_VERT_SCROLL(v2d, co) (BLI_in_rcti(&v2d->vert, co[0], co[1]))
-#define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_in_rcti(&v2d->hor, co[0], co[1]))
+#define IN_2D_VERT_SCROLL(v2d, co) (BLI_in_rcti_v(&v2d->vert, co))
+#define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_in_rcti_v(&v2d->hor, co))
/* ------------------------------------------ */
/* Type definitions: */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 381560fc9ac..8f15a63ac33 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2134,7 +2134,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
/* TODO - investigate why block->winmat[0][0] is negative
* in the image view when viewRedrawForce is called */
- block->aspect = 2.0 / fabs( (getsizex) * block->winmat[0][0]);
+ block->aspect = 2.0f / fabsf(getsizex * block->winmat[0][0]);
}
else {
/* no subwindow created yet, for menus for example, so we
@@ -2143,7 +2143,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
wm_subwindow_getmatrix(window, window->screen->mainwin, block->winmat);
wm_subwindow_getsize(window, window->screen->mainwin, &getsizex, &getsizey);
- block->aspect = 2.0 / fabs(getsizex * block->winmat[0][0]);
+ block->aspect = 2.0f / fabsf(getsizex * block->winmat[0][0]);
block->auto_open = TRUE;
block->flag |= UI_BLOCK_LOOP; /* tag as menu */
}
@@ -2243,8 +2243,12 @@ void ui_check_but(uiBut *but)
UI_GET_BUT_VALUE_INIT(but, value);
if (ui_is_but_float(but)) {
- if (value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
- else if (value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
+ if (value == (double) FLT_MAX) {
+ BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
+ }
+ else if (value == (double) -FLT_MAX) {
+ BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
+ }
/* support length type buttons */
else if (ui_is_but_unit(but)) {
char new_str[sizeof(but->drawstr)];
@@ -2550,7 +2554,9 @@ void ui_block_do_align(uiBlock *block)
* - \a a2 Number of decimal point values to display. 0 defaults to 3 (0.000)
* 1,2,3, and a maximum of 4, all greater values will be clamped to 4.
*/
-static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
+static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
+ int x1, int y1, short x2, short y2,
+ void *poin, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
int slen;
@@ -2622,10 +2628,14 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
}
}
- if ((block->flag & UI_BLOCK_LOOP) || ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
+ if ((block->flag & UI_BLOCK_LOOP) ||
+ ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
+ {
but->flag |= (UI_TEXT_LEFT | UI_ICON_LEFT);
- else if (but->type == BUT_TOGDUAL)
+ }
+ else if (but->type == BUT_TOGDUAL) {
but->flag |= UI_ICON_LEFT;
+ }
but->flag |= (block->flag & UI_BUT_ALIGN);
@@ -2670,7 +2680,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->lockstr = ""
-static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
+static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str,
+ int x1, int y1, short x2, short y2,
+ PointerRNA *ptr, PropertyRNA *prop, int index,
+ float min, float max, float a1, float a2, const char *tip)
{
const PropertyType proptype = RNA_property_type(prop);
uiBut *but;
@@ -3792,12 +3805,14 @@ void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...)
break;
}
}
- if (type == BUT_GET_RNAENUM_IDENTIFIER)
- tmp = BLI_strdup(item->identifier);
- else if (type == BUT_GET_RNAENUM_LABEL)
- tmp = BLI_strdup(item->name);
- else if (item->description && item->description[0])
- tmp = BLI_strdup(item->description);
+ if (item && item->identifier) {
+ if (type == BUT_GET_RNAENUM_IDENTIFIER)
+ tmp = BLI_strdup(item->identifier);
+ else if (type == BUT_GET_RNAENUM_LABEL)
+ tmp = BLI_strdup(item->name);
+ else if (item->description && item->description[0])
+ tmp = BLI_strdup(item->description);
+ }
}
}
else if (type == BUT_GET_OP_KEYMAP) {
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 3099fcb2b40..28d18f6a3dd 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -212,7 +212,12 @@ void ui_but_anim_delete_keyframe(bContext *C)
WM_operator_name_call(C, "ANIM_OT_keyframe_delete_button", WM_OP_INVOKE_DEFAULT, NULL);
}
-void ui_but_anim_add_driver(bContext *C)
+void ui_but_anim_clear_keyframe(bContext *C)
+{
+ /* this operator calls uiContextActiveProperty */
+ WM_operator_name_call(C, "ANIM_OT_keyframe_clear_button", WM_OP_INVOKE_DEFAULT, NULL);
+}
+ void ui_but_anim_add_driver(bContext *C)
{
/* this operator calls uiContextActiveProperty */
WM_operator_name_call(C, "ANIM_OT_driver_button_add", WM_OP_INVOKE_DEFAULT, NULL);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index e576b71e442..1d88838ecc5 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1353,7 +1353,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
scissor_new.ymin = ar->winrct.ymin + rect->ymin;
scissor_new.xmax = ar->winrct.xmin + rect->xmax;
scissor_new.ymax = ar->winrct.ymin + rect->ymax;
- BLI_isect_rcti(&scissor_new, &ar->winrct, &scissor_new);
+ BLI_rcti_isect(&scissor_new, &ar->winrct, &scissor_new);
glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax - scissor_new.xmin, scissor_new.ymax - scissor_new.ymin);
/* calculate offset and zoom */
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 613ab2fa6c8..2a93ab794af 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -256,13 +256,42 @@ static uiBut *ui_but_last(uiBlock *block)
static int ui_is_a_warp_but(uiBut *but)
{
- if (U.uiflag & USER_CONTINUOUS_MOUSE)
- if (ELEM4(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW))
+ if (U.uiflag & USER_CONTINUOUS_MOUSE) {
+ if (ELEM6(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW, HSVCUBE, BUT_CURVE)) {
return TRUE;
+ }
+ }
return FALSE;
}
+static float ui_mouse_scale_warp_factor(const short shift)
+{
+ if (U.uiflag & USER_CONTINUOUS_MOUSE) {
+ return shift ? 0.05f : 1.0f;
+ }
+ else {
+ return 1.0f;
+ }
+}
+
+static void ui_mouse_scale_warp(uiHandleButtonData *data,
+ const float mx, const float my,
+ float *r_mx, float *r_my,
+ const short shift)
+{
+ if (U.uiflag & USER_CONTINUOUS_MOUSE) {
+ const float fac = ui_mouse_scale_warp_factor(shift);
+ /* slow down the mouse, this is fairly picky */
+ *r_mx = (data->dragstartx * (1.0f - fac) + mx * fac);
+ *r_my = (data->dragstarty * (1.0f - fac) + my * fac);
+ }
+ else {
+ *r_mx = mx;
+ *r_my = my;
+ }
+}
+
/* file selectors are exempt from utf-8 checks */
int ui_is_but_utf8(uiBut *but)
{
@@ -2636,7 +2665,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
return retval;
}
-static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, int ctrl, int mx)
+static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, const short shift, const short ctrl, int mx)
{
float deler, f, tempf, softmin, softmax, softrange;
int temp, lvalue, changed = 0;
@@ -3091,14 +3120,17 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my)
+static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my, const short shift)
{
float rgb[3];
float *hsv = ui_block_hsv_get(but->block);
float x, y;
+ float mx_fl, my_fl;
int changed = 1;
int color_profile = but->block->color_profile;
+ ui_mouse_scale_warp(data, mx, my, &mx_fl, &my_fl, shift);
+
if (but->rnaprop) {
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = BLI_PR_NONE;
@@ -3108,9 +3140,10 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
rgb_to_hsv_compat_v(rgb, hsv);
+
/* relative position within box */
- x = ((float)mx - but->x1) / (but->x2 - but->x1);
- y = ((float)my - but->y1) / (but->y2 - but->y1);
+ x = ((float)mx_fl - but->x1) / (but->x2 - but->x1);
+ y = ((float)my_fl - but->y1) / (but->y2 - but->y1);
CLAMP(x, 0.0f, 1.0f);
CLAMP(y, 0.0f, 1.0f);
@@ -3161,7 +3194,7 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
return changed;
}
-static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift)
+static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, const short shift)
{
float *hsv = ui_block_hsv_get(but->block);
float rgb[3];
@@ -3235,7 +3268,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
/* also do drag the first time */
- if (ui_numedit_but_HSVCUBE(but, data, mx, my))
+ if (ui_numedit_but_HSVCUBE(but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
return WM_UI_HANDLER_BREAK;
@@ -3292,7 +3325,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
}
else if (event->type == MOUSEMOVE) {
if (mx != data->draglastx || my != data->draglasty) {
- if (ui_numedit_but_HSVCUBE(but, data, mx, my))
+ if (ui_numedit_but_HSVCUBE(but, data, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
}
}
@@ -3305,13 +3338,16 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx, int my, int shift)
+static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, float mx, float my, int shift)
{
rcti rect;
int changed = 1;
+ float mx_fl, my_fl;
float rgb[3];
float hsv[3];
+ ui_mouse_scale_warp(data, mx, my, &mx_fl, &my_fl, shift);
+
rect.xmin = but->x1; rect.xmax = but->x2;
rect.ymin = but->y1; rect.ymax = but->y2;
@@ -3325,14 +3361,8 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
if (hsv[2] == 0.f) hsv[2] = 0.0001f;
}
- if (U.uiflag & USER_CONTINUOUS_MOUSE) {
- float fac = shift ? 0.05f : 1.0f;
- /* slow down the mouse, this is fairly picky */
- mx = (data->dragstartx * (1.0f - fac) + mx * fac);
- my = (data->dragstarty * (1.0f - fac) + my * fac);
- }
- ui_hsvcircle_vals_from_pos(hsv, hsv + 1, &rect, (float)mx, (float)my);
+ ui_hsvcircle_vals_from_pos(hsv, hsv + 1, &rect, mx_fl, my_fl);
if (but->flag & UI_BUT_COLOR_CUBIC)
hsv[1] = 1.0f - sqrt3f(1.0f - hsv[1]);
@@ -3352,7 +3382,7 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
return changed;
}
-static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift)
+static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, const short shift)
{
float *hsv = ui_block_hsv_get(but->block);
float rgb[3];
@@ -3584,7 +3614,8 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, int mx, int my)
+static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
+ float mx, float my, const short shift)
{
CurveMapping *cumap = (CurveMapping *)but->poin;
CurveMap *cuma = cumap->cm + cumap->cur;
@@ -3608,10 +3639,15 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
}
if (data->dragsel != -1) {
+ const float mval_factor = ui_mouse_scale_warp_factor(shift);
int moved_point = 0; /* for ctrl grid, can't use orig coords because of sorting */
fx = (mx - data->draglastx) / zoomx;
fy = (my - data->draglasty) / zoomy;
+
+ fx *= mval_factor;
+ fy *= mval_factor;
+
for (a = 0; a < cuma->totpoint; a++) {
if (cmp[a].flag & SELECT) {
float origx = cmp[a].x, origy = cmp[a].y;
@@ -3774,7 +3810,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
else if (data->state == BUTTON_STATE_NUM_EDITING) {
if (event->type == MOUSEMOVE) {
if (mx != data->draglastx || my != data->draglasty) {
- if (ui_numedit_but_CURVE(but, data, event->ctrl, mx, my))
+ if (ui_numedit_but_CURVE(but, data, event->ctrl, mx, my, event->shift))
ui_numedit_apply(C, block, but, data);
}
}
@@ -4182,7 +4218,8 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonData *data, int mx, int my, int shift)
+static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonData *data,
+ int mx, int my, const short shift)
{
MovieClipScopes *scopes = (MovieClipScopes *)but->poin;
int changed = 1;
@@ -4474,6 +4511,19 @@ static int ui_but_menu(bContext *C, uiBut *but)
ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
}
+ if (but->flag & UI_BUT_ANIMATED) {
+ if (length) {
+ uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
+ ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 1);
+ uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Single Keyframes"),
+ ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 0);
+ }
+ else {
+ uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
+ ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 0);
+ }
+ }
+
/* Drivers */
if (but->flag & UI_BUT_DRIVEN) {
uiItemS(layout);
@@ -4687,11 +4737,18 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
ui_but_drop(C, event, but, data);
}
/* handle keyframing */
- else if (event->type == IKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
- if (event->alt)
- ui_but_anim_delete_keyframe(C);
- else
+ else if (event->type == IKEY && !ELEM(KM_MOD_FIRST, event->ctrl, event->oskey) && event->val == KM_PRESS) {
+ if (event->alt) {
+ if (event->shift) {
+ ui_but_anim_clear_keyframe(C);
+ }
+ else {
+ ui_but_anim_delete_keyframe(C);
+ }
+ }
+ else {
ui_but_anim_insert_keyframe(C);
+ }
ED_region_tag_redraw(CTX_wm_region(C));
@@ -5937,14 +5994,13 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
newp[0] = mx;
newp[1] = my;
- if (len_v2v2(oldp, newp) < 4.0f)
+ if (len_squared_v2v2(oldp, newp) < (4.0f * 4.0f))
return menu->dotowards;
- closer = 0;
- closer |= isect_point_tri_v2(newp, oldp, p1, p2);
- closer |= isect_point_tri_v2(newp, oldp, p2, p3);
- closer |= isect_point_tri_v2(newp, oldp, p3, p4);
- closer |= isect_point_tri_v2(newp, oldp, p4, p1);
+ closer = (isect_point_tri_v2(newp, oldp, p1, p2) ||
+ isect_point_tri_v2(newp, oldp, p2, p3) ||
+ isect_point_tri_v2(newp, oldp, p3, p4) ||
+ isect_point_tri_v2(newp, oldp, p4, p1));
if (!closer)
menu->dotowards = 0;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 737c0377f27..002c3d48a01 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -861,7 +861,8 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage *prv_img, enum eIco
prv_img->w[size], prv_img->h[size]);
}
-static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, const float rgb[3], short is_preview)
+static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh,
+ unsigned int *rect, float alpha, const float rgb[3], short is_preview)
{
ImBuf *ima = NULL;
@@ -914,7 +915,8 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
}
}
-static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, const float rgb[3])
+static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy,
+ int UNUSED(iw), int ih, float alpha, const float rgb[3])
{
float x1, x2, y1, y2;
@@ -957,7 +959,8 @@ static int get_draw_size(enum eIconSizes size)
return 0;
}
-static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, const float rgb[3], enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
+static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, const float rgb[3],
+ enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
{
bTheme *btheme = UI_GetTheme();
Icon *icon = NULL;
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 1f88db033a4..c6787b4c554 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -508,6 +508,7 @@ void ui_but_add_shortcut(uiBut *but, const char *key_str, const short do_strip);
void ui_but_anim_flag(uiBut *but, float cfra);
void ui_but_anim_insert_keyframe(struct bContext *C);
void ui_but_anim_delete_keyframe(struct bContext *C);
+void ui_but_anim_clear_keyframe(struct bContext *C);
void ui_but_anim_add_driver(struct bContext *C);
void ui_but_anim_remove_driver(struct bContext *C);
void ui_but_anim_copy_driver(struct bContext *C);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 7f9a998e6d0..76485571096 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -978,7 +978,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
short align = panel_aligned(sa, ar), dx = 0, dy = 0;
/* first clip for window, no dragging outside */
- if (!BLI_in_rcti(&ar->winrct, event->x, event->y))
+ if (!BLI_in_rcti_v(&ar->winrct, &event->x))
return;
dx = (event->x - data->startx) & ~(PNL_GRID - 1);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 49e3818fe08..4702253140a 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2242,13 +2242,13 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
}
}
else if (itemptr->type == &RNA_MaskLayer) {
- split = uiLayoutSplit(sub, 0.5f, FALSE);
+ split = uiLayoutRow(sub, FALSE);
uiItemL(split, name, icon);
uiBlockSetEmboss(block, UI_EMBOSSN);
row = uiLayoutRow(split, TRUE);
- // uiItemR(row, itemptr, "alpha", 0, "", ICON_NONE); // enable when used
+ uiItemR(row, itemptr, "alpha", 0, "", ICON_NONE);
uiItemR(row, itemptr, "hide", 0, "", 0);
uiItemR(row, itemptr, "hide_select", 0, "", 0);
uiItemR(row, itemptr, "hide_render", 0, "", 0);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 1d7a423a15a..50f93f7e9f5 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1213,7 +1213,8 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], in
}
// get a 3 byte color, blended and shaded between two other char color pointers
-void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset)
+void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3],
+ float fac, int offset)
{
int r, g, b;
@@ -1740,7 +1741,8 @@ void init_userdef_do_versions(void)
}
if (bmain->versionfile < 257) {
- /* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs, so that it doesn't linger around from old configs like a ghost */
+ /* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs,
+ * so that it doesn't linger around from old configs like a ghost */
U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
}
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 47e91f4c659..a693e9eb627 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1818,7 +1818,7 @@ void UI_view2d_scrollers_free(View2DScrollers *scrollers)
* This should be (0,0) for most views. However, for those where the starting row was offsetted
* (like for Animation Editor channel lists, to make the first entry more visible), these will be
* the min-coordinates of the first item.
- * - column, row = the 2d-corodinates (in 2D-view / 'tot' rect space) the cell exists at
+ * - column, row = the 2d-coordinates (in 2D-view / 'tot' rect space) the cell exists at
* - rect = coordinates of the cell (passed as single var instead of 4 separate, as it's more useful this way)
*/
void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowheight, float startx, float starty, int column, int row, rctf *rect)
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 3be41d1f46e..244a4ea15de 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -499,15 +499,15 @@ static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
/* ********************************************************* */
/* SINGLE-STEP VIEW ZOOMING OPERATOR */
-/* This group of operators come in several forms:
- * 1) Scrollwheel 'steps' - rolling mousewheel by one step zooms view by predefined amount
- * 2) Scrollwheel 'steps' + alt + ctrl/shift - zooms view on one axis only (ctrl=x, shift=y) // XXX this could be implemented...
- * 3) Pad +/- Keys - pressing each key moves the zooms the view by a predefined amount
+/* This group of operators come in several forms:
+ * 1) Scrollwheel 'steps' - rolling mousewheel by one step zooms view by predefined amount
+ * 2) Scrollwheel 'steps' + alt + ctrl/shift - zooms view on one axis only (ctrl=x, shift=y) // XXX this could be implemented...
+ * 3) Pad +/- Keys - pressing each key moves the zooms the view by a predefined amount
*
- * In order to make sure this works, each operator must define the following RNA-Operator Props:
- * zoomfacx, zoomfacy - These two zoom factors allow for non-uniform scaling.
- * It is safe to scale by 0, as these factors are used to determine
- * amount to enlarge 'cur' by
+ * In order to make sure this works, each operator must define the following RNA-Operator Props:
+ * zoomfacx, zoomfacy - These two zoom factors allow for non-uniform scaling.
+ * It is safe to scale by 0, as these factors are used to determine
+ * amount to enlarge 'cur' by
*/
/* ------------------ 'Shared' stuff ------------------------ */
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index f080b9f96e7..f378d5452a4 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -388,6 +388,9 @@ static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline,
mask_draw_curve_type(spline, feather_points, tot_feather_point,
TRUE, is_smooth, is_active,
rgb_tmp, draw_type);
+
+ /* TODO, draw mirror values when MASK_SPLINE_NOFILL is set */
+
MEM_freeN(feather_points);
/* draw main curve */
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index cce7e26115e..b9522540e67 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -238,6 +238,9 @@ void ED_operatortypes_mask(void)
WM_operatortype_append(MASK_OT_shape_key_clear);
WM_operatortype_append(MASK_OT_shape_key_feather_reset);
WM_operatortype_append(MASK_OT_shape_key_rekey);
+
+ /* layers */
+ WM_operatortype_append(MASK_OT_layer_move);
}
void ED_keymap_mask(wmKeyConfig *keyconf)
diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h
index f1d72f59078..bad0a9c28a8 100644
--- a/source/blender/editors/mask/mask_intern.h
+++ b/source/blender/editors/mask/mask_intern.h
@@ -70,6 +70,8 @@ struct MaskSplinePoint *ED_mask_point_find_nearest(
struct MaskLayer **masklay_r, struct MaskSpline **spline_r, int *is_handle_r,
float *score);
+void MASK_OT_layer_move(struct wmOperatorType *ot);
+
/* mask_relationships.c */
void MASK_OT_parent_set(struct wmOperatorType *ot);
void MASK_OT_parent_clear(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 91ba05c1ab2..c8246fd53bc 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -375,7 +375,7 @@ typedef struct SlidePointData {
MaskSplinePointUW *uw;
float handle[2], no[2], feather[2];
int width, height;
- float weight;
+ float weight, weight_scalar;
short curvature_only, accurate;
short initial_feather, overall_feather;
@@ -460,6 +460,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
float weight_scalar = BKE_mask_point_weight_scalar(spline, point, uw->u);
customdata->weight = uw->w;
+ customdata->weight_scalar = weight_scalar;
BKE_mask_point_segment_co(spline, point, uw->u, co);
BKE_mask_point_normal(spline, point, uw->u, customdata->no);
@@ -469,6 +470,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
BezTriple *bezt = &point->bezt;
customdata->weight = bezt->weight;
+ customdata->weight_scalar = 1.0f;
BKE_mask_point_normal(spline, point, 0.0f, customdata->no);
madd_v2_v2v2fl(customdata->feather, bezt->vec[1], customdata->no, bezt->weight);
@@ -710,13 +712,13 @@ static int slide_point_modal(bContext *C, wmOperator *op, wmEvent *event)
if (dot_v2v2(no, vec) <= 0.0f)
w = -w;
- delta = w - data->weight;
+ delta = w - data->weight * data->weight_scalar;
if (data->orig_spline == NULL) {
/* restore weight for currently sliding point, so orig_spline would be created
* with original weights used
*/
- *weight = data->weight * weight_scalar;
+ *weight = data->weight;
data->orig_spline = BKE_mask_spline_copy(data->spline);
}
@@ -1341,3 +1343,74 @@ void MASK_OT_feather_weight_clear(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+
+/******************** move mask layer operator *********************/
+
+static int mask_layer_move_poll(bContext *C)
+{
+ if (ED_maskedit_mask_poll(C)) {
+ Mask *mask = CTX_data_edit_mask(C);
+
+ return mask->masklay_tot > 0;
+ }
+
+ return FALSE;
+}
+
+static int mask_layer_move_exec(bContext *C, wmOperator *op)
+{
+ Mask *mask = CTX_data_edit_mask(C);
+ MaskLayer *mask_layer = BLI_findlink(&mask->masklayers, mask->masklay_act);
+ MaskLayer *mask_layer_other;
+ int direction = RNA_enum_get(op->ptr, "direction");
+
+ if (!mask_layer)
+ return OPERATOR_CANCELLED;
+
+ if (direction == -1) {
+ mask_layer_other = mask_layer->prev;
+
+ if (!mask_layer_other)
+ return OPERATOR_CANCELLED;
+
+ BLI_remlink(&mask->masklayers, mask_layer);
+ BLI_insertlinkbefore(&mask->masklayers, mask_layer_other, mask_layer);
+ mask->masklay_act--;
+ }
+ else if (direction == 1) {
+ mask_layer_other = mask_layer->next;
+
+ if (!mask_layer_other)
+ return OPERATOR_CANCELLED;
+
+ BLI_remlink(&mask->masklayers, mask_layer);
+ BLI_insertlinkafter(&mask->masklayers, mask_layer_other, mask_layer);
+ mask->masklay_act++;
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void MASK_OT_layer_move(wmOperatorType *ot)
+{
+ static EnumPropertyItem direction_items[] = {
+ {-1, "UP", 0, "Up", ""},
+ {1, "DOWN", 0, "Down", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ /* identifiers */
+ ot->name = "Move Layer";
+ ot->description = "Move the active layer up/down in the list";
+ ot->idname = "MASK_OT_layer_move";
+
+ /* api callbacks */
+ ot->exec = mask_layer_move_exec;
+ ot->poll = mask_layer_move_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move the active layer");
+}
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index e619277456e..a2a7a07d089 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -418,7 +418,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
/* TODO: handles? */
/* TODO: uw? */
- if (BLI_in_rctf(&rectf, point_deform->bezt.vec[1][0], point_deform->bezt.vec[1][1])) {
+ if (BLI_in_rctf_v(&rectf, point_deform->bezt.vec[1])) {
BKE_mask_point_select_set(point, mode == GESTURE_MODAL_SELECT);
BKE_mask_point_select_set_handle(point, mode == GESTURE_MODAL_SELECT);
}
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 882d3115ba0..5907d066c83 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -2008,9 +2008,9 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
remerge_faces(kcd);
/* delete left over faces */
- BMO_op_callf(bm, "delete geom=%ff context=%i", DEL, DEL_ONLYFACES);
- BMO_op_callf(bm, "delete geom=%fe context=%i", DEL, DEL_EDGES);
- BMO_op_callf(bm, "delete geom=%fv context=%i", DEL, DEL_VERTS);
+ BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete geom=%ff context=%i", DEL, DEL_ONLYFACES);
+ BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete geom=%fe context=%i", DEL, DEL_EDGES);
+ BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete geom=%fv context=%i", DEL, DEL_VERTS);
if (face_nets)
MEM_freeN(face_nets);
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index eb2aabd88b8..60c5244ddbc 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -447,6 +447,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
switch (event->type) {
case RETKEY:
+ case PADENTER:
case LEFTMOUSE: /* confirm */ // XXX hardcoded
if (event->val == KM_PRESS) {
/* finish */
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index a9912b90aef..7dc0ed78dfc 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -113,7 +113,9 @@ void EDBM_automerge(Scene *scene, Object *obedit, int update)
if (!em)
return;
- BMO_op_callf(em->bm, "automerge verts=%hv dist=%f", BM_ELEM_SELECT, scene->toolsettings->doublimit);
+ BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
+ "automerge verts=%hv dist=%f",
+ BM_ELEM_SELECT, scene->toolsettings->doublimit);
if (update) {
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
BMEdit_RecalcTessellation(em);
@@ -1682,15 +1684,15 @@ void EDBM_selectmode_set(BMEditMesh *em)
}
}
-void EDBM_selectmode_convert(BMEditMesh *em, short oldmode, short selectmode)
+void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const short selectmode_new)
{
BMEdge *eed;
BMFace *efa;
BMIter iter;
/* have to find out what the selectionmode was previously */
- if (oldmode == SCE_SELECT_VERTEX) {
- if (selectmode == SCE_SELECT_EDGE) {
+ if (selectmode_old == SCE_SELECT_VERTEX) {
+ if (selectmode_new == SCE_SELECT_EDGE) {
/* select all edges associated with every selected vertex */
eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
for (; eed; eed = BM_iter_step(&iter)) {
@@ -1701,7 +1703,7 @@ void EDBM_selectmode_convert(BMEditMesh *em, short oldmode, short selectmode)
}
}
}
- else if (selectmode == SCE_SELECT_FACE) {
+ else if (selectmode_new == SCE_SELECT_FACE) {
BMIter liter;
BMLoop *l;
@@ -1718,9 +1720,8 @@ void EDBM_selectmode_convert(BMEditMesh *em, short oldmode, short selectmode)
}
}
}
-
- if (oldmode == SCE_SELECT_EDGE) {
- if (selectmode == SCE_SELECT_FACE) {
+ else if (selectmode_old == SCE_SELECT_EDGE) {
+ if (selectmode_new == SCE_SELECT_FACE) {
BMIter liter;
BMLoop *l;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 4c7545fa4fa..072c66c60d8 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -58,6 +58,7 @@
#include "WM_types.h"
#include "ED_mesh.h"
+#include "ED_numinput.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_transform.h"
@@ -254,7 +255,7 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
ModifierData *md;
BMElem *ele;
- BMO_op_init(bm, &extop, "extrude_face_region");
+ BMO_op_init(bm, &extop, BMO_FLAG_DEFAULTS, "extrude_face_region");
BMO_slot_buffer_from_enabled_hflag(bm, &extop, "edgefacein", BM_VERT | BM_EDGE | BM_FACE, hflag);
/* If a mirror modifier with clipping is on, we need to adjust some
@@ -394,8 +395,10 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op)
for (a = 0; a < steps; a++) {
edbm_extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
- //BMO_op_callf(em->bm, "extrude_face_region edgefacein=%hef", BM_ELEM_SELECT);
- BMO_op_callf(em->bm, "translate vec=%v verts=%hv", (float *)dvec, BM_ELEM_SELECT);
+ //BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, "extrude_face_region edgefacein=%hef", BM_ELEM_SELECT);
+ BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
+ "translate vec=%v verts=%hv",
+ (float *)dvec, BM_ELEM_SELECT);
//extrudeflag(obedit, em, SELECT, nor);
//translateflag(em, SELECT, dvec);
}
@@ -2789,120 +2792,157 @@ void MESH_OT_knife_cut(wmOperatorType *ot)
RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
}
-static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmOperator *wmop)
+static int mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
{
- Base *basenew;
+ Base *base_new;
BMIter iter;
BMVert *v;
BMEdge *e;
- Object *obedit = editbase->object;
- Mesh *me = obedit->data;
- BMEditMesh *em = me->edit_btmesh;
+ Object *obedit = base_old->object;
BMesh *bm_new;
-
- if (!em)
- return FALSE;
-
+
bm_new = BM_mesh_create(&bm_mesh_allocsize_default);
- CustomData_copy(&em->bm->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
- CustomData_copy(&em->bm->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0);
- CustomData_copy(&em->bm->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
- CustomData_copy(&em->bm->pdata, &bm_new->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
+ CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
+ CustomData_copy(&bm_old->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0);
+ CustomData_copy(&bm_old->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
+ CustomData_copy(&bm_old->pdata, &bm_new->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_bmesh_init_pool(&bm_new->vdata, bm_mesh_allocsize_default.totvert, BM_VERT);
CustomData_bmesh_init_pool(&bm_new->edata, bm_mesh_allocsize_default.totedge, BM_EDGE);
CustomData_bmesh_init_pool(&bm_new->ldata, bm_mesh_allocsize_default.totloop, BM_LOOP);
CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE);
-
- basenew = ED_object_add_duplicate(bmain, scene, editbase, USER_DUP_MESH); /* 0 = fully linked */
- assign_matarar(basenew->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
- ED_base_object_select(basenew, BA_DESELECT);
-
- EDBM_op_callf(em, wmop, "duplicate geom=%hvef dest=%p", BM_ELEM_SELECT, bm_new);
- EDBM_op_callf(em, wmop, "delete geom=%hvef context=%i", BM_ELEM_SELECT, DEL_FACES);
+ base_new = ED_object_add_duplicate(bmain, scene, base_old, USER_DUP_MESH);
+ /* DAG_scene_sort(bmain, scene); */ /* normally would call directly after but in this case delay recalc */
+ assign_matarar(base_new->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
- /* clean up any loose edges */
- BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
- if (BM_elem_flag_test(e, BM_ELEM_HIDDEN))
- continue;
+ ED_base_object_select(base_new, BA_SELECT);
+
+ BMO_op_callf(bm_old, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+ "duplicate geom=%hvef dest=%p", BM_ELEM_TAG, bm_new);
+ BMO_op_callf(bm_old, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+ "delete geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES);
- if (!BM_edge_is_wire(e)) {
- BM_edge_select_set(em->bm, e, FALSE);
+ /* clean up any loose edges */
+ BM_ITER_MESH (e, &iter, bm_old, BM_EDGES_OF_MESH) {
+ if (BM_edge_is_wire(e)) {
+ BM_edge_kill(bm_old, e);
}
}
- EDBM_op_callf(em, wmop, "delete geom=%hvef context=%i", BM_ELEM_SELECT, DEL_EDGES);
/* clean up any loose verts */
- BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
- if (BM_elem_flag_test(v, BM_ELEM_HIDDEN))
- continue;
-
- if (BM_vert_edge_count(v) != 0) {
- BM_vert_select_set(em->bm, v, FALSE);
+ BM_ITER_MESH (v, &iter, bm_old, BM_VERTS_OF_MESH) {
+ if (BM_vert_edge_count(v) == 0) {
+ BM_vert_kill(bm_old, v);
}
}
- EDBM_op_callf(em, wmop, "delete geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS);
+ BM_mesh_normals_update(bm_new, FALSE);
- BM_mesh_normals_update(bm_new, TRUE);
+ BM_mesh_bm_to_me(bm_new, base_new->object->data, FALSE);
- BM_mesh_bm_to_me(bm_new, basenew->object->data, FALSE);
-
BM_mesh_free(bm_new);
- ((Mesh *)basenew->object->data)->edit_btmesh = NULL;
+ ((Mesh *)base_new->object->data)->edit_btmesh = NULL;
return TRUE;
}
-static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase, wmOperator *wmop)
+static int mesh_separate_selected(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
+{
+ /* tag -> select */
+ BM_mesh_elem_hflag_enable_test(bm_old, BM_FACE | BM_EDGE | BM_VERT, BM_ELEM_TAG, TRUE, BM_ELEM_SELECT);
+
+ return mesh_separate_tagged(bmain, scene, base_old, bm_old);
+}
+
+/* flush a hflag to from verts to edges/faces */
+static void bm_mesh_hflag_flush_vert(BMesh *bm, const char hflag)
+{
+ BMEdge *e;
+ BMLoop *l_iter;
+ BMLoop *l_first;
+ BMFace *f;
+
+ BMIter eiter;
+ BMIter fiter;
+
+ int ok;
+
+ BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+ if (BM_elem_flag_test(e->v1, hflag) &&
+ BM_elem_flag_test(e->v2, hflag))
+ {
+ BM_elem_flag_enable(e, hflag);
+ }
+ else {
+ BM_elem_flag_disable(e, hflag);
+ }
+ }
+ BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+ ok = TRUE;
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+ do {
+ if (!BM_elem_flag_test(l_iter->v, hflag)) {
+ ok = FALSE;
+ break;
+ }
+ } while ((l_iter = l_iter->next) != l_first);
+
+ BM_elem_flag_set(f, hflag, ok);
+ }
+}
+
+static int mesh_separate_material(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
{
BMFace *f_cmp, *f;
BMIter iter;
int result = FALSE;
- Object *obedit = editbase->object;
- BMEditMesh *em = BMEdit_FromObject(obedit);
- BMesh *bm = em->bm;
- EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+ BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
- while ((f_cmp = BM_iter_at_index(bm, BM_FACES_OF_MESH, NULL, 0))) {
+ while ((f_cmp = BM_iter_at_index(bm_old, BM_FACES_OF_MESH, NULL, 0))) {
const short mat_nr = f_cmp->mat_nr;
int tot = 0;
- BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+ BM_ITER_MESH (f, &iter, bm_old, BM_FACES_OF_MESH) {
if (f->mat_nr == mat_nr) {
- BM_face_select_set(bm, f, TRUE);
+ BMLoop *l_iter;
+ BMLoop *l_first;
+
+ BM_elem_flag_enable(f, BM_ELEM_TAG);
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+ do {
+ BM_elem_flag_enable(l_iter->v, BM_ELEM_TAG);
+ BM_elem_flag_enable(l_iter->e, BM_ELEM_TAG);
+ } while ((l_iter = l_iter->next) != l_first);
+
tot++;
}
}
/* leave the current object with some materials */
- if (tot == bm->totface) {
+ if (tot == bm_old->totface) {
break;
}
/* Move selection into a separate object */
- result |= mesh_separate_selected(bmain, scene, editbase, wmop);
+ result |= mesh_separate_tagged(bmain, scene, base_old, bm_old);
}
return result;
}
-static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOperator *wmop)
+static int mesh_separate_loose(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old)
{
int i;
BMEdge *e;
BMVert *v_seed;
BMWalker walker;
int result = FALSE;
- Object *obedit = editbase->object;
- BMEditMesh *em = BMEdit_FromObject(obedit);
- BMesh *bm = em->bm;
- int max_iter = bm->totvert;
+ int max_iter = bm_old->totvert;
/* Clear all selected vertices */
- EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+ BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
/* A "while (true)" loop should work here as each iteration should
* select and remove at least one vertex and when all vertices
@@ -2910,8 +2950,9 @@ static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOper
* behavior by limiting iterations to the number of vertices in the
* original mesh.*/
for (i = 0; i < max_iter; i++) {
+ int tot = 0;
/* Get a seed vertex to start the walk */
- v_seed = BM_iter_at_index(bm, BM_VERTS_OF_MESH, NULL, 0);
+ v_seed = BM_iter_at_index(bm_old, BM_VERTS_OF_MESH, NULL, 0);
/* No vertices available, can't do anything */
if (v_seed == NULL) {
@@ -2919,33 +2960,33 @@ static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOper
}
/* Select the seed explicitly, in case it has no edges */
- BM_vert_select_set(bm, v_seed, TRUE);
+ if (!BM_elem_flag_test(v_seed, BM_ELEM_TAG)) { BM_elem_flag_enable(v_seed, BM_ELEM_TAG); tot++; }
/* Walk from the single vertex, selecting everything connected
* to it */
- BMW_init(&walker, bm, BMW_SHELL,
+ BMW_init(&walker, bm_old, BMW_SHELL,
BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP,
- BMW_FLAG_NOP, /* BMESH_TODO - should be BMW_FLAG_TEST_HIDDEN ? */
+ BMW_FLAG_NOP,
BMW_NIL_LAY);
e = BMW_begin(&walker, v_seed);
for (; e; e = BMW_step(&walker)) {
- BM_vert_select_set(bm, e->v1, TRUE);
- BM_vert_select_set(bm, e->v2, TRUE);
+ if (!BM_elem_flag_test(e->v1, BM_ELEM_TAG)) { BM_elem_flag_enable(e->v1, BM_ELEM_TAG); tot++; }
+ if (!BM_elem_flag_test(e->v2, BM_ELEM_TAG)) { BM_elem_flag_enable(e->v2, BM_ELEM_TAG); tot++; }
}
BMW_end(&walker);
-
- /* Flush the selection to get edge/face selections matching
- * the vertex selection */
- EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
- if (bm->totvert == bm->totvertsel) {
+ if (bm_old->totvert == tot) {
/* Every vertex selected, nothing to separate, work is done */
break;
}
+ /* Flush the selection to get edge/face selections matching
+ * the vertex selection */
+ bm_mesh_hflag_flush_vert(bm_old, BM_ELEM_TAG);
+
/* Move selection into a separate object */
- result |= mesh_separate_selected(bmain, scene, editbase, wmop);
+ result |= mesh_separate_tagged(bmain, scene, base_old, bm_old);
}
return result;
@@ -2955,19 +2996,65 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- Base *base = CTX_data_active_base(C);
int retval = 0, type = RNA_enum_get(op->ptr, "type");
- if (type == 0)
- retval = mesh_separate_selected(bmain, scene, base, op);
- else if (type == 1)
- retval = mesh_separate_material(bmain, scene, base, op);
- else if (type == 2)
- retval = mesh_separate_loose(bmain, scene, base, op);
+ if (ED_operator_editmesh(C)) {
+ Base *base = CTX_data_active_base(C);
+ BMEditMesh *em = BMEdit_FromObject(base->object);
+
+ /* editmode separate */
+ if (type == 0) retval = mesh_separate_selected(bmain, scene, base, em->bm);
+ else if (type == 1) retval = mesh_separate_material(bmain, scene, base, em->bm);
+ else if (type == 2) retval = mesh_separate_loose(bmain, scene, base, em->bm);
+ else BLI_assert(0);
+
+ if (retval) {
+ EDBM_update_generic(C, em, TRUE);
+ }
+ }
+ else {
+ if (type == 0) {
+ BKE_report(op->reports, RPT_ERROR, "Selecton not supported in object mode");
+ return OPERATOR_CANCELLED;
+ }
+
+ /* object mode separate */
+ CTX_DATA_BEGIN(C, Base *, base_iter, selected_editable_bases)
+ {
+ Object *ob = base_iter->object;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
+ if (me->id.lib == NULL) {
+ BMesh *bm_old = NULL;
+ int retval_iter = 0;
+
+ bm_old = BM_mesh_create(&bm_mesh_allocsize_default);
+
+ BM_mesh_bm_from_me(bm_old, me, FALSE, 0);
+
+ if (type == 1) retval_iter = mesh_separate_material(bmain, scene, base_iter, bm_old);
+ else if (type == 2) retval_iter = mesh_separate_loose(bmain, scene, base_iter, bm_old);
+ else BLI_assert(0);
+
+ if (retval_iter) {
+ BM_mesh_bm_to_me(bm_old, me, FALSE);
+
+ DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+ }
+
+ BM_mesh_free(bm_old);
+
+ retval |= retval_iter;
+ }
+ }
+ }
+ CTX_DATA_END;
+ }
if (retval) {
- BMEditMesh *em = BMEdit_FromObject(base->object);
- EDBM_update_generic(C, em, TRUE);
+ /* delay depsgraph recalc until all objects are duplicated */
+ DAG_scene_sort(bmain, scene);
return OPERATOR_FINISHED;
}
@@ -2994,7 +3081,7 @@ void MESH_OT_separate(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = edbm_separate_exec;
- ot->poll = ED_operator_editmesh;
+ ot->poll = ED_operator_scene_editable; /* object and editmode */
/* flags */
ot->flag = OPTYPE_UNDO;
@@ -4305,23 +4392,31 @@ typedef struct {
int mcenter[2];
float initial_length;
int is_modal;
+ NumInput num_input;
+ float shift_factor; /* The current factor when shift is pressed. Negative when shift not active. */
} BevelData;
#define HEADER_LENGTH 180
static void edbm_bevel_update_header(wmOperator *op, bContext *C)
{
- static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), factor: %f, Use Dist (D): %s: Use Even (E): %s";
+ static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), factor: %s, Use Dist (D): %s: Use Even (E): %s";
char msg[HEADER_LENGTH];
ScrArea *sa = CTX_wm_area(C);
+ BevelData *opdata = op->customdata;
if (sa) {
+ char factor_str[NUM_STR_REP_LEN];
+ if (hasNumInput(&opdata->num_input))
+ outputNumInput(&opdata->num_input, factor_str);
+ else
+ BLI_snprintf(factor_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "percent"));
BLI_snprintf(msg, HEADER_LENGTH, str,
- RNA_float_get(op->ptr, "percent"),
+ factor_str,
RNA_boolean_get(op->ptr, "use_dist") ? "On" : "Off",
RNA_boolean_get(op->ptr, "use_even") ? "On" : "Off"
- );
+ );
ED_area_headerprint(sa, msg);
}
@@ -4384,7 +4479,11 @@ static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal)
opdata->li = li;
opdata->weights = NULL;
opdata->is_modal = is_modal;
-
+ opdata->shift_factor = -1.0f;
+
+ initNumInput(&opdata->num_input);
+ opdata->num_input.flag = NUM_NO_NEGATIVE;
+
/* avoid the cost of allocating a bm copy */
if (is_modal)
opdata->mesh_backup = EDBM_redo_state_store(em);
@@ -4523,8 +4622,21 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
{
BevelData *opdata = op->customdata;
-// Scene *scene = CTX_data_scene(C);
+ if (event->val == KM_PRESS) {
+ /* Try to handle numeric inputs... */
+ float factor;
+
+ if (handleNumInput(&opdata->num_input, event)) {
+ applyNumInput(&opdata->num_input, &factor);
+ CLAMP(factor, 0.0f, 1.0f);
+ RNA_float_set(op->ptr, "percent", factor);
+
+ edbm_bevel_calc(C, op);
+ edbm_bevel_update_header(op, C);
+ return OPERATOR_RUNNING_MODAL;
+ }
+ }
switch (event->type) {
case ESCKEY:
case RIGHTMOUSE:
@@ -4532,22 +4644,32 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED;
case MOUSEMOVE:
- {
- float factor;
- float mdiff[2];
+ if (!hasNumInput(&opdata->num_input)) {
+ float factor;
+ float mdiff[2];
- mdiff[0] = opdata->mcenter[0] - event->mval[0];
- mdiff[1] = opdata->mcenter[1] - event->mval[1];
+ mdiff[0] = opdata->mcenter[0] - event->mval[0];
+ mdiff[1] = opdata->mcenter[1] - event->mval[1];
- factor = len_v2(mdiff) / opdata->initial_length;
- factor = MAX2(1.0f - factor, 0.0f);
+ factor = -len_v2(mdiff) / opdata->initial_length + 1.0f;
- RNA_float_set(op->ptr, "percent", factor);
+ /* Fake shift-transform... */
+ if (event->shift) {
+ if (opdata->shift_factor < 0.0f)
+ opdata->shift_factor = RNA_float_get(op->ptr, "percent");
+ factor = (factor - opdata->shift_factor) * 0.1f + opdata->shift_factor;
+ }
+ else if (opdata->shift_factor >= 0.0f)
+ opdata->shift_factor = -1.0f;
- edbm_bevel_calc(C, op);
- edbm_bevel_update_header(op, C);
+ CLAMP(factor, 0.0f, 1.0f);
+
+ RNA_float_set(op->ptr, "percent", factor);
+
+ edbm_bevel_calc(C, op);
+ edbm_bevel_update_header(op, C);
+ }
return OPERATOR_RUNNING_MODAL;
- }
case LEFTMOUSE:
case PADENTER:
@@ -4598,8 +4720,8 @@ void MESH_OT_bevel(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_float(ot->srna, "percent", 0.0f, -FLT_MAX, FLT_MAX, "Percentage", "", 0.0f, 1.0f);
-// XXX, disabled for 2.63 release, needs to work much better without overlap before we can give to users.
-// RNA_def_int(ot->srna, "recursion", 1, 1, 50, "Recursion Level", "Recursion Level", 1, 8);
+ /* XXX, disabled for 2.63 release, needs to work much better without overlap before we can give to users. */
+/* RNA_def_int(ot->srna, "recursion", 1, 1, 50, "Recursion Level", "Recursion Level", 1, 8); */
RNA_def_boolean(ot->srna, "use_even", FALSE, "Even", "Calculate evenly spaced bevel");
RNA_def_boolean(ot->srna, "use_dist", FALSE, "Distance", "Interpret the percent in blender units");
@@ -4643,26 +4765,36 @@ typedef struct {
int modify_depth;
int is_modal;
float initial_length;
+ int shift;
+ float shift_amount;
BMBackup backup;
BMEditMesh *em;
+ NumInput num_input;
} InsetData;
static void edbm_inset_update_header(wmOperator *op, bContext *C)
{
InsetData *opdata = op->customdata;
- static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RClick), thickness: %f, depth (Ctrl to tweak): %f (%s), Outset (O): (%s)";
+ static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RClick), thickness: %s, depth (Ctrl to tweak): %s (%s), Outset (O): (%s)";
char msg[HEADER_LENGTH];
ScrArea *sa = CTX_wm_area(C);
if (sa) {
+ char flts_str[NUM_STR_REP_LEN * 2];
+ if (hasNumInput(&opdata->num_input))
+ outputNumInput(&opdata->num_input, flts_str);
+ else {
+ BLI_snprintf(flts_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "thickness"));
+ BLI_snprintf(flts_str + NUM_STR_REP_LEN, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "depth"));
+ }
BLI_snprintf(msg, HEADER_LENGTH, str,
- RNA_float_get(op->ptr, "thickness"),
- RNA_float_get(op->ptr, "depth"),
+ flts_str,
+ flts_str + NUM_STR_REP_LEN,
opdata->modify_depth ? "On" : "Off",
RNA_boolean_get(op->ptr, "use_outset") ? "On" : "Off"
- );
+ );
ED_area_headerprint(sa, msg);
}
@@ -4680,9 +4812,14 @@ static int edbm_inset_init(bContext *C, wmOperator *op, int is_modal)
opdata->old_thickness = 0.01;
opdata->old_depth = 0.0;
opdata->modify_depth = FALSE;
+ opdata->shift = FALSE;
+ opdata->shift_amount = 0.0f;
opdata->is_modal = is_modal;
opdata->em = em;
+ initNumInput(&opdata->num_input);
+ opdata->num_input.idx_max = 1; /* Two elements. */
+
if (is_modal)
opdata->backup = EDBM_redo_state_store(em);
@@ -4814,10 +4951,28 @@ static int edbm_inset_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- InsetData *opdata;
+ InsetData *opdata = op->customdata;
- opdata = op->customdata;
+ if (event->val == KM_PRESS) {
+ /* Try to handle numeric inputs... */
+ float amounts[2];
+
+ if (handleNumInput(&opdata->num_input, event)) {
+ applyNumInput(&opdata->num_input, amounts);
+ amounts[0] = MAX2(amounts[0], 0.0f);
+ RNA_float_set(op->ptr, "thickness", amounts[0]);
+ RNA_float_set(op->ptr, "depth", amounts[1]);
+ if (edbm_inset_calc(C, op)) {
+ edbm_inset_update_header(op, C);
+ return OPERATOR_RUNNING_MODAL;
+ }
+ else {
+ edbm_inset_cancel(C, op);
+ return OPERATOR_CANCELLED;
+ }
+ }
+ }
switch (event->type) {
case ESCKEY:
case RIGHTMOUSE:
@@ -4825,33 +4980,37 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED;
case MOUSEMOVE:
- {
- float mdiff[2];
- float amount;
+ if (!hasNumInput(&opdata->num_input)) {
+ float mdiff[2];
+ float amount;
- mdiff[0] = opdata->mcenter[0] - event->mval[0];
- mdiff[1] = opdata->mcenter[1] - event->mval[1];
+ mdiff[0] = opdata->mcenter[0] - event->mval[0];
+ mdiff[1] = opdata->mcenter[1] - event->mval[1];
- if (opdata->modify_depth) {
- amount = opdata->old_depth + (len_v2(mdiff) - opdata->initial_length) / opdata->initial_length;
- RNA_float_set(op->ptr, "depth", amount);
- }
- else {
- amount = opdata->old_thickness - (len_v2(mdiff) - opdata->initial_length) / opdata->initial_length;
- amount = MAX2(amount, 0.0f);
+ if (opdata->modify_depth)
+ amount = opdata->old_depth + len_v2(mdiff) / opdata->initial_length - 1.0f;
+ else
+ amount = opdata->old_thickness - len_v2(mdiff) / opdata->initial_length + 1.0f;
- RNA_float_set(op->ptr, "thickness", amount);
- }
+ /* Fake shift-transform... */
+ if (opdata->shift)
+ amount = (amount - opdata->shift_amount) * 0.1f + opdata->shift_amount;
- if (edbm_inset_calc(C, op)) {
- edbm_inset_update_header(op, C);
- return OPERATOR_RUNNING_MODAL;
- }
- else {
- edbm_inset_cancel(C, op);
- return OPERATOR_CANCELLED;
+ if (opdata->modify_depth)
+ RNA_float_set(op->ptr, "depth", amount);
+ else {
+ amount = MAX2(amount, 0.0f);
+ RNA_float_set(op->ptr, "thickness", amount);
+ }
+
+ if (edbm_inset_calc(C, op))
+ edbm_inset_update_header(op, C);
+ else {
+ edbm_inset_cancel(C, op);
+ return OPERATOR_CANCELLED;
+ }
}
- }
+ return OPERATOR_RUNNING_MODAL;
case LEFTMOUSE:
case PADENTER:
@@ -4860,6 +5019,20 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event)
edbm_inset_exit(C, op);
return OPERATOR_FINISHED;
+ case LEFTSHIFTKEY:
+ case RIGHTSHIFTKEY:
+ if (event->val == KM_PRESS) {
+ if (opdata->modify_depth)
+ opdata->shift_amount = RNA_float_get(op->ptr, "depth");
+ else
+ opdata->shift_amount = RNA_float_get(op->ptr, "thickness");
+ opdata->shift = TRUE;
+ }
+ else {
+ opdata->shift_amount = 0.0f;
+ opdata->shift = FALSE;
+ }
+ return OPERATOR_RUNNING_MODAL;
case LEFTCTRLKEY:
case RIGHTCTRLKEY:
@@ -4871,10 +5044,14 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, wmEvent *event)
if (event->val == KM_PRESS) {
opdata->old_thickness = RNA_float_get(op->ptr, "thickness");
+ if (opdata->shift)
+ opdata->shift_amount = opdata->old_thickness;
opdata->modify_depth = TRUE;
}
else {
opdata->old_depth = RNA_float_get(op->ptr, "depth");
+ if (opdata->shift)
+ opdata->shift_amount = opdata->old_depth;
opdata->modify_depth = FALSE;
}
opdata->initial_length = len_v2(mlen);
@@ -4960,7 +5137,9 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_op_callf(em->bm, "delete geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES);
+ BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
+ "delete geom=%hvef context=%i",
+ BM_ELEM_TAG, DEL_FACES);
}
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
@@ -5010,7 +5189,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
BMOperator bmop;
-
+
EDBM_op_init(em, &bmop, op, "convex_hull input=%hvef "
"use_existing_faces=%b",
BM_ELEM_SELECT,
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 4952dd3f09a..6b7409cd031 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -166,7 +166,7 @@ int EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *f
va_start(list, fmt);
- if (!BMO_op_vinitf(bm, bmop, fmt, list)) {
+ if (!BMO_op_vinitf(bm, bmop, BMO_FLAG_DEFAULTS, fmt, list)) {
BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__);
va_end(list);
return 0;
@@ -235,7 +235,7 @@ int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
va_start(list, fmt);
- if (!BMO_op_vinitf(bm, &bmop, fmt, list)) {
+ if (!BMO_op_vinitf(bm, &bmop, BMO_FLAG_DEFAULTS, fmt, list)) {
BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__);
va_end(list);
return 0;
@@ -259,7 +259,7 @@ int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *selects
va_start(list, fmt);
- if (!BMO_op_vinitf(bm, &bmop, fmt, list)) {
+ if (!BMO_op_vinitf(bm, &bmop, BMO_FLAG_DEFAULTS, fmt, list)) {
BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__);
va_end(list);
return 0;
@@ -287,7 +287,7 @@ int EDBM_op_call_silentf(BMEditMesh *em, const char *fmt, ...)
va_start(list, fmt);
- if (!BMO_op_vinitf(bm, &bmop, fmt, list)) {
+ if (!BMO_op_vinitf(bm, &bmop, BMO_FLAG_DEFAULTS, fmt, list)) {
va_end(list);
return 0;
}
@@ -452,11 +452,9 @@ BMFace *EDBM_face_at_index(BMEditMesh *tm, int index)
return (tm->face_index && index < tm->bm->totface && index >= 0) ? tm->face_index[index] : NULL;
}
-void EDBM_selectmode_flush_ex(BMEditMesh *em, int selectmode)
+void EDBM_selectmode_flush_ex(BMEditMesh *em, const short selectmode)
{
- em->bm->selectmode = selectmode;
- BM_mesh_select_mode_flush(em->bm);
- em->bm->selectmode = em->selectmode;
+ BM_mesh_select_mode_flush_ex(em->bm, selectmode);
}
void EDBM_selectmode_flush(BMEditMesh *em)
@@ -484,7 +482,7 @@ void EDBM_select_more(BMEditMesh *em)
BMOperator bmop;
int use_faces = em->selectmode == SCE_SELECT_FACE;
- BMO_op_initf(em->bm, &bmop,
+ BMO_op_initf(em->bm, &bmop, BMO_FLAG_DEFAULTS,
"region_extend geom=%hvef constrict=%b use_faces=%b",
BM_ELEM_SELECT, FALSE, use_faces);
BMO_op_exec(em->bm, &bmop);
@@ -500,7 +498,7 @@ void EDBM_select_less(BMEditMesh *em)
BMOperator bmop;
int use_faces = em->selectmode == SCE_SELECT_FACE;
- BMO_op_initf(em->bm, &bmop,
+ BMO_op_initf(em->bm, &bmop, BMO_FLAG_DEFAULTS,
"region_extend geom=%hvef constrict=%b use_faces=%b",
BM_ELEM_SELECT, TRUE, use_faces);
BMO_op_exec(em->bm, &bmop);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 044c23092bd..2e75a779fed 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -1030,13 +1030,13 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
uv_poly_center(em, efa, cent);
- if ( (fabs(cent[0] - cent_vec[0]) < 0.001) && (fabs(cent[1] - cent_vec[1]) < 0.001) ) {
+ if ( (fabsf(cent[0] - cent_vec[0]) < 0.001f) && (fabsf(cent[1] - cent_vec[1]) < 0.001f) ) {
BMIter liter;
BMLoop *l;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- if ( (fabs(luv->uv[0] - vec[0]) < 0.001) && (fabs(luv->uv[1] - vec[1]) < 0.001) ) {
+ if ( (fabsf(luv->uv[0] - vec[0]) < 0.001f) && (fabsf(luv->uv[1] - vec[1]) < 0.001f) ) {
return luv->uv;
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 7ab20033239..21eab5bd4dc 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1854,7 +1854,9 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
/* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */
/* leaves selection of base/object unaltered.
- * note: don't call this within a loop since clear_* funcs loop over the entire database. */
+ * note: don't call this within a loop since clear_* funcs loop over the entire database.
+ * note: caller must do DAG_scene_sort(bmain, scene);
+ * this is not done automatic since we may duplicate many objects in a batch */
Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag)
{
Base *basen;
@@ -1874,7 +1876,8 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag
BKE_object_relink(ob);
set_sca_new_poins_ob(ob);
- DAG_scene_sort(bmain, scene);
+ /* DAG_scene_sort(bmain, scene); */ /* caller must do */
+
if (ob->data) {
ED_render_id_flush_update(bmain, ob->data);
}
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index c9851c6a0db..53bfddee740 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -44,6 +44,7 @@
#include "BKE_group.h"
#include "BKE_main.h"
#include "BKE_report.h"
+#include "BKE_object.h"
#include "ED_screen.h"
#include "ED_object.h"
@@ -59,57 +60,114 @@
/********************* 3d view operators ***********************/
+/* can be called with C == NULL */
+static EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+{
+ Object *ob;
+ EnumPropertyItem *item = NULL, item_tmp = {0};
+ int totitem = 0;
+
+ if (C == NULL) {
+ return DummyRNA_NULL_items;
+ }
+
+ ob = ED_object_context(C);
+
+ /* check that the action exists */
+ if (ob) {
+ Group *group = NULL;
+ int i = 0;
+
+ while ((group = find_group(ob, group))) {
+ item_tmp.identifier = item_tmp.name = group->id.name + 2;
+ /* item_tmp.icon = ICON_ARMATURE_DATA; */
+ item_tmp.value = i;
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+ i++;
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *free = 1;
+
+ return item;
+}
+
+/* get the group back from the enum index, quite awkward and UI specific */
+static Group *group_object_active_find_index(Object *ob, const int group_object_index)
+{
+ Group *group = NULL;
+ int i = 0;
+ while ((group = find_group(ob, group))) {
+ if (i == group_object_index) {
+ break;
+ }
+ i++;
+ }
+
+ return group;
+}
+
static int objects_add_active_exec(bContext *C, wmOperator *op)
{
+ Object *ob = ED_object_context(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- Object *ob = OBACT;
- Group *group;
- int ok = 0, cycle = 0;
-
- if (!ob) return OPERATOR_CANCELLED;
-
- /* linking to same group requires its own loop so we can avoid
- * looking up the active objects groups each time */
+ int group_object_index = RNA_enum_get(op->ptr, "group");
+ int is_cycle = FALSE;
+
+ if (ob) {
+ Group *group = group_object_active_find_index(ob, group_object_index);
+
+ /* now add all selected objects from the group */
+ if (group) {
- for (group = bmain->group.first; group; group = group->id.next) {
- if (object_in_group(ob, group)) {
- /* Assign groups to selected objects */
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
- if (base->object->dup_group != group)
+ if (base->object->dup_group != group) {
add_to_group(group, base->object, scene, base);
- else
- cycle = 1;
- ok = 1;
+ }
+ else {
+ is_cycle = TRUE;
+ }
}
CTX_DATA_END;
+
+ if (is_cycle) {
+ BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
+ }
+
+ DAG_scene_sort(bmain, scene);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
}
}
-
- if (!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups");
- if (cycle)
- BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
-
- DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
-
- return OPERATOR_FINISHED;
+
+ return OPERATOR_CANCELLED;
}
void GROUP_OT_objects_add_active(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Add Selected To Active Group";
ot->description = "Add the object to an object group that contains the active object";
ot->idname = "GROUP_OT_objects_add_active";
/* api callbacks */
- ot->exec = objects_add_active_exec;
+ ot->exec = objects_add_active_exec;
+ ot->invoke = WM_menu_invoke;
ot->poll = ED_operator_objectmode;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "The group to add other selected objects to");
+ RNA_def_enum_funcs(prop, group_object_active_itemf);
+ ot->prop = prop;
}
static int objects_remove_active_exec(bContext *C, wmOperator *op)
@@ -164,13 +222,10 @@ static int group_objects_remove_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- Group *group = NULL;
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
- group = NULL;
- while ((group = find_group(base->object, group)))
- rem_from_group(group, base->object, scene, base);
+ BKE_object_groups_clear(scene, base, base->object);
}
CTX_DATA_END;
@@ -202,17 +257,8 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
int group_object_index = RNA_enum_get(op->ptr, "group");
- /* first get the group back from the enum index, quite awkward and UI spesific */
if (ob) {
- Group *group = NULL;
- int i = 0;
-
- while ((group = find_group(ob, group))) {
- if (i == group_object_index) {
- break;
- }
- i++;
- }
+ Group *group = group_object_active_find_index(ob, group_object_index);
/* now remove all selected objects from the group */
if (group) {
@@ -233,40 +279,6 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-
-/* can be called with C == NULL */
-static EnumPropertyItem *group_objects_remove_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
-{
- Object *ob;
- EnumPropertyItem *item = NULL, item_tmp = {0};
- int totitem = 0;
-
- if (C == NULL) {
- return DummyRNA_NULL_items;
- }
-
- ob = ED_object_context(C);
-
- /* check that the action exists */
- if (ob) {
- Group *group = NULL;
- int i = 0;
-
- while ((group = find_group(ob, group))) {
- item_tmp.identifier = item_tmp.name = group->id.name + 2;
- /* item_tmp.icon = ICON_ARMATURE_DATA; */
- item_tmp.value = i;
- RNA_enum_item_add(&item, &totitem, &item_tmp);
- i++;
- }
- }
-
- RNA_enum_item_end(&item, &totitem);
- *free = 1;
-
- return item;
-}
-
void GROUP_OT_objects_remove(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -286,7 +298,7 @@ void GROUP_OT_objects_remove(wmOperatorType *ot)
/* properties */
prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "The group to remove this object from");
- RNA_def_enum_funcs(prop, group_objects_remove_itemf);
+ RNA_def_enum_funcs(prop, group_object_active_itemf);
ot->prop = prop;
}
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index e85f47837ef..89f9f5de311 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -203,7 +203,7 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
while (a--) {
if (bp->hide == 0) {
- if (bp->f1) {
+ if (bp->f1 & SELECT) {
action = SEL_DESELECT;
break;
}
@@ -225,7 +225,7 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
while (a--) {
if (bp->hide == 0) {
- bp->f1 ^= 1;
+ bp->f1 ^= SELECT;
}
bp++;
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index d7c882ba51e..1c48a8bfcab 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -50,6 +50,7 @@
#include "BLI_math.h"
#include "BLI_listbase.h"
+#include "BLI_linklist.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
@@ -64,6 +65,7 @@
#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
#include "BKE_global.h"
+#include "BKE_group.h"
#include "BKE_fcurve.h"
#include "BKE_lamp.h"
#include "BKE_lattice.h"
@@ -518,7 +520,8 @@ EnumPropertyItem prop_make_parent_types[] = {
{0, NULL, 0, NULL, NULL}
};
-int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object *ob, Object *par, int partype)
+int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object *ob, Object *par,
+ int partype, int xmirror)
{
bPoseChannel *pchan = NULL;
int pararm = ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
@@ -641,12 +644,12 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
}
else if (pararm && ob->type == OB_MESH && par->type == OB_ARMATURE) {
if (partype == PAR_ARMATURE_NAME)
- create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_NAME, 0);
+ create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_NAME, FALSE);
else if (partype == PAR_ARMATURE_ENVELOPE)
- create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_ENVELOPE, 0);
+ create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
else if (partype == PAR_ARMATURE_AUTO) {
WM_cursor_wait(1);
- create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_AUTO, 0);
+ create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
WM_cursor_wait(0);
}
/* get corrected inverse */
@@ -674,11 +677,12 @@ static int parent_set_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *par = ED_object_active_context(C);
int partype = RNA_enum_get(op->ptr, "type");
+ int xmirror = RNA_boolean_get(op->ptr, "xmirror");
int ok = 1;
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
- if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) {
+ if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, xmirror)) {
ok = 0;
break;
}
@@ -728,6 +732,33 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE
return OPERATOR_CANCELLED;
}
+static int parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
+{
+ const char *prop_id = RNA_property_identifier(prop);
+ int type = RNA_enum_get(ptr, "type");
+
+ /* Only show XMirror for PAR_ARMATURE_ENVELOPE and PAR_ARMATURE_AUTO! */
+ if (strcmp(prop_id, "xmirror") == 0) {
+ if (ELEM(type, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO))
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void parent_set_ui(bContext *C, wmOperator *op)
+{
+ uiLayout *layout = op->layout;
+ wmWindowManager *wm = CTX_wm_manager(C);
+ PointerRNA ptr;
+
+ RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
+
+ /* Main auto-draw call. */
+ uiDefAutoButsRNA(layout, &ptr, parent_set_draw_check_prop, '\0');
+}
void OBJECT_OT_parent_set(wmOperatorType *ot)
{
@@ -739,13 +770,15 @@ void OBJECT_OT_parent_set(wmOperatorType *ot)
/* api callbacks */
ot->invoke = parent_set_invoke;
ot->exec = parent_set_exec;
-
ot->poll = ED_operator_object_active;
+ ot->ui = parent_set_ui;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", "");
+ RNA_def_boolean(ot->srna, "xmirror", FALSE, "X Mirror",
+ "Apply weights symmetrically along X axis, for Envelope/Automatic vertex groups creation");
}
/* ************ Make Parent Without Inverse Operator ******************* */
@@ -1246,14 +1279,15 @@ enum {
MAKE_LINKS_OBDATA = 1,
MAKE_LINKS_MATERIALS,
MAKE_LINKS_ANIMDATA,
+ MAKE_LINKS_GROUP,
MAKE_LINKS_DUPLIGROUP,
MAKE_LINKS_MODIFIERS
};
/* Return 1 if make link data is allow, zero otherwise */
-static int allow_make_links_data(int ev, Object *ob, Object *obt)
+static int allow_make_links_data(const int type, Object *ob, Object *obt)
{
- switch (ev) {
+ switch (type) {
case MAKE_LINKS_OBDATA:
if (ob->type == obt->type && ob->type != OB_EMPTY)
return 1;
@@ -1266,6 +1300,7 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt)
}
break;
case MAKE_LINKS_ANIMDATA:
+ case MAKE_LINKS_GROUP:
case MAKE_LINKS_DUPLIGROUP:
return 1;
case MAKE_LINKS_MODIFIERS:
@@ -1279,52 +1314,81 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt)
static int make_links_data_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- int event = RNA_enum_get(op->ptr, "type");
- Object *ob;
+ Scene *scene = CTX_data_scene(C);
+ const int type = RNA_enum_get(op->ptr, "type");
+ Object *ob_src;
ID *id;
int a;
- ob = ED_object_active_context(C);
+ /* group */
+ LinkNode *ob_groups = NULL;
+ int is_cycle = FALSE;
+
+ ob_src = ED_object_active_context(C);
+
+ /* avoid searching all groups in source object each time */
+ if (type == MAKE_LINKS_GROUP) {
+ ob_groups = BKE_object_groups(ob_src);
+ }
- CTX_DATA_BEGIN (C, Object *, obt, selected_editable_objects)
+ CTX_DATA_BEGIN (C, Base *, base_dst, selected_editable_bases)
{
- if (ob != obt) {
- if (allow_make_links_data(event, ob, obt)) {
- switch (event) {
+ Object *ob_dst = base_dst->object;
+
+ if (ob_src != ob_dst) {
+ if (allow_make_links_data(type, ob_src, ob_dst)) {
+ switch (type) {
case MAKE_LINKS_OBDATA: /* obdata */
- id = obt->data;
+ id = ob_dst->data;
id->us--;
- id = ob->data;
+ id = ob_src->data;
id_us_plus(id);
- obt->data = id;
+ ob_dst->data = id;
/* if amount of material indices changed: */
- test_object_materials(obt->data);
+ test_object_materials(ob_dst->data);
- obt->recalc |= OB_RECALC_DATA;
+ ob_dst->recalc |= OB_RECALC_DATA;
break;
case MAKE_LINKS_MATERIALS:
/* new approach, using functions from kernel */
- for (a = 0; a < ob->totcol; a++) {
- Material *ma = give_current_material(ob, a + 1);
- assign_material(obt, ma, a + 1); /* also works with ma==NULL */
+ for (a = 0; a < ob_src->totcol; a++) {
+ Material *ma = give_current_material(ob_src, a + 1);
+ assign_material(ob_dst, ma, a + 1); /* also works with ma==NULL */
}
break;
case MAKE_LINKS_ANIMDATA:
- BKE_copy_animdata_id((ID *)obt, (ID *)ob, FALSE);
- BKE_copy_animdata_id((ID *)obt->data, (ID *)ob->data, FALSE);
+ BKE_copy_animdata_id((ID *)ob_dst, (ID *)ob_src, FALSE);
+ BKE_copy_animdata_id((ID *)ob_dst->data, (ID *)ob_src->data, FALSE);
break;
+ case MAKE_LINKS_GROUP:
+ {
+ LinkNode *group_node;
+
+ /* first clear groups */
+ BKE_object_groups_clear(scene, base_dst, ob_dst);
+
+ /* now add in the groups from the link nodes */
+ for (group_node = ob_groups; group_node; group_node = group_node->next) {
+ if (ob_dst->dup_group != group_node->link) {
+ add_to_group(group_node->link, ob_dst, scene, base_dst);
+ }
+ else {
+ is_cycle = TRUE;
+ }
+ }
+ }
case MAKE_LINKS_DUPLIGROUP:
- obt->dup_group = ob->dup_group;
- if (obt->dup_group) {
- id_lib_extern(&obt->dup_group->id);
- obt->transflag |= OB_DUPLIGROUP;
+ ob_dst->dup_group = ob_src->dup_group;
+ if (ob_dst->dup_group) {
+ id_lib_extern(&ob_dst->dup_group->id);
+ ob_dst->transflag |= OB_DUPLIGROUP;
}
break;
case MAKE_LINKS_MODIFIERS:
- BKE_object_link_modifiers(obt, ob);
- obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ BKE_object_link_modifiers(ob_dst, ob_src);
+ ob_dst->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
break;
}
}
@@ -1332,7 +1396,17 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_scene_sort(bmain, CTX_data_scene(C));
+ if (type == MAKE_LINKS_GROUP) {
+ if (ob_groups) {
+ BLI_linklist_free(ob_groups, NULL);
+ }
+
+ if (is_cycle) {
+ BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
+ }
+ }
+
+ DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
@@ -1369,6 +1443,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
{MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""},
{MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
{MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
+ {MAKE_LINKS_GROUP, "GROUPS", 0, "Group", ""},
{MAKE_LINKS_DUPLIGROUP, "DUPLIGROUP", 0, "DupliGroup", ""},
{MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
{0, NULL, 0, NULL, NULL}};
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 2e9652686da..11e98c970a0 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -954,7 +954,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
dist = dists[i];
}
else {
- if (fabs(dist - distToBe) < fabs(dists[i] - distToBe)) {
+ if (fabsf(dist - distToBe) < fabsf(dists[i] - distToBe)) {
upDown[i] = 0;
changes[i][0] = vc;
changes[i][1] = hc;
@@ -963,7 +963,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
else {
upDown[i] = 1;
}
- if (fabs(dists[i] - distToBe) > fabs(distToStart - distToBe)) {
+ if (fabsf(dists[i] - distToBe) > fabsf(distToStart - distToBe)) {
changes[i][0] = 0;
changes[i][1] = 0;
dists[i] = distToStart;
@@ -979,7 +979,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
for (i = k + 1; i < totweight; i++) {
dist = dists[i];
- if (fabs(dist) > fabs(dists[i])) {
+ if (fabsf(dist) > fabsf(dists[i])) {
bestIndex = i;
}
}
@@ -1009,7 +1009,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
bestIndex = -1;
/* find the best change with an acceptable horizontal change */
for (i = 0; i < totweight; i++) {
- if (fabs(changes[i][0]) > fabs(changes[i][1] * 2.0f)) {
+ if (fabsf(changes[i][0]) > fabsf(changes[i][1] * 2.0f)) {
bestIndex = i;
break;
}
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 1fe533eb23f..dc2f70189e7 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -913,7 +913,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
return 0;
}
- /* these both have to be valid, otherwise we wouldnt be here */
+ /* these both have to be valid, otherwise we wouldn't be here */
fluidmd = (FluidsimModifierData *)modifiers_findByType(fsDomain, eModifierType_Fluidsim);
domainSettings = fluidmd->fss;
mesh = fsDomain->data;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index a79d38d4081..f8ca150e28e 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -403,7 +403,7 @@ void region_scissor_winrct(ARegion *ar, rcti *winrct)
while (ar->prev) {
ar = ar->prev;
- if (BLI_isect_rcti(winrct, &ar->winrct, NULL)) {
+ if (BLI_rcti_isect(winrct, &ar->winrct, NULL)) {
if (ar->flag & RGN_FLAG_HIDDEN) ;
else if (ar->alignment & RGN_SPLIT_PREV) ;
else if (ar->alignment == RGN_OVERLAP_LEFT) {
@@ -607,7 +607,7 @@ static void area_azone_initialize(ScrArea *sa)
az->y1 = sa->totrct.ymin - 1;
az->x2 = sa->totrct.xmin + (AZONESPOT - 1);
az->y2 = sa->totrct.ymin + (AZONESPOT - 1);
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+ BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
az = (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
BLI_addtail(&(sa->actionzones), az);
@@ -616,7 +616,7 @@ static void area_azone_initialize(ScrArea *sa)
az->y1 = sa->totrct.ymax + 1;
az->x2 = sa->totrct.xmax - (AZONESPOT - 1);
az->y2 = sa->totrct.ymax - (AZONESPOT - 1);
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+ BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
#define AZONEPAD_EDGE 4
@@ -650,7 +650,7 @@ static void region_azone_edge(AZone *az, ARegion *ar)
break;
}
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+ BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
@@ -692,7 +692,7 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
break;
}
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+ BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
/* if more azones on 1 spot, set offset */
for (azt = sa->actionzones.first; azt; azt = azt->next) {
@@ -706,7 +706,7 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
az->y1 -= AZONESPOT;
az->y2 -= AZONESPOT;
}
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+ BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
}
}
@@ -753,7 +753,7 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
break;
}
/* rect needed for mouse pointer test */
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+ BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
@@ -798,7 +798,7 @@ static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
break;
}
/* rect needed for mouse pointer test */
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+ BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
#define AZONEPAD_TRIAW 16
@@ -843,7 +843,7 @@ static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
break;
}
/* rect needed for mouse pointer test */
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+ BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
@@ -911,7 +911,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
return;
/* no returns in function, winrct gets set in the end again */
- BLI_init_rcti(&ar->winrct, 0, 0, 0, 0);
+ BLI_rcti_init(&ar->winrct, 0, 0, 0, 0);
/* for test; allow split of previously defined region */
if (ar->alignment & RGN_SPLIT_PREV)
@@ -947,7 +947,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
else if (alignment == RGN_ALIGN_NONE) {
/* typically last region */
ar->winrct = *remainder;
- BLI_init_rcti(remainder, 0, 0, 0, 0);
+ BLI_rcti_init(remainder, 0, 0, 0, 0);
}
else if (alignment == RGN_ALIGN_TOP || alignment == RGN_ALIGN_BOTTOM) {
@@ -1007,7 +1007,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
remainder->xmin = ar->winrct.xmax + 1;
}
else {
- BLI_init_rcti(remainder, 0, 0, 0, 0);
+ BLI_rcti_init(remainder, 0, 0, 0, 0);
}
}
else {
@@ -1016,7 +1016,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
remainder->ymin = ar->winrct.ymax + 1;
}
else {
- BLI_init_rcti(remainder, 0, 0, 0, 0);
+ BLI_rcti_init(remainder, 0, 0, 0, 0);
}
}
}
@@ -1036,7 +1036,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
if (count != 4) {
/* let's stop adding regions */
- BLI_init_rcti(remainder, 0, 0, 0, 0);
+ BLI_rcti_init(remainder, 0, 0, 0, 0);
if (G.debug & G_DEBUG)
printf("region quadsplit failed\n");
}
@@ -1058,7 +1058,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
else { /* right top */
ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax) / 2;
ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax) / 2;
- BLI_init_rcti(remainder, 0, 0, 0, 0);
+ BLI_rcti_init(remainder, 0, 0, 0, 0);
}
quad++;
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index a638aac9423..48532c83e4c 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1219,7 +1219,7 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
ScrArea *sa;
for (sa = win->screen->areabase.first; sa; sa = sa->next)
- if ((az = is_in_area_actionzone(sa, event->x, event->y)))
+ if ((az = is_in_area_actionzone(sa, &event->x)))
break;
if (sa) {
@@ -1262,12 +1262,12 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
for (sa = scr->areabase.first; sa; sa = sa->next) {
if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
- if (NULL == is_in_area_actionzone(sa, event->x, event->y))
+ if (NULL == is_in_area_actionzone(sa, &event->x))
break;
}
if (sa) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (BLI_in_rcti(&ar->winrct, event->x, event->y))
+ if (BLI_in_rcti_v(&ar->winrct, &event->x))
scr->subwinactive = ar->swinid;
}
}
@@ -1314,7 +1314,7 @@ int ED_screen_area_active(const bContext *C)
ScrArea *sa = CTX_wm_area(C);
if (win && sc && sa) {
- AZone *az = is_in_area_actionzone(sa, win->eventstate->x, win->eventstate->y);
+ AZone *az = is_in_area_actionzone(sa, &win->eventstate->x);
ARegion *ar;
if (az && az->type == AZONE_REGION)
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index aa11c3eecdd..86d99777e98 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -54,7 +54,7 @@ void removenotused_scredges(bScreen *sc);
int scredge_is_horizontal(ScrEdge *se);
ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my);
-struct AZone *is_in_area_actionzone(ScrArea *sa, int x, int y);
+struct AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2]);
/* screen_context.c */
int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 6be276dea14..2391d6c909e 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -524,15 +524,15 @@ static int actionzone_area_poll(bContext *C)
return 0;
}
-AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
+AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2])
{
AZone *az = NULL;
for (az = sa->actionzones.first; az; az = az->next) {
- if (BLI_in_rcti(&az->rect, x, y)) {
+ if (BLI_in_rcti_v(&az->rect, xy)) {
if (az->type == AZONE_AREA) {
/* no triangle intersect but a hotspot circle based on corner */
- int radius = (x - az->x1) * (x - az->x1) + (y - az->y1) * (y - az->y1);
+ int radius = (xy[0] - az->x1) * (xy[0] - az->x1) + (xy[1] - az->y1) * (xy[1] - az->y1);
if (radius <= AZONESPOT * AZONESPOT)
break;
@@ -577,7 +577,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- AZone *az = is_in_area_actionzone(CTX_wm_area(C), event->x, event->y);
+ AZone *az = is_in_area_actionzone(CTX_wm_area(C), &event->x);
sActionzoneData *sad;
/* quick escape */
@@ -827,7 +827,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* adds window to WM */
rect = sa->totrct;
- BLI_translate_rcti(&rect, win->posx, win->posy);
+ BLI_rcti_translate(&rect, win->posx, win->posy);
newwin = WM_window_open(C, &rect);
/* allocs new screen and adds to newly created window, using window size */
@@ -3017,7 +3017,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
}
}
- /* next frame overriden by user action (pressed jump to first/last frame) */
+ /* next frame overridden by user action (pressed jump to first/last frame) */
if (sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
scene->r.cfra = sad->nextfra;
sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index f6c17c97758..073e60ca87c 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -560,14 +560,14 @@ static int project_bucket_offset(const ProjPaintState *ps, const float projCoSS[
* ps->bucketRect[x + (y*ps->buckets_y)] */
/* please explain?
- * projCoSS[0] - ps->screenMin[0] : zero origin
- * ... / ps->screen_width : range from 0.0 to 1.0
- * ... * ps->buckets_x : use as a bucket index
+ * projCoSS[0] - ps->screenMin[0] : zero origin
+ * ... / ps->screen_width : range from 0.0 to 1.0
+ * ... * ps->buckets_x : use as a bucket index
*
* Second multiplication does similar but for vertical offset
*/
- return ( (int)(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x)) +
- ( ( (int)(((projCoSS[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y)) * ps->buckets_x);
+ return ( (int)(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x)) +
+ (((int)(((projCoSS[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y)) * ps->buckets_x);
}
static int project_bucket_offset_safe(const ProjPaintState *ps, const float projCoSS[2])
@@ -583,7 +583,7 @@ static int project_bucket_offset_safe(const ProjPaintState *ps, const float proj
}
/* still use 2D X,Y space but this works for verts transformed by a perspective matrix, using their 4th component as a weight */
-static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4], float co[2], float w[3])
+static void barycentric_weights_v2_persp(const float v1[4], const float v2[4], const float v3[4], const float co[2], float w[3])
{
float wtot_inv, wtot;
@@ -603,13 +603,17 @@ static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4],
w[0] = w[1] = w[2] = 1.0f / 3.0f;
}
-static float VecZDepthOrtho(float pt[2], float v1[3], float v2[3], float v3[3], float w[3])
+static float VecZDepthOrtho(const float pt[2],
+ const float v1[3], const float v2[3], const float v3[3],
+ float w[3])
{
barycentric_weights_v2(v1, v2, v3, pt, w);
return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]);
}
-static float VecZDepthPersp(float pt[2], float v1[4], float v2[4], float v3[4], float w[3])
+static float VecZDepthPersp(const float pt[2],
+ const float v1[4], const float v2[4], const float v3[4],
+ float w[3])
{
float wtot_inv, wtot;
float w_tmp[3];
@@ -1611,7 +1615,7 @@ static int line_clip_rect2f(
if (fabsf(l1[0] - l2[0]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
- if (BLI_in_rctf(rect, l1[0], l1[1])) {
+ if (BLI_in_rctf_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2);
return 1;
@@ -1639,7 +1643,7 @@ static int line_clip_rect2f(
}
if (fabsf(l1[1] - l2[1]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
- if (BLI_in_rctf(rect, l1[0], l1[1])) {
+ if (BLI_in_rctf_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2);
return 1;
@@ -1663,12 +1667,12 @@ static int line_clip_rect2f(
/* Done with vertical lines */
/* are either of the points inside the rectangle ? */
- if (BLI_in_rctf(rect, l1[0], l1[1])) {
+ if (BLI_in_rctf_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
ok1 = 1;
}
- if (BLI_in_rctf(rect, l2[0], l2[1])) {
+ if (BLI_in_rctf_v(rect, l2)) {
copy_v2_v2(l2_clip, l2);
ok2 = 1;
}
@@ -1816,7 +1820,7 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
* this is even less work then an intersection test
*/
#if 0
- if (BLI_in_rctf(bucket_bounds, cent[0], cent[1]))
+ if (BLI_in_rctf_v(bucket_bounds, cent))
return 1;
#endif
@@ -1983,9 +1987,9 @@ static void project_bucket_clip_face(
float bucket_bounds_ss[4][2];
/* get the UV space bounding box */
- inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v1coSS[0], v1coSS[1]);
- inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v2coSS[0], v2coSS[1]) << 1;
- inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v3coSS[0], v3coSS[1]) << 2;
+ inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v1coSS);
+ inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v2coSS) << 1;
+ inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v3coSS) << 2;
if (inside_bucket_flag == ISECT_ALL3) {
/* all screenspace points are inside the bucket bounding box, this means we don't need to clip and can simply return the UVs */
@@ -2812,7 +2816,7 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
fidx = mf->v4 ? 3 : 2;
do {
v = ps->screenCoords[(*(&mf->v1 + fidx))];
- if (BLI_in_rctf(&bucket_bounds, v[0], v[1])) {
+ if (BLI_in_rctf_v(&bucket_bounds, v)) {
return 1;
}
} while (fidx--);
@@ -5237,7 +5241,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
pixel_size = size;
}
- /* fade out the brush (cheap trick to work around brush interfearing with sampling [#])*/
+ /* fade out the brush (cheap trick to work around brush interfering with sampling [#])*/
if (pixel_size < PX_SIZE_FADE_MIN) {
return;
}
@@ -5249,7 +5253,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
glTranslatef((float)x, (float)y, 0.0f);
- /* No need to scale for uv sculpting, on the contrary it might be useful to keep unscaled */
+ /* No need to scale for uv sculpting, on the contrary it might be useful to keep un-scaled */
if (use_zoom)
glScalef(zoomx, zoomy, 1.0f);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 7df6a893b5c..560174e73ae 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -604,7 +604,7 @@ void paint_partial_visibility_keys(wmKeyMap *keymap)
{
wmKeyMapItem *kmi;
- /* Partial visiblity */
+ /* Partial visibility */
kmi = WM_keymap_add_item(keymap, "PAINT_OT_hide_show", HKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "action", PARTIALVIS_SHOW);
RNA_enum_set(kmi->ptr, "area", PARTIALVIS_INSIDE);
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 082e40f8e4c..3f9e0051d2e 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -41,6 +41,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_rect.h"
#include "BKE_brush.h"
#include "BKE_context.h"
@@ -80,8 +81,7 @@ int paint_convert_bb_to_rect(rcti *rect,
float projection_mat[4][4];
int i, j, k;
- rect->xmin = rect->ymin = INT_MAX;
- rect->xmax = rect->ymax = INT_MIN;
+ BLI_rcti_init_minmax(rect);
/* return zero if the bounding box has non-positive volume */
if (bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2])
@@ -93,16 +93,19 @@ int paint_convert_bb_to_rect(rcti *rect,
for (j = 0; j < 2; ++j) {
for (k = 0; k < 2; ++k) {
float vec[3], proj[2];
+ int proj_i[2];
vec[0] = i ? bb_min[0] : bb_max[0];
vec[1] = j ? bb_min[1] : bb_max[1];
vec[2] = k ? bb_min[2] : bb_max[2];
/* convert corner to screen space */
ED_view3d_project_float_v2(ar, vec, proj, projection_mat);
/* expand 2D rectangle */
- rect->xmin = MIN2(rect->xmin, proj[0]);
- rect->xmax = MAX2(rect->xmax, proj[0]);
- rect->ymin = MIN2(rect->ymin, proj[1]);
- rect->ymax = MAX2(rect->ymax, proj[1]);
+
+ /* we could project directly to int? */
+ proj_i[0] = proj[0];
+ proj_i[1] = proj[1];
+
+ BLI_rcti_do_minmax_v(rect, proj_i);
}
}
}
@@ -284,7 +287,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
/* the triangle with the largest absolute values is the one
* with the most negative weights */
imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[3].co, p, w);
- absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
+ absw = fabsf(w[0]) + fabsf(w[1]) + fabsf(w[2]);
if (absw < minabsw) {
uv[0] = tf->uv[0][0] * w[0] + tf->uv[1][0] * w[1] + tf->uv[3][0] * w[2];
uv[1] = tf->uv[0][1] * w[0] + tf->uv[1][1] * w[1] + tf->uv[3][1] * w[2];
@@ -292,7 +295,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
}
imapaint_tri_weights(ob, mv[1].co, mv[2].co, mv[3].co, p, w);
- absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
+ absw = fabsf(w[0]) + fabsf(w[1]) + fabsf(w[2]);
if (absw < minabsw) {
uv[0] = tf->uv[1][0] * w[0] + tf->uv[2][0] * w[1] + tf->uv[3][0] * w[2];
uv[1] = tf->uv[1][1] * w[0] + tf->uv[2][1] * w[1] + tf->uv[3][1] * w[2];
@@ -301,7 +304,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
}
else {
imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[2].co, p, w);
- absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
+ absw = fabsf(w[0]) + fabsf(w[1]) + fabsf(w[2]);
if (absw < minabsw) {
uv[0] = tf->uv[0][0] * w[0] + tf->uv[1][0] * w[1] + tf->uv[2][0] * w[2];
uv[1] = tf->uv[0][1] * w[0] + tf->uv[1][1] * w[1] + tf->uv[2][1] * w[2];
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index bfac2922c2b..35d508c5a1f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -369,7 +369,7 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
ss = ob->sculpt;
if (ss->cache) {
if (!BLI_rcti_is_empty(&ss->cache->previous_r))
- BLI_union_rcti(rect, &ss->cache->previous_r);
+ BLI_rcti_union(rect, &ss->cache->previous_r);
}
return 1;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 9d1f52568b4..86d74ef4c78 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -62,6 +62,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "UI_view2d.h"
@@ -239,12 +240,12 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
strncpy(path, U.textudir, sizeof(path));
}
+ if (RNA_struct_property_is_set(op->ptr, "files"))
+ return open_exec(C, op);
+
if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
- if (RNA_struct_property_is_set(op->ptr, "filepath"))
- return open_exec(C, op);
-
open_init(C, op);
clip_filesel(C, op, path);
@@ -1074,15 +1075,8 @@ static int mode_set_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
int mode = RNA_enum_get(op->ptr, "mode");
- int toggle = RNA_boolean_get(op->ptr, "toggle");
- if (sc->mode == mode) {
- if (toggle)
- sc->mode = SC_MODE_TRACKING;
- }
- else {
- sc->mode = mode;
- }
+ sc->mode = mode;
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CLIP, NULL);
@@ -1091,13 +1085,6 @@ static int mode_set_exec(bContext *C, wmOperator *op)
void CLIP_OT_mode_set(wmOperatorType *ot)
{
- static EnumPropertyItem mode_items[] = {
- {SC_MODE_TRACKING, "TRACKING", 0, "Tracking", "Show tracking and solving tools"},
- {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", 0, "Reconstruction", "Show tracking/reconstruction tools"},
- {SC_MODE_DISTORTION, "DISTORTION", 0, "Distortion", "Show distortion tools"},
- {0, NULL, 0, NULL, NULL}};
-
-
/* identifiers */
ot->name = "Set Clip Mode";
ot->description = "Set the clip interaction mode";
@@ -1109,8 +1096,7 @@ void CLIP_OT_mode_set(wmOperatorType *ot)
ot->poll = ED_space_clip_poll;
/* properties */
- RNA_def_enum(ot->srna, "mode", mode_items, SC_MODE_TRACKING, "Mode", "");
- RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "");
+ RNA_def_enum(ot->srna, "mode", clip_editor_mode_items, SC_MODE_TRACKING, "Mode", "");
}
/********************** macroses *********************/
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 0a6a4af6960..3623cd1d58b 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -559,13 +559,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "sequence", TRUE);
/* mode */
- kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
- RNA_enum_set(kmi->ptr, "mode", SC_MODE_RECONSTRUCTION);
- RNA_boolean_set(kmi->ptr, "toggle", TRUE);
-
- kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
- RNA_enum_set(kmi->ptr, "mode", SC_MODE_DISTORTION);
- RNA_boolean_set(kmi->ptr, "toggle", TRUE);
+ WM_keymap_add_menu(keymap, "CLIP_MT_select_mode", TABKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CLIP_OT_solve_camera", SKEY, KM_PRESS, KM_SHIFT, 0);
@@ -792,8 +786,16 @@ static int clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(eve
static void clip_drop_copy(wmDrag *drag, wmDropBox *drop)
{
- /* copy drag path to properties */
- RNA_string_set(drop->ptr, "filepath", drag->path);
+ PointerRNA itemptr;
+ char dir[FILE_MAX], file[FILE_MAX];
+
+ BLI_split_dirfile(drag->path, dir, file, sizeof(dir), sizeof(file));
+
+ RNA_string_set(drop->ptr, "directory", dir);
+
+ RNA_collection_clear(drop->ptr, "files");
+ RNA_collection_add(drop->ptr, "files", &itemptr);
+ RNA_string_set(&itemptr, "name", file);
}
/* area+region dropbox definition */
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index 0ebb84b3953..0d933c1dff3 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -361,7 +361,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
if (MARKER_VISIBLE(sc, track, marker)) {
- if (BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
+ if (BLI_in_rctf_v(&rectf, marker->pos)) {
if (mode == GESTURE_MODAL_SELECT)
BKE_tracking_track_flag_set(track, TRACK_AREA_ALL, SELECT);
else
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 2d778b94216..6856ce996e7 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -81,7 +81,7 @@ static FileSelection find_file_mouse_rect(SpaceFile *sfile, struct ARegion *ar,
UI_view2d_region_to_view(v2d, rect->xmin, rect->ymin, &fxmin, &fymin);
UI_view2d_region_to_view(v2d, rect->xmax, rect->ymax, &fxmax, &fymax);
- BLI_init_rcti(&rect_view, (int)(v2d->tot.xmin + fxmin), (int)(v2d->tot.xmin + fxmax), (int)(v2d->tot.ymax - fymin), (int)(v2d->tot.ymax - fymax));
+ BLI_rcti_init(&rect_view, (int)(v2d->tot.xmin + fxmin), (int)(v2d->tot.xmin + fxmax), (int)(v2d->tot.ymax - fymin), (int)(v2d->tot.ymax - fymax));
sel = ED_fileselect_layout_offset_rect(sfile->layout, &rect_view);
@@ -248,7 +248,7 @@ static int file_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
rect.xmax = RNA_int_get(op->ptr, "xmax");
rect.ymax = RNA_int_get(op->ptr, "ymax");
- BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
+ BLI_rcti_isect(&(ar->v2d.mask), &rect, &rect);
sel = file_selection_get(C, &rect, 0);
if ( (sel.first != params->sel_first) || (sel.last != params->sel_last) ) {
@@ -288,7 +288,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
file_deselect_all(sfile, SELECTED_FILE);
}
- BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
+ BLI_rcti_isect(&(ar->v2d.mask), &rect, &rect);
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, 0);
if (FILE_SELECT_DIR == ret) {
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 116e155f501..7d358bcfb8b 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -106,36 +106,36 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf,
if (ima == NULL) return;
if (ibuf == NULL) {
- ofs += sprintf(str, IFACE_("Can't Load Image"));
+ ofs += sprintf(str, "%s", IFACE_("Can't Load Image"));
}
else {
if (ima->source == IMA_SRC_MOVIE) {
- ofs += sprintf(str, IFACE_("Movie"));
+ ofs += sprintf(str, "%s", IFACE_("Movie"));
if (ima->anim)
ofs += sprintf(str + ofs, IFACE_("%d frs"), IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN));
}
else
- ofs += sprintf(str, IFACE_("Image"));
+ ofs += sprintf(str, "%s", IFACE_("Image"));
- ofs += sprintf(str + ofs, IFACE_(": size %d x %d,"), ibuf->x, ibuf->y);
+ ofs += sprintf(str + ofs, ": %s %d x %d,", IFACE_("size"), ibuf->x, ibuf->y);
if (ibuf->rect_float) {
if (ibuf->channels != 4) {
- ofs += sprintf(str + ofs, IFACE_("%d float channel(s)"), ibuf->channels);
+ ofs += sprintf(str + ofs, "%d %s", ibuf->channels, IFACE_("float channel(s)"));
}
else if (ibuf->planes == R_IMF_PLANES_RGBA)
- ofs += sprintf(str + ofs, IFACE_(" RGBA float"));
+ ofs += sprintf(str + ofs, "%s", IFACE_(" RGBA float"));
else
- ofs += sprintf(str + ofs, IFACE_(" RGB float"));
+ ofs += sprintf(str + ofs, "%s", IFACE_(" RGB float"));
}
else {
if (ibuf->planes == R_IMF_PLANES_RGBA)
- ofs += sprintf(str + ofs, IFACE_(" RGBA byte"));
+ ofs += sprintf(str + ofs, "%s", IFACE_(" RGBA byte"));
else
- ofs += sprintf(str + ofs, IFACE_(" RGB byte"));
+ ofs += sprintf(str + ofs, "%s", IFACE_(" RGB byte"));
}
if (ibuf->zbuf || ibuf->zbuf_float)
- ofs += sprintf(str + ofs, IFACE_(" + Z"));
+ ofs += sprintf(str + ofs, "%s", IFACE_(" + Z"));
if (ima->source == IMA_SRC_SEQUENCE) {
char *file = BLI_last_slash(ibuf->name);
@@ -276,11 +276,11 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
/* while dragging we need to update the rects, otherwise it doesn't end with correct one */
- BLI_init_rctf(&dispf, 15.0f, (block->maxx - block->minx) - 15.0f, 15.0f, (block->maxy - block->miny) - 15.0f);
+ BLI_rctf_init(&dispf, 15.0f, (block->maxx - block->minx) - 15.0f, 15.0f, (block->maxy - block->miny) - 15.0f);
ui_graphics_to_window_rct(sa->win, &dispf, disprect);
/* correction for gla draw */
- BLI_translate_rcti(disprect, -curarea->winrct.xmin, -curarea->winrct.ymin);
+ BLI_rcti_translate(disprect, -curarea->winrct.xmin, -curarea->winrct.ymin);
calc_image_view(sima, 'p');
// printf("winrct %d %d %d %d\n", disprect->xmin, disprect->ymin,disprect->xmax, disprect->ymax);
@@ -381,11 +381,11 @@ static char *layer_menu(RenderResult *rr, short *UNUSED(curlay))
/* compo result */
if (rr->rectf) {
- a += sprintf(str + a, IFACE_("|Composite %%x0"));
+ a += sprintf(str + a, "|%s %%x0", IFACE_("Composite"));
nr = 1;
}
else if (rr->rect32) {
- a += sprintf(str + a, IFACE_("|Sequence %%x0"));
+ a += sprintf(str + a, "|%s %%x0", IFACE_("Sequence"));
nr = 1;
}
for (rl = rr->layers.first; rl; rl = rl->next, nr++) {
@@ -410,7 +410,7 @@ static char *pass_menu(RenderLayer *rl, short *curpass)
/* rendered results don't have a Combined pass */
if (rl == NULL || rl->rectf) {
- a += sprintf(str + a, IFACE_("|Combined %%x0"));
+ a += sprintf(str + a, "|%s %%x0", IFACE_("Combined"));
nr = 1;
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index ac71eb972f6..cf78eaabd88 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -728,11 +728,21 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
/* retrieve the image and information about it */
ima = ED_space_image(sima);
ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
- ibuf = ED_space_image_acquire_buffer(sima, &lock);
show_viewer = (ima && ima->source == IMA_SRC_VIEWER);
show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT);
+ if (show_viewer) {
+ /* use locked draw for drawing viewer image buffer since the conpositor
+ * is running in separated thread and compositor could free this buffers.
+ * other images are not modifying in such a way so they does not require
+ * lock (sergey)
+ */
+ BLI_lock_thread(LOCK_DRAW_IMAGE);
+ }
+
+ ibuf = ED_space_image_acquire_buffer(sima, &lock);
+
/* draw the image or grid */
if (ibuf == NULL)
ED_region_grid_draw(ar, zoomx, zoomy);
@@ -767,8 +777,11 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
ED_space_image_release_buffer(sima, lock);
+ if (show_viewer) {
+ BLI_unlock_thread(LOCK_DRAW_IMAGE);
+ }
+
/* render info */
if (ima && show_render)
draw_render_info(scene, ima, ar);
}
-
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index 8c3397b9ddd..2d926a50f98 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -31,6 +31,7 @@ set(INC
../../nodes
../../render/extern/include
../../windowmanager
+ ../../compositor
../../../../intern/guardedalloc
../../../../intern/opennl/extern
)
@@ -58,4 +59,8 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+if(WITH_COMPOSITOR)
+ add_definitions(-DWITH_COMPOSITOR)
+endif()
+
blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_node/SConscript b/source/blender/editors/space_node/SConscript
index 2dee750f8c0..7e311b1329d 100644
--- a/source/blender/editors/space_node/SConscript
+++ b/source/blender/editors/space_node/SConscript
@@ -4,7 +4,7 @@ Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
-incs += ' ../../nodes ../../render/extern/include ../../blenloader ../../gpu'
+incs += ' ../../nodes ../../render/extern/include ../../blenloader ../../gpu ../../compositor'
incs += ' ../../windowmanager #intern/guardedalloc #extern/glew/include'
defs = []
cf = []
@@ -25,4 +25,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
+if env['WITH_BF_COMPOSITOR']:
+ defs.append("WITH_COMPOSITOR")
+
env.BlenderLib ( 'bf_editors_space_node', sources, Split(incs), defs, libtype=['core'], priority=[55], compileflags=cf )
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index cc0298a7ebb..134b2d6fd99 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -27,9 +27,9 @@
/** \file blender/editors/space_node/drawnode.c
* \ingroup spnode
+ * \brief lower level node drawing for nodes (boarders, headers etc), also node layout.
*/
-
#include <math.h>
#include <stdio.h>
#include <string.h>
@@ -52,6 +52,7 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_node.h"
+#include "BKE_tracking.h"
#include "BLF_api.h"
#include "BLF_translation.h"
@@ -82,7 +83,7 @@
#include "node_intern.h"
-// XXX interface.h
+/* XXX interface.h */
extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
/* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
@@ -140,7 +141,8 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v)
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
- layout = uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, args->x, args->y + 2, args->width, NODE_DY, UI_GetStyle()), FALSE);
+ layout = uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
+ args->x, args->y + 2, args->width, NODE_DY, UI_GetStyle()), FALSE);
uiItemR(layout, &args->ptr, "default_value", UI_ITEM_R_EXPAND, "", ICON_NONE);
@@ -302,14 +304,17 @@ static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr
static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
- uiLayout *row;
+ uiLayout *row, *col;
bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- row = uiLayoutRow(layout, TRUE);
+ col = uiLayoutColumn(layout, FALSE);
+ row = uiLayoutRow(col, TRUE);
uiItemR(row, ptr, "blend_type", 0, "", ICON_NONE);
if (ntree->type == NTREE_COMPOSIT)
uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA);
+
+ uiItemR(col, ptr, "use_clamp", 0, NULL, ICON_NONE);
}
static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -344,7 +349,7 @@ static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA
uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0);
}
-static float _sample_col[4]; // bad bad, 2.5 will do better?
+static float _sample_col[4]; /* bad bad, 2.5 will do better?... no it won't... */
#define SAMPLE_FLT_ISNONE FLT_MAX
void ED_node_sample_set(const float col[4])
{
@@ -396,7 +401,7 @@ static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *
nor, 0.0f, 1.0f, 0, 0, "");
uiButSetFunc(bt, node_normal_cb, ntree, node);
}
-#if 0 // not used in 2.5x yet
+#if 0 /* not used in 2.5x yet */
static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
{
Main *bmain = CTX_data_main(C);
@@ -451,6 +456,7 @@ static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA
static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
+ uiItemR(layout, ptr, "use_clamp", 0, NULL, ICON_NONE);
}
static int node_resize_area_default(bNode *node, int x, int y)
@@ -517,7 +523,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
counter = 0;
}
else
- BLI_union_rctf(rect, &node->totr);
+ BLI_rctf_union(rect, &node->totr);
}
/* add some room for links to group sockets */
@@ -649,7 +655,8 @@ static void update_group_output_cb(bContext *UNUSED(C), void *UNUSED(snode_v), v
ntreeUpdateTree(ngroup);
}
-static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *sock, int in_out, float xoffset, float yoffset)
+static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *sock,
+ int in_out, float xoffset, float yoffset)
{
bNodeTree *ngroup = (bNodeTree *)gnode->id;
uiBut *bt;
@@ -671,7 +678,8 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *
}
}
-static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *ntree, bNode *gnode, bNodeSocket *sock, bNodeSocket *gsock, int index, int in_out)
+static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *ntree, bNode *gnode,
+ bNodeSocket *sock, bNodeSocket *gsock, int index, int in_out)
{
bNodeTree *ngroup = (bNodeTree *)gnode->id;
bNodeSocketType *stype = ntreeGetSocketType(gsock ? gsock->type : sock->type);
@@ -721,12 +729,14 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt
if (gsock) {
draw_group_socket_name(snode, gnode, gsock, in_out, offset, 0);
if (stype->buttonfunc)
- stype->buttonfunc(C, gnode->block, ngroup, NULL, gsock, "", gsock->locx + offset, gsock->locy - NODE_DY, colw);
+ stype->buttonfunc(C, gnode->block, ngroup, NULL, gsock, "",
+ gsock->locx + offset, gsock->locy - NODE_DY, colw);
}
else {
draw_group_socket_name(snode, gnode, sock, in_out, offset, 0);
if (stype->buttonfunc)
- stype->buttonfunc(C, gnode->block, ngroup, NULL, sock, "", sock->locx + offset, sock->locy - NODE_DY, colw);
+ stype->buttonfunc(C, gnode->block, ngroup, NULL, sock, "",
+ sock->locx + offset, sock->locy - NODE_DY, colw);
}
}
else {
@@ -780,8 +790,9 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiLayout *layout;
PointerRNA ptr;
rctf rect = gnode->totr;
- float node_group_frame = U.dpi * NODE_GROUP_FRAME / 72;
- float group_header = 26 * U.dpi / 72;
+ const float dpi_fac = U.dpi / 72.0f;
+ float node_group_frame = NODE_GROUP_FRAME * dpi_fac;
+ float group_header = 26 * dpi_fac;
int index;
@@ -789,7 +800,9 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
glEnable(GL_BLEND);
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70);
- uiDrawBox(GL_POLYGON, rect.xmin - node_group_frame, rect.ymax, rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD);
+ uiDrawBox(GL_POLYGON,
+ rect.xmin - node_group_frame, rect.ymax,
+ rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD);
/* backdrop body */
UI_ThemeColorShadeAlpha(TH_BACK, -8, -70);
@@ -824,7 +837,9 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiSetRoundBox(UI_CNR_ALL);
glColor4ub(200, 200, 200, 140);
glEnable(GL_LINE_SMOOTH);
- uiDrawBox(GL_LINE_LOOP, rect.xmin - node_group_frame, rect.ymin, rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD);
+ uiDrawBox(GL_LINE_LOOP,
+ rect.xmin - node_group_frame, rect.ymin,
+ rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
@@ -832,7 +847,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
UI_ThemeColor(TH_TEXT_HI);
layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
- (int)(rect.xmin + NODE_MARGIN_X), (int)(rect.ymax + group_header),
+ (int)(rect.xmin + NODE_MARGIN_X), (int)(rect.ymax + (group_header - (2.5f * dpi_fac))),
MIN2((int)(rect.xmax - rect.xmin - 18.0f), node_group_frame + 20), group_header, UI_GetStyle());
RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr);
uiTemplateIDBrowse(layout, (bContext *)C, &ptr, "node_tree", NULL, NULL, NULL);
@@ -939,7 +954,7 @@ static void node_update_frame(const bContext *UNUSED(C), bNodeTree *ntree, bNode
data->flag &= ~NODE_FRAME_RESIZEABLE;
}
else
- BLI_union_rctf(&rect, &noderect);
+ BLI_rctf_union(&rect, &noderect);
}
/* now adjust the frame size from view-space bounding box */
@@ -954,17 +969,15 @@ static void node_update_frame(const bContext *UNUSED(C), bNodeTree *ntree, bNode
static void node_draw_frame_label(bNode *node, const float aspect)
{
/* XXX font id is crap design */
- const int fontid = blf_mono_font;
+ const int fontid = UI_GetStyle()->widgetlabel.uifont_id;
NodeFrame *data = (NodeFrame *)node->storage;
rctf *rct = &node->totr;
int color_id = node_get_colorid(node);
- char label[128];
+ const char *label = nodeLabel(node);
/* XXX a bit hacky, should use separate align values for x and y */
float width, ascender;
float x, y;
const int font_size = data->label_size / aspect;
-
- BLI_strncpy(label, nodeLabel(node), sizeof(label));
BLF_enable(fontid, BLF_ASPECT);
BLF_aspect(fontid, aspect, aspect, 1.0f);
@@ -978,8 +991,8 @@ static void node_draw_frame_label(bNode *node, const float aspect)
/* 'x' doesn't need aspect correction */
x = 0.5f * (rct->xmin + rct->xmax) - 0.5f * width;
- y = rct->ymax - NODE_DYS - (ascender * aspect);
-
+ y = rct->ymax - (((NODE_DY / 4) / aspect) + (ascender * aspect));
+
BLF_position(fontid, x, y, 0);
BLF_draw(fontid, label, BLF_DRAW_STR_DUMMY_MAX);
@@ -993,9 +1006,6 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, bN
unsigned char color[4];
float alpha;
- UI_GetThemeColor4ubv(TH_NODE_FRAME, color);
- alpha = (float)(color[3]) / 255.0f;
-
/* skip if out of view */
if (node->totr.xmax < ar->v2d.cur.xmin || node->totr.xmin > ar->v2d.cur.xmax ||
node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax) {
@@ -1004,6 +1014,9 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, bN
node->block = NULL;
return;
}
+
+ UI_GetThemeColor4ubv(TH_NODE_FRAME, color);
+ alpha = (float)(color[3]) / 255.0f;
/* shadow */
node_draw_shadow(snode, node, BASIS_RAD, alpha);
@@ -1028,7 +1041,9 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, bN
else
UI_ThemeColorShadeAlpha(TH_SELECT, 0, -40);
uiSetRoundBox(UI_CNR_ALL);
- uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD);
+ uiDrawBox(GL_LINE_LOOP,
+ rct->xmin, rct->ymin,
+ rct->xmax, rct->ymax, BASIS_RAD);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
@@ -1074,7 +1089,7 @@ static void node_buts_frame_details(uiLayout *layout, bContext *UNUSED(C), Point
}
-#define NODE_REROUTE_SIZE 8.0f
+#define NODE_REROUTE_SIZE 8.0f
static void node_update_reroute(const bContext *UNUSED(C), bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -1094,7 +1109,7 @@ static void node_update_reroute(const bContext *UNUSED(C), bNodeTree *UNUSED(ntr
nsock->locx = locx;
nsock->locy = locy;
- node->width = size * 2.0f;
+ node->width = size * 2;
node->totr.xmin = locx - size;
node->totr.xmax = locx + size;
node->totr.ymax = locy + size;
@@ -1104,16 +1119,16 @@ static void node_update_reroute(const bContext *UNUSED(C), bNodeTree *UNUSED(ntr
static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(snode), bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
- #if 0 /* UNUSED */
+#if 0 /* UNUSED */
rctf *rct = &node->totr;
float size = NODE_REROUTE_SIZE;
- #endif
+#endif
float socket_size = NODE_SOCKSIZE;
/* skip if out of view */
if (node->totr.xmax < ar->v2d.cur.xmin || node->totr.xmin > ar->v2d.cur.xmax ||
- node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax)
- {
+ node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax) {
+
uiEndBlock(C, node->block);
node->block = NULL;
return;
@@ -1164,7 +1179,7 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
static int node_tweak_area_reroute(bNode *node, int x, int y)
{
/* square of tweak radius */
- static const float tweak_radius_sq = 576; /* 24*24 */
+ static const float tweak_radius_sq = 576; /* 24 * 24 */
bNodeSocket *sock = node->inputs.first;
float dx = sock->locx - x;
@@ -1206,7 +1221,8 @@ static void node_common_set_butfunc(bNodeType *ntype)
/* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */
-static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr, PointerRNA *imaptr, PointerRNA *iuserptr)
+static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr,
+ PointerRNA *imaptr, PointerRNA *iuserptr)
{
uiLayout *col;
int source;
@@ -1512,12 +1528,19 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col, *row;
+ int reference;
+ int filter;
col = uiLayoutColumn(layout, FALSE);
-
+ filter = RNA_enum_get(ptr, "filter_type");
+ reference = RNA_boolean_get(ptr, "use_reference");
+
uiItemR(col, ptr, "filter_type", 0, "", ICON_NONE);
- if (RNA_enum_get(ptr, "filter_type") != R_FILTER_FAST_GAUSS) {
- uiItemR(col, ptr, "use_bokeh", 0, NULL, ICON_NONE);
+ if (filter != R_FILTER_FAST_GAUSS) {
+ uiItemR(col, ptr, "use_reference", 0, NULL, ICON_NONE);
+ if (!reference) {
+ uiItemR(col, ptr, "use_bokeh", 0, NULL, ICON_NONE);
+ }
uiItemR(col, ptr, "use_gamma_correction", 0, NULL, ICON_NONE);
}
@@ -1950,7 +1973,8 @@ static void node_draw_input_file_output(const bContext *C, uiBlock *block,
imfptr = RNA_pointer_get(&inputptr, "format");
imtype_prop = RNA_struct_find_property(&imfptr, "file_format");
- RNA_property_enum_name((bContext *)C, &imfptr, imtype_prop, RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name);
+ RNA_property_enum_name((bContext *)C, &imfptr, imtype_prop,
+ RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name);
uiBlockSetEmboss(block, UI_EMBOSSP);
uiItemL(row, imtype_name, 0);
uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -1988,19 +2012,23 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
/* using different collection properties if multilayer format is enabled */
if (multilayer) {
uiTemplateList(layout, C, ptr, "layer_slots", ptr, "active_input_index", NULL, 0, 0, 0);
- RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"), active_index, &active_input_ptr);
+ RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"),
+ active_index, &active_input_ptr);
}
else {
uiTemplateList(layout, C, ptr, "file_slots", ptr, "active_input_index", NULL, 0, 0, 0);
- RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_slots"), active_index, &active_input_ptr);
+ RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_slots"),
+ active_index, &active_input_ptr);
}
/* XXX collection lookup does not return the ID part of the pointer, setting this manually here */
active_input_ptr.id.data = ptr->id.data;
row = uiLayoutRow(layout, TRUE);
- op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", ICON_TRIA_UP, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "",
+ ICON_TRIA_UP, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&op_ptr, "direction", 1);
- op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", ICON_TRIA_DOWN, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "",
+ ICON_TRIA_DOWN, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&op_ptr, "direction", 2);
if (active_input_ptr.data) {
@@ -2011,7 +2039,8 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
uiItemL(col, IFACE_("Layer:"), 0);
row = uiLayoutRow(col, FALSE);
uiItemR(row, &active_input_ptr, "name", 0, "", 0);
- uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
+ uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "",
+ ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
}
else {
uiLayout *row, *col;
@@ -2020,7 +2049,8 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
uiItemL(col, IFACE_("File Path:"), 0);
row = uiLayoutRow(col, FALSE);
uiItemR(row, &active_input_ptr, "path", 0, "", 0);
- uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
+ uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "",
+ ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
/* format details for individual files */
imfptr = RNA_pointer_get(&active_input_ptr, "format");
@@ -2491,6 +2521,7 @@ static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), Poi
uiItemR(layout, ptr, "blur_pre", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "screen_balance", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "despill_factor", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "despill_balance", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "edge_kernel_radius", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "edge_kernel_tolerance", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "clip_black", 0, NULL, ICON_NONE);
@@ -2501,6 +2532,41 @@ static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), Poi
uiItemR(layout, ptr, "blur_post", 0, NULL, ICON_NONE);
}
+static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ bNode *node= ptr->data;
+
+ uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL);
+
+ if (node->id) {
+ MovieClip *clip = (MovieClip *) node->id;
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingObject *object;
+ uiLayout *col;
+ PointerRNA tracking_ptr;
+ NodeTrackPosData *data = node->storage;
+
+ RNA_pointer_create(&clip->id, &RNA_MovieTracking, tracking, &tracking_ptr);
+
+ col = uiLayoutColumn(layout, 0);
+ uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA);
+
+ object = BKE_tracking_object_get_named(tracking, data->tracking_object);
+ if (object) {
+ PointerRNA object_ptr;
+
+ RNA_pointer_create(&clip->id, &RNA_MovieTrackingObject, object, &object_ptr);
+
+ uiItemPointerR(col, ptr, "track_name", &object_ptr, "tracks", "", ICON_ANIM_DATA);
+ }
+ else {
+ uiItemR(layout, ptr, "track_name", 0, "", ICON_ANIM_DATA);
+ }
+
+ uiItemR(layout, ptr, "use_relative", 0, NULL, ICON_NONE);
+ }
+}
+
/* only once called */
static void node_composit_set_butfunc(bNodeType *ntype)
{
@@ -2699,6 +2765,9 @@ static void node_composit_set_butfunc(bNodeType *ntype)
case CMP_NODE_KEYING:
ntype->uifunc = node_composit_buts_keying;
break;
+ case CMP_NODE_TRACKPOS:
+ ntype->uifunc = node_composit_buts_trackpos;
+ break;
default:
ntype->uifunc = NULL;
}
@@ -2767,7 +2836,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe
row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "noise_basis_2", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
row = uiLayoutRow(col, FALSE);
- uiLayoutSetActive(row, !(RNA_enum_get(&tex_ptr, "wood_type") == TEX_BAND || RNA_enum_get(&tex_ptr, "wood_type") == TEX_RING));
+ uiLayoutSetActive(row, !(ELEM(tex->stype, TEX_BAND, TEX_RING)));
uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
break;
@@ -2979,7 +3048,8 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
glPixelZoom(snode->zoom, snode->zoom);
/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
- glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ((unsigned char *)ibuf->rect) + ofs);
+ glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT,
+ ((unsigned char *)ibuf->rect) + ofs);
glPixelZoom(1.0f, 1.0f);
}
@@ -3015,7 +3085,7 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
}
}
- /// @note draw selected info on backdrop
+ /** @note draw selected info on backdrop */
if (snode->edittree) {
bNode *node = snode->edittree->nodes.first;
while (node) {
@@ -3151,13 +3221,18 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
vec[2][0] = vec[3][0] - dist;
vec[2][1] = vec[3][1];
}
- if (v2d && MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) ; /* clipped */
- else if (v2d && MAX4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) ; /* clipped */
+ if (v2d && MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) {
+ /* clipped */
+ }
+ else if (v2d && MAX4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) {
+ /* clipped */
+ }
else {
-
/* always do all three, to prevent data hanging around */
- BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float) * 2);
- BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float) * 2);
+ BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0],
+ coord_array[0] + 0, resol, sizeof(float) * 2);
+ BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1],
+ coord_array[0] + 1, resol, sizeof(float) * 2);
return 1;
}
@@ -3166,8 +3241,9 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
#define LINK_RESOL 24
#define LINK_ARROW 12 /* position of arrow on the link, LINK_RESOL/2 */
-#define ARROW_SIZE 7
-void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3)
+#define ARROW_SIZE 7
+void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
+ int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3)
{
float coord_array[LINK_RESOL + 1][2];
@@ -3185,7 +3261,9 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
glEnable(GL_LINE_SMOOTH);
- drawarrow = (link->tonode && (link->tonode->type == NODE_REROUTE)) && (link->fromnode && (link->fromnode->type == NODE_REROUTE));
+ drawarrow = ((link->tonode && (link->tonode->type == NODE_REROUTE)) &&
+ (link->fromnode && (link->fromnode->type == NODE_REROUTE)));
+
if (drawarrow) {
/* draw arrow in line segment LINK_ARROW */
float d_xy[2], len;
@@ -3262,6 +3340,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
}
}
+#if 0 /* not used in 2.5x yet */
static void node_link_straight_points(View2D *UNUSED(v2d), SpaceNode *snode, bNodeLink *link, float coord_array[][2])
{
if (link->fromsock) {
@@ -3284,7 +3363,8 @@ static void node_link_straight_points(View2D *UNUSED(v2d), SpaceNode *snode, bNo
}
}
-void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3)
+void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link,
+ int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3)
{
float coord_array[2][2];
float linew;
@@ -3319,11 +3399,13 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int
for (i = 0; i < LINK_RESOL - 1; ++i) {
float t = (float)i / (float)(LINK_RESOL - 1);
UI_ThemeColorBlend(th_col1, th_col2, t);
- glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0], (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]);
+ glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0],
+ (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]);
t = (float)(i + 1) / (float)(LINK_RESOL - 1);
UI_ThemeColorBlend(th_col1, th_col2, t);
- glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0], (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]);
+ glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0],
+ (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]);
}
glEnd();
}
@@ -3331,7 +3413,8 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int
glBegin(GL_LINE_STRIP);
for (i = 0; i < LINK_RESOL; ++i) {
float t = (float)i / (float)(LINK_RESOL - 1);
- glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0], (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]);
+ glVertex2f((1.0f - t) * coord_array[0][0] + t * coord_array[1][0],
+ (1.0f - t) * coord_array[0][1] + t * coord_array[1][1]);
}
glEnd();
}
@@ -3341,6 +3424,7 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int
/* restore previuos linewidth */
glLineWidth(linew);
}
+#endif
/* note; this is used for fake links in groups too */
void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link)
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 2b700876c62..8c9f057efc1 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -26,9 +26,9 @@
/** \file blender/editors/space_node/node_draw.c
* \ingroup spnode
+ * \brief higher level node drawing for the node editor.
*/
-
#include <math.h>
#include <stdio.h>
#include <string.h>
@@ -80,10 +80,11 @@
#include "intern/node_util.h"
#include "node_intern.h"
+#include "COM_compositor.h"
/* width of socket columns in group display */
#define NODE_GROUP_FRAME 120
-// XXX interface.h
+/* XXX interface.h */
extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
/* XXX update functions for node editor are a mess, needs a clear concept */
@@ -334,9 +335,6 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
/* preview rect? */
if (node->flag & NODE_PREVIEW) {
- /* only recalculate size when there's a preview actually, otherwise we use stored result */
- BLI_lock_thread(LOCK_PREVIEW);
-
if (node->preview && node->preview->rect) {
float aspect = 1.0f;
@@ -349,7 +347,8 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
if (aspect <= 1.0f)
node->prvr.ymin = dy - aspect * (node->width - NODE_DY);
else {
- float dx = (node->width - NODE_DYS) - (node->width - NODE_DYS) / aspect; /* width correction of image */
+ /* width correction of image */
+ float dx = (node->width - NODE_DYS) - (node->width - NODE_DYS) / aspect;
node->prvr.ymin = dy - (node->width - NODE_DY);
@@ -372,8 +371,6 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
node->prvr.ymin = dy - oldh;
dy = node->prvr.ymin - NODE_DYS / 2;
}
-
- BLI_unlock_thread(LOCK_PREVIEW);
}
/* buttons rect? */
@@ -724,12 +721,14 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
if (node->flag & NODE_MUTED)
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
+#ifdef WITH_COMPOSITOR
if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) {
- if (node->highlight) {
+ if (COM_isHighlightedbNode(node)) {
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
- node->highlight = 0;
}
}
+#endif
+
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
uiRoundBox(rct->xmin, rct->ymax - NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
@@ -776,7 +775,8 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* XXX button uses a custom triangle draw below, so make it invisible without icon */
uiBlockSetEmboss(node->block, UI_EMBOSSN);
but = uiDefBut(node->block, TOGBUT, B_REDR, "",
- rct->xmin + 10.0f - but_size / 2, rct->ymax - NODE_DY / 2.0f - but_size / 2, but_size, but_size, NULL, 0, 0, 0, 0, "");
+ rct->xmin + 10.0f - but_size / 2, rct->ymax - NODE_DY / 2.0f - but_size / 2,
+ but_size, but_size, NULL, 0, 0, 0, 0, "");
uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle");
uiBlockSetEmboss(node->block, UI_EMBOSS);
@@ -795,7 +795,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
//if (node->flag & NODE_MUTED)
- // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - don't print into self!
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
uiDefBut(node->block, LABEL, 0, showname,
(int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(rct->ymax - NODE_DY),
@@ -841,7 +841,8 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE, sock->flag & SELECT);
node->typeinfo->drawinputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name),
- sock->locx + (NODE_DYS / snode->aspect_sqrt), sock->locy - NODE_DYS, node->width - NODE_DY);
+ sock->locx + (NODE_DYS / snode->aspect_sqrt), sock->locy - NODE_DYS,
+ node->width - NODE_DY);
}
/* socket outputs */
@@ -852,15 +853,14 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE, sock->flag & SELECT);
node->typeinfo->drawoutputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name),
- sock->locx - node->width + (NODE_DYS / snode->aspect_sqrt), sock->locy - NODE_DYS, node->width - NODE_DY);
+ sock->locx - node->width + (NODE_DYS / snode->aspect_sqrt), sock->locy - NODE_DYS,
+ node->width - NODE_DY);
}
/* preview */
if (node->flag & NODE_PREVIEW) {
- BLI_lock_thread(LOCK_PREVIEW);
if (node->preview && node->preview->rect && !BLI_rctf_is_empty(&node->prvr))
node_draw_preview(node->preview, &node->prvr);
- BLI_unlock_thread(LOCK_PREVIEW);
}
UI_ThemeClearColor(color_id);
@@ -888,12 +888,15 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
if (node->flag & NODE_MUTED)
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
+#ifdef WITH_COMPOSITOR
if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) {
- if (node->highlight) {
+ if (COM_isHighlightedbNode(node)) {
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
- node->highlight = 0;
}
}
+#else
+ (void)ntree;
+#endif
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
@@ -925,7 +928,8 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
/* XXX button uses a custom triangle draw below, so make it invisible without icon */
uiBlockSetEmboss(node->block, UI_EMBOSSN);
but = uiDefBut(node->block, TOGBUT, B_REDR, "",
- rct->xmin + 10.0f - but_size / 2, centy - but_size / 2, but_size, but_size, NULL, 0, 0, 0, 0, "");
+ rct->xmin + 10.0f - but_size / 2, centy - but_size / 2,
+ but_size, but_size, NULL, 0, 0, 0, 0, "");
uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle");
uiBlockSetEmboss(node->block, UI_EMBOSS);
@@ -946,7 +950,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
//if (node->flag & NODE_MUTED)
- // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - don't print into self!
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
uiDefBut(node->block, LABEL, 0, showname,
(int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(centy - 10),
@@ -1128,6 +1132,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
if (snode->nodetree) {
bNode *node;
+ /* void** highlights = 0; */ /* UNUSED */
node_uiblocks_init(C, snode->nodetree);
@@ -1140,6 +1145,13 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
}
node_update_nodetree(C, snode->nodetree, 0.0f, 0.0f);
+
+#ifdef WITH_COMPOSITOR
+ if (snode->nodetree->type == NTREE_COMPOSIT) {
+ COM_startReadHighlights();
+ }
+#endif
+
node_draw_nodetree(C, ar, snode, snode->nodetree);
#if 0
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 9a6906c43bc..a0df2aefab1 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1157,6 +1157,9 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
BLI_remlink(&wgroup->nodes, node);
BLI_addtail(&ntree->nodes, node);
+ /* ensure unique node name in the nodee tree */
+ nodeUniqueName(ntree, node);
+
node->locx += gnode->locx;
node->locy += gnode->locy;
@@ -1197,7 +1200,8 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
nodeRemLink(wgroup, link);
}
/* restore links from internal nodes */
- for (link = wgroup->links.first; link; link = link->next) {
+ for (link = wgroup->links.first; link; link = linkn) {
+ linkn = link->next;
/* indicates link to group input */
if (!link->fromnode) {
/* NB: can't use find_group_node_input here,
@@ -1370,6 +1374,9 @@ static int node_group_separate_selected(bNodeTree *ntree, bNode *gnode, int make
BLI_remlink(&ngroup->nodes, newnode);
BLI_addtail(&ntree->nodes, newnode);
+ /* ensure unique node name in the node tree */
+ nodeUniqueName(ntree, newnode);
+
newnode->locx += gnode->locx;
newnode->locy += gnode->locy;
}
@@ -1514,7 +1521,7 @@ static bNode *visible_node(SpaceNode *snode, rctf *rct)
bNode *node;
for (node = snode->edittree->nodes.last; node; node = node->prev) {
- if (BLI_isect_rctf(&node->totr, rct, NULL))
+ if (BLI_rctf_isect(&node->totr, rct, NULL))
break;
}
return node;
@@ -1566,11 +1573,13 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
+ SpaceNode *snode = CTX_wm_space_node(C);
ARegion *ar = CTX_wm_region(C);
NodeViewMove *nvm;
Image *ima;
ImBuf *ibuf;
- int pad = 10;
+ const float pad = 32.0f; /* better be bigger then scrollbars */
+
void *lock;
ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
@@ -1586,10 +1595,10 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
nvm->mvalo[0] = event->mval[0];
nvm->mvalo[1] = event->mval[1];
- nvm->xmin = -(ar->winx / 2) - ibuf->x / 2 + pad;
- nvm->xmax = ar->winx / 2 + ibuf->x / 2 - pad;
- nvm->ymin = -(ar->winy / 2) - ibuf->y / 2 + pad;
- nvm->ymax = ar->winy / 2 + ibuf->y / 2 - pad;
+ nvm->xmin = -(ar->winx / 2) - (ibuf->x * (0.5f * snode->zoom)) + pad;
+ nvm->xmax = (ar->winx / 2) + (ibuf->x * (0.5f * snode->zoom)) - pad;
+ nvm->ymin = -(ar->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
+ nvm->ymax = (ar->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
BKE_image_release_ibuf(ima, lock);
@@ -2540,14 +2549,16 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
/* generics */
if (node) {
- node->locx = locx;
- node->locy = locy + 60.0f; // arbitrary.. so its visible, (0,0) is top of node
node_select(node);
gnode = node_tree_get_editgroup(snode->nodetree);
+ // arbitrary y offset of 60 so its visible
if (gnode) {
- node->locx -= gnode->locx;
- node->locy -= gnode->locy;
+ nodeFromView(gnode, locx, locy + 60.0f, &node->locx, &node->locy);
+ }
+ else {
+ node->locx = locx;
+ node->locy = locy + 60.0f;
}
ntreeUpdateTree(snode->edittree);
@@ -3133,6 +3144,7 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
ARegion *ar = CTX_wm_region(C);
+ bNode *gnode = node_tree_get_editgroup(snode->nodetree);
float mcoords[256][2];
int i = 0;
@@ -3163,8 +3175,13 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
ntemp.type = NODE_REROUTE;
rerouteNode = nodeAddNode(snode->edittree, &ntemp);
- rerouteNode->locx = insertPoint[0];
- rerouteNode->locy = insertPoint[1];
+ if (gnode) {
+ nodeFromView(gnode, insertPoint[0], insertPoint[1], &rerouteNode->locx, &rerouteNode->locy);
+ }
+ else {
+ rerouteNode->locx = insertPoint[0];
+ rerouteNode->locy = insertPoint[1];
+ }
nodeAddLink(snode->edittree, link->fromnode, link->fromsock, rerouteNode, rerouteNode->inputs.first);
link->fromnode = rerouteNode;
@@ -3710,11 +3727,14 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
BLI_remlink(&ntree->nodes, node);
BLI_addtail(&ngroup->nodes, node);
+ /* ensure unique node name in the ngroup */
+ nodeUniqueName(ngroup, node);
+
node->locx -= 0.5f * (min[0] + max[0]);
node->locy -= 0.5f * (min[1] + max[1]);
}
}
-
+
/* move animation data over */
if (ntree->adt) {
LinkData *ld, *ldn = NULL;
@@ -3974,9 +3994,9 @@ static int node_hide_toggle_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
node_flag_toggle_exec(snode, NODE_HIDDEN);
-
- snode_notify(C, snode);
-
+
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
+
return OPERATOR_FINISHED;
}
@@ -4037,7 +4057,7 @@ static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op))
node_flag_toggle_exec(snode, NODE_OPTIONS);
- snode_notify(C, snode);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
@@ -4088,7 +4108,7 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
ntreeUpdateTree(snode->edittree);
- snode_notify(C, snode);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index c2f3c66f4c1..9cd62342e19 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -118,7 +118,7 @@ void NODE_OT_view_all(struct wmOperatorType *ot);
void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link);
void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, float coord_array[][2], int resol);
-void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
+// void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage);
/* node_edit.c */
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index e7be750928d..1ea763a413d 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -474,7 +474,7 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
for (node= snode->edittree->nodes.first; node; node= node->next) {
- if (BLI_isect_rctf(&rectf, &node->totr, NULL)) {
+ if (BLI_rctf_isect(&rectf, &node->totr, NULL)) {
if (gesture_mode==GESTURE_MODAL_SELECT)
node_select(node);
else
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index 5463d4a8ff0..b21d31ad619 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -78,7 +78,7 @@ static void snode_home(ScrArea *UNUSED(sa), ARegion *ar, SpaceNode* snode)
ar->v2d.cur= node->totr;
}
else {
- BLI_union_rctf(cur, &node->totr);
+ BLI_rctf_union(cur, &node->totr);
}
}
}
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 349259ad71b..ce187c46625 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -192,10 +192,6 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
break;
}
break;
- case NC_WM:
- if (wmn->data == ND_FILEREAD)
- ED_area_tag_refresh(sa);
- break;
/* future: add ID checks? */
case NC_MATERIAL:
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 449914feae4..0388ba86b84 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1423,7 +1423,7 @@ static int parent_drop_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "child", childname);
ob = (Object *)BKE_libblock_find_name(ID_OB, childname);
- ED_object_parent_set(op->reports, bmain, scene, ob, par, partype);
+ ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE);
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
@@ -1514,7 +1514,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
if ((par->type != OB_ARMATURE) && (par->type != OB_CURVE) && (par->type != OB_LATTICE)) {
- if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) {
+ if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE)) {
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 1c3d2b61488..82e2730c59e 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2124,7 +2124,7 @@ static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
float facx = (v2d->mask.xmax - v2d->mask.xmin) / winx;
float facy = (v2d->mask.ymax - v2d->mask.ymin) / winy;
- BLI_resize_rctf(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1);
+ BLI_rctf_resize(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1);
ED_region_tag_redraw(CTX_wm_region(C));
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index a55f0edc06c..7849f84e777 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -875,7 +875,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
seq_rectf(seq, &rq);
- if (BLI_isect_rctf(&rq, &rectf, NULL)) {
+ if (BLI_rctf_isect(&rq, &rectf, NULL)) {
if (selecting) seq->flag |= SELECT;
else seq->flag &= ~SEQ_ALLSEL;
recurs_sel_seq(seq);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index f0275fb6584..1eba2deed96 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -2928,8 +2928,11 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
// if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
if (!RNA_string_length(op->ptr, "text")) {
- /* if alt/ctrl/super are pressed pass through */
- if (event->ctrl || event->oskey) {
+ /* if alt/ctrl/super are pressed pass through except for utf8 character event
+ * (when input method are used for utf8 inputs, the user may assign key event
+ * including alt/ctrl/super like ctrl+m to commit utf8 string. in such case,
+ * the modifiers in the utf8 character event make no sense.) */
+ if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
return OPERATOR_PASS_THROUGH;
}
else {
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 38109c3048e..112f41278b7 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -466,7 +466,8 @@ static DMDrawOption draw_tface__set_draw(MTFace *tface, int has_mcol, int matnr)
return DM_DRAW_OPTION_NORMAL; /* Set color from mcol */
}
}
-static void add_tface_color_layer(DerivedMesh *dm)
+
+static void update_tface_color_layer(DerivedMesh *dm)
{
MTFace *tface = DM_get_tessface_data_layer(dm, CD_MTFACE);
MFace *mface = dm->getTessFaceArray(dm);
@@ -476,7 +477,15 @@ static void add_tface_color_layer(DerivedMesh *dm)
if (!mcol)
mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
- finalCol = MEM_mallocN(sizeof(MCol) * 4 * dm->getNumTessFaces(dm), "add_tface_color_layer");
+ if (CustomData_has_layer(&dm->faceData, CD_TEXTURE_MCOL)) {
+ finalCol = CustomData_get_layer(&dm->faceData, CD_TEXTURE_MCOL);
+ }
+ else {
+ finalCol = MEM_mallocN(sizeof(MCol) * 4 * dm->getNumTessFaces(dm), "add_tface_color_layer");
+
+ CustomData_add_layer(&dm->faceData, CD_TEXTURE_MCOL, CD_ASSIGN, finalCol, dm->numTessFaceData);
+ }
+
for (i = 0; i < dm->getNumTessFaces(dm); i++) {
Material *ma = give_current_material(Gtexdraw.ob, mface[i].mat_nr + 1);
@@ -542,7 +551,6 @@ static void add_tface_color_layer(DerivedMesh *dm)
}
}
}
- CustomData_add_layer(&dm->faceData, CD_TEXTURE_MCOL, CD_ASSIGN, finalCol, dm->numTessFaceData);
}
static DMDrawOption draw_tface_mapped__set_draw(void *userData, int index)
@@ -640,7 +648,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
short matnr = mp->mat_nr;
int mf_smooth = mp->flag & ME_SMOOTH;
Material *mat = me->mat[matnr];
- int mode = mat->game.flag;
+ int mode = mat ? mat->game.flag : GEMAT_INVISIBLE;
if (!(mode & GEMAT_INVISIBLE) && (mode & GEMAT_TEXT) && mp->totloop >= 3) {
/* get the polygon as a tri/quad */
@@ -797,8 +805,7 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
else {
drawTFace_userData userData;
- if (!CustomData_has_layer(&dm->faceData, CD_TEXTURE_MCOL))
- add_tface_color_layer(dm);
+ update_tface_color_layer(dm);
userData.mf = DM_get_tessface_data_layer(dm, CD_MFACE);
userData.tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 0df775c48c4..3c88c99b2f0 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2162,7 +2162,7 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, const flo
/* make an int copy */
int s_int[2][2] = {{s[0][0], s[0][1]},
{s[1][0], s[1][1]}};
- if (!BLI_segment_in_rcti(&data->win_rect, s_int[0], s_int[1])) {
+ if (!BLI_rcti_isect_segment(&data->win_rect, s_int[0], s_int[1])) {
return;
}
}
@@ -2843,7 +2843,7 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
int pass;
unsigned char wireCol[4], selCol[4], actCol[4];
- /* since this function does transparant... */
+ /* since this function does transparent... */
UI_GetThemeColor4ubv(TH_EDGE_SELECT, selCol);
UI_GetThemeColor4ubv(TH_WIRE, wireCol);
UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, actCol);
@@ -2854,7 +2854,7 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
wireCol[3] = 0;
for (pass = 0; pass < 2; pass++) {
- /* show wires in transparant when no zbuf clipping for select */
+ /* show wires in transparent when no zbuf clipping for select */
if (pass == 0) {
if (v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT) == 0) {
glEnable(GL_BLEND);
@@ -6191,9 +6191,9 @@ static void get_local_bounds(Object *ob, float center[3], float size[3])
copy_v3_v3(size, ob->size);
}
else {
- size[0] = 0.5 * fabs(bb->vec[0][0] - bb->vec[4][0]);
- size[1] = 0.5 * fabs(bb->vec[0][1] - bb->vec[2][1]);
- size[2] = 0.5 * fabs(bb->vec[0][2] - bb->vec[1][2]);
+ size[0] = 0.5 * fabsf(bb->vec[0][0] - bb->vec[4][0]);
+ size[1] = 0.5 * fabsf(bb->vec[0][1] - bb->vec[2][1]);
+ size[2] = 0.5 * fabsf(bb->vec[0][2] - bb->vec[1][2]);
center[0] = (bb->vec[0][0] + bb->vec[4][0]) / 2.0;
center[1] = (bb->vec[0][1] + bb->vec[2][1]) / 2.0;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 6cfa828024d..c819637fd04 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -93,7 +93,7 @@ typedef struct {
float ob_scale[3]; /* need temp space due to linked values */
float ob_dims[3];
short link_scale;
- float ve_median[7];
+ float ve_median[9];
int curdef;
float *defweightp;
} TransformProperties;
@@ -135,13 +135,13 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiBlock *block = (layout) ? uiLayoutAbsoluteBlock(layout) : NULL;
MDeformVert *dvert = NULL;
TransformProperties *tfp;
- float median[7], ve_median[7];
- int tot, totw, totweight, totedge, totradius;
+ float median[9], ve_median[9];
+ int tot, totw, totweight, totedge, totradius, totskinradius;
char defstr[320];
PointerRNA radius_ptr;
- median[0] = median[1] = median[2] = median[3] = median[4] = median[5] = median[6] = 0.0;
- tot = totw = totweight = totedge = totradius = 0;
+ median[0] = median[1] = median[2] = median[3] = median[4] = median[5] = median[6] = median[7] = median[8] = 0.0;
+ tot = totw = totweight = totedge = totradius = totskinradius = 0;
defstr[0] = 0;
/* make sure we got storage */
@@ -159,9 +159,17 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ MVertSkin *vs;
+
evedef = eve;
tot++;
add_v3_v3(median, eve->co);
+
+ vs = (MVertSkin *)CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MVERT_SKIN);
+ if (vs) {
+ add_v2_v2(median + 7, vs->radius); /* Third val not used currently. */
+ totskinradius++;
+ }
}
}
@@ -304,6 +312,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
median[4] /= (float)totweight;
if (totradius)
median[5] /= (float)totradius;
+ if (totskinradius) {
+ median[7] /= (float)totskinradius;
+ median[8] /= (float)totskinradius;
+ }
if (v3d->flag & V3D_GLOBAL_STATS)
mul_m4_v3(ob->obmat, median);
@@ -373,6 +385,23 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
&(tfp->ve_median[5]), 0.0, 100.0, 1, 3, TIP_("Radius of curve control points"));
}
+ if (totskinradius == 1) {
+ uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Radius X:"),
+ 0, yi -= buth + but_margin, 200, buth,
+ &(tfp->ve_median[7]), 0.0, 100.0, 1, 3, TIP_("X radius used by Skin modifier"));
+ uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Radius Y:"),
+ 0, yi -= buth + but_margin, 200, buth,
+ &(tfp->ve_median[8]), 0.0, 100.0, 1, 3, TIP_("Y radius used by Skin modifier"));
+ }
+ else if (totskinradius > 1) {
+ uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Radius X:"),
+ 0, yi -= buth + but_margin, 200, buth,
+ &(tfp->ve_median[7]), 0.0, 100.0, 1, 3, TIP_("Median X radius used by Skin modifier"));
+ uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Radius Y:"),
+ 0, yi -= buth + but_margin, 200, buth,
+ &(tfp->ve_median[8]), 0.0, 100.0, 1, 3, TIP_("Median Y radius used by Skin modifier"));
+ }
+
if (totedge == 1) {
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Crease:"),
0, yi -= buth + but_margin, 200, buth,
@@ -407,6 +436,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
median[4] = ve_median[4] - median[4];
median[5] = ve_median[5] - median[5];
median[6] = ve_median[6] - median[6];
+ median[7] = ve_median[7] - median[7];
+ median[8] = ve_median[8] - median[8];
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
@@ -501,6 +532,55 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
}
}
+
+ if (median[7] != 0.0f) {
+ BMVert *eve;
+ /* That one is not clamped to [0.0, 1.0]. */
+ float sca = ve_median[7];
+ if (ve_median[7] - median[7] == 0.0f) {
+ BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ MVertSkin *vs = (MVertSkin *)CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MVERT_SKIN);
+ if (vs)
+ vs->radius[0] = sca;
+ }
+ }
+ }
+ else {
+ sca /= (ve_median[7] - median[7]);
+ BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ MVertSkin *vs = (MVertSkin *)CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MVERT_SKIN);
+ if (vs)
+ vs->radius[0] *= sca;
+ }
+ }
+ }
+ }
+ if (median[8] != 0.0f) {
+ BMVert *eve;
+ /* That one is not clamped to [0.0, 1.0]. */
+ float sca = ve_median[8];
+ if (ve_median[8] - median[8] == 0.0f) {
+ BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ MVertSkin *vs = (MVertSkin *)CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MVERT_SKIN);
+ if (vs)
+ vs->radius[1] = sca;
+ }
+ }
+ }
+ else {
+ sca /= (ve_median[8] - median[8]);
+ BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ MVertSkin *vs = (MVertSkin *)CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MVERT_SKIN);
+ if (vs)
+ vs->radius[1] *= sca;
+ }
+ }
+ }
+ }
EDBM_mesh_normals_update(em);
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 1ace4688991..1dbc40a0c07 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2028,7 +2028,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
r.ymax = ar->winy - 1;
/* Constrain rect to depth bounds */
- BLI_isect_rcti(&r, rect, rect);
+ BLI_rcti_isect(&r, rect, rect);
/* assign values to compare with the ViewDepths */
x = rect->xmin;
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 40837d00409..15e32ea2de4 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -333,8 +333,9 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event
upvec[2] = 0.0f;
copy_m3_m4(mat, fly->rv3d->viewinv);
mul_m3_v3(mat, upvec);
- if (fabs(upvec[2]) < 0.1)
+ if (fabsf(upvec[2]) < 0.1f) {
fly->zlock = 1;
+ }
upvec[0] = 0;
upvec[1] = 0;
upvec[2] = 0;
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index f12e7683668..39ec7514a88 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -758,7 +758,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
bNode *node;
rcti rect;
- short node_cent[2];
+ int node_cent[2];
float node_centf[2];
BLI_lasso_boundbox(&rect, mcords, moves);
@@ -770,7 +770,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
node_centf[1] = (node->totr.ymin + node->totr.ymax) / 2;
ipoco_to_areaco_noclip(G.v2d, node_centf, node_cent);
- if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
+ if (BLI_in_rcti_v(&rect, node_cent) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
if (select) {
node->flag |= SELECT;
}
@@ -1130,19 +1130,19 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff
short a, hits15, hits9 = 0, hits5 = 0;
short has_bones15 = 0, has_bones9 = 0, has_bones5 = 0;
- BLI_init_rcti(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14);
+ BLI_rcti_init(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14);
hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
if (hits15 > 0) {
for (a = 0; a < hits15; a++) if (buffer[4 * a + 3] & 0xFFFF0000) has_bones15 = 1;
offs = 4 * hits15;
- BLI_init_rcti(&rect, mval[0] - 9, mval[0] + 9, mval[1] - 9, mval[1] + 9);
+ BLI_rcti_init(&rect, mval[0] - 9, mval[0] + 9, mval[1] - 9, mval[1] + 9);
hits9 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect);
if (hits9 > 0) {
for (a = 0; a < hits9; a++) if (buffer[offs + 4 * a + 3] & 0xFFFF0000) has_bones9 = 1;
offs += 4 * hits9;
- BLI_init_rcti(&rect, mval[0] - 5, mval[0] + 5, mval[1] - 5, mval[1] + 5);
+ BLI_rcti_init(&rect, mval[0] - 5, mval[0] + 5, mval[1] - 5, mval[1] + 5);
hits5 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect);
if (hits5 > 0) {
for (a = 0; a < hits5; a++) if (buffer[offs + 4 * a + 3] & 0xFFFF0000) has_bones5 = 1;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index bc41ecd1dc5..3abfda78ec3 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1786,7 +1786,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin;
cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin;
cam_frame.ymax = cam_framef.ymax + ar->winrct.ymin;
- BLI_isect_rcti(&ar->winrct, &cam_frame, &cam_frame);
+ BLI_rcti_isect(&ar->winrct, &cam_frame, &cam_frame);
}
else {
cam_frame.xmin = ar->winrct.xmin;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 35281168c2e..6aee12c4b41 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -29,7 +29,6 @@
* \ingroup edtransform
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -37,9 +36,9 @@
#include <float.h>
#ifndef WIN32
-#include <unistd.h>
+# include <unistd.h>
#else
-#include <io.h>
+# include <io.h>
#endif
#include "MEM_guardedalloc.h"
@@ -90,10 +89,6 @@
#include "UI_resources.h"
-//#include "blendef.h"
-//
-//#include "mydevice.h"
-
#include "transform.h"
#include <stdio.h>
@@ -174,8 +169,14 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
if (t->options & CTX_MASK) {
/* clamp w/h, mask only */
- divx = divy = maxf(divx, divy);
- mulx = muly = minf(mulx, muly);
+ if (mulx / divx < muly / divy) {
+ divy = divx;
+ muly = mulx;
+ }
+ else {
+ divx = divy;
+ mulx = muly;
+ }
}
r_vec[0] = mulx * (dx) / divx;
@@ -263,6 +264,9 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1);
}
+ else if (t->spacetype == SPACE_NODE) {
+ UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], adr, adr + 1);
+ }
}
void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
@@ -1673,19 +1677,25 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
/* Stupid code to have Ctrl-Click on manipulator work ok */
if (event) {
- wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
- wmKeyMapItem *kmi;
-
- for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
- if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
- if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) ||
- (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) ||
- (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) ||
- ((kmi->type == OSKEY) && event->oskey) )
- {
- t->modifiers |= MOD_SNAP_INVERT;
+ /* do this only for translation/rotation/resize due to only this
+ * moded are available from manipulator and doing such check could
+ * lead to keymap conflicts for other modes (see #31584)
+ */
+ if (ELEM3(mode, TFM_TRANSLATION, TFM_ROTATION, TFM_RESIZE)) {
+ wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
+ wmKeyMapItem *kmi;
+
+ for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
+ if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) ||
+ (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) ||
+ (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) ||
+ ((kmi->type == OSKEY) && event->oskey) )
+ {
+ t->modifiers |= MOD_SNAP_INVERT;
+ }
+ break;
}
- break;
}
}
@@ -2446,7 +2456,7 @@ int Warp(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -2575,7 +2585,7 @@ int Shear(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -2661,15 +2671,15 @@ void initResize(TransInfo *t)
static void headerResize(TransInfo *t, float vec[3], char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
char *spos = str;
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
}
else {
- BLI_snprintf(&tvec[0], 20, "%.4f", vec[0]);
- BLI_snprintf(&tvec[20], 20, "%.4f", vec[1]);
- BLI_snprintf(&tvec[40], 20, "%.4f", vec[2]);
+ BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
+ BLI_snprintf(&tvec[NUM_STR_REP_LEN], NUM_STR_REP_LEN, "%.4f", vec[1]);
+ BLI_snprintf(&tvec[NUM_STR_REP_LEN * 2], NUM_STR_REP_LEN, "%.4f", vec[2]);
}
if (t->con.mode & CON_APPLY) {
@@ -2678,17 +2688,21 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
break;
case 1:
- spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ t->con.text, t->proptext);
break;
case 2:
- spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
}
}
else {
if (t->flag & T_2D_EDIT)
- spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ t->con.text, t->proptext);
else
- spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
@@ -3034,7 +3048,7 @@ int ToSphere(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -3380,7 +3394,7 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2]))
applySnapping(t, &final);
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
applyNumInput(&t->num, &final);
@@ -3479,13 +3493,13 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2]))
snapGrid(t, phi);
if (hasNumInput(&t->num)) {
- char c[40];
+ char c[NUM_STR_REP_LEN * 2];
applyNumInput(&t->num, phi);
outputNumInput(&(t->num), c);
- spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[20], t->proptext);
+ spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[NUM_STR_REP_LEN], t->proptext);
phi[0] = DEG2RADF(phi[0]);
phi[1] = DEG2RADF(phi[1]);
@@ -3564,9 +3578,9 @@ void initTranslation(TransInfo *t)
static void headerTranslation(TransInfo *t, float vec[3], char *str)
{
char *spos = str;
- char tvec[60];
- char distvec[20];
- char autoik[20];
+ char tvec[NUM_STR_REP_LEN * 3];
+ char distvec[NUM_STR_REP_LEN];
+ char autoik[NUM_STR_REP_LEN];
float dist;
if (hasNumInput(&t->num)) {
@@ -3584,12 +3598,13 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
int i, do_split = t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1 : 0;
for (i = 0; i < 3; i++)
- bUnit_AsString(&tvec[i * 20], 20, dvec[i] * t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1);
+ bUnit_AsString(&tvec[i * NUM_STR_REP_LEN], NUM_STR_REP_LEN, dvec[i] * t->scene->unit.scale_length,
+ 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1);
}
else {
sprintf(&tvec[0], "%.4f", dvec[0]);
- sprintf(&tvec[20], "%.4f", dvec[1]);
- sprintf(&tvec[40], "%.4f", dvec[2]);
+ sprintf(&tvec[NUM_STR_REP_LEN], "%.4f", dvec[1]);
+ sprintf(&tvec[NUM_STR_REP_LEN * 2], "%.4f", dvec[2]);
}
}
@@ -3617,17 +3632,21 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
spos += sprintf(spos, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
break;
case 1:
- spos += sprintf(spos, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]);
+ spos += sprintf(spos, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ distvec, t->con.text, t->proptext, &autoik[0]);
break;
case 2:
- spos += sprintf(spos, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
+ spos += sprintf(spos, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], distvec, t->con.text, t->proptext, &autoik[0]);
}
}
else {
if (t->flag & T_2D_EDIT)
- spos += sprintf(spos, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
+ spos += sprintf(spos, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ distvec, t->con.text, t->proptext);
else
- spos += sprintf(spos, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
+ spos += sprintf(spos, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+ &tvec[NUM_STR_REP_LEN * 2], distvec, t->con.text, t->proptext, &autoik[0]);
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
@@ -3785,7 +3804,7 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -3854,7 +3873,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2]))
snapGrid(t, &final);
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
applyNumInput(&t->num, &final);
@@ -3926,7 +3945,7 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
sprintf(str, "Shrink/Fatten: %s", c);
@@ -3994,7 +4013,7 @@ int MaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
sprintf(str, "Shrink/Fatten: %s", c);
@@ -4060,7 +4079,7 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -4196,7 +4215,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -4263,7 +4282,7 @@ int BevelWeight(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -4336,7 +4355,7 @@ int Crease(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -4396,14 +4415,14 @@ void initBoneSize(TransInfo *t)
static void headerBoneSize(TransInfo *t, float vec[3], char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
}
else {
sprintf(&tvec[0], "%.4f", vec[0]);
- sprintf(&tvec[20], "%.4f", vec[1]);
- sprintf(&tvec[40], "%.4f", vec[2]);
+ sprintf(&tvec[NUM_STR_REP_LEN], "%.4f", vec[1]);
+ sprintf(&tvec[NUM_STR_REP_LEN * 2], "%.4f", vec[2]);
}
/* hmm... perhaps the y-axis values don't need to be shown? */
@@ -4411,10 +4430,12 @@ static void headerBoneSize(TransInfo *t, float vec[3], char *str)
if (t->num.idx_max == 0)
sprintf(str, "ScaleB: %s%s %s", &tvec[0], t->con.text, t->proptext);
else
- sprintf(str, "ScaleB: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
+ sprintf(str, "ScaleB: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2],
+ t->con.text, t->proptext);
}
else {
- sprintf(str, "ScaleB X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
+ sprintf(str, "ScaleB X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2],
+ t->con.text, t->proptext);
}
}
@@ -4527,7 +4548,7 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
sprintf(str, "Envelope: %s", c);
@@ -4686,7 +4707,7 @@ static int createSlideVerts(TransInfo *t)
float projectMat[4][4];
float mval[2] = {(float)t->mval[0], (float)t->mval[1]};
float start[3] = {0.0f, 0.0f, 0.0f}, dir[3], end[3] = {0.0f, 0.0f, 0.0f};
- float vec[3], vec2[3], lastvec[3] /*, size, dis=0.0, z */ /* UNUSED */;
+ float vec[3], vec2[3] /*, lastvec[3], size, dis=0.0, z */ /* UNUSED */;
int numsel, i, j;
if (t->spacetype == SPACE_VIEW3D) {
@@ -4874,7 +4895,7 @@ static int createSlideVerts(TransInfo *t)
} while (e != first->e && l1);
}
- //EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+ /* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
sld->sv = sv_array;
sld->totsv = j;
@@ -4882,14 +4903,15 @@ static int createSlideVerts(TransInfo *t)
/*find mouse vector*/
/* dis = z = -1.0f; */ /* UNUSED */
/* size = 50.0; */ /* UNUSED */
- zero_v3(lastvec); zero_v3(dir);
+ /* zero_v3(lastvec); */ /* UNUSED */
+ zero_v3(dir);
/* ee = le = NULL; */ /* UNUSED */
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
BMIter iter2;
BMEdge *e2;
float vec1[3], dis2, mval[2] = {t->mval[0], t->mval[1]}, d;
-
+
/* search cross edges for visible edge to the mouse cursor,
* then use the shared vertex to calculate screen vector*/
dis2 = -1.0f;
@@ -4898,10 +4920,12 @@ static int createSlideVerts(TransInfo *t)
BM_ITER_ELEM (e2, &iter2, v, BM_EDGES_OF_VERT) {
if (BM_elem_flag_test(e2, BM_ELEM_SELECT))
continue;
-
- if (v3d && !BMBVH_EdgeVisible(btree, e2, ar, v3d, t->obedit))
+
+ /* This test is only relevant if object is not wire-drawn! See [#32068]. */
+ if (v3d && t->obedit->dt > OB_WIRE && v3d->drawtype > OB_WIRE &&
+ !BMBVH_EdgeVisible(btree, e2, ar, v3d, t->obedit))
continue;
-
+
j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
if (sv_array[j].down) {
@@ -5419,7 +5443,7 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
CLAMP(final, -1.0f, 1.0f);
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
applyNumInput(&t->num, &final);
@@ -5485,7 +5509,7 @@ int BoneRoll(TransInfo *t, const int UNUSED(mval[2]))
snapGrid(t, &final);
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
applyNumInput(&t->num, &final);
@@ -5557,7 +5581,7 @@ int BakeTime(TransInfo *t, const int mval[2])
/* header print for NumInput */
if (hasNumInput(&t->num)) {
- char c[20];
+ char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c);
@@ -5750,7 +5774,7 @@ void initSeqSlide(TransInfo *t)
static void headerSeqSlide(TransInfo *t, float val[2], char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
@@ -5993,7 +6017,7 @@ void initTimeTranslate(TransInfo *t)
static void headerTimeTranslate(TransInfo *t, char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
/* if numeric input is active, use results from that, otherwise apply snapping to result */
if (hasNumInput(&t->num)) {
@@ -6148,7 +6172,7 @@ void initTimeSlide(TransInfo *t)
static void headerTimeSlide(TransInfo *t, float sval, char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
@@ -6290,7 +6314,7 @@ void initTimeScale(TransInfo *t)
static void headerTimeScale(TransInfo *t, char *str)
{
- char tvec[60];
+ char tvec[NUM_STR_REP_LEN * 3];
if (hasNumInput(&t->num))
outputNumInput(&(t->num), tvec);
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 034ea3eb704..55110e48469 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -53,7 +53,6 @@
#include "BKE_context.h"
-
#include "ED_image.h"
#include "ED_view3d.h"
@@ -61,13 +60,8 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
-//#include "blendef.h"
-//
-//#include "mydevice.h"
-
#include "UI_resources.h"
-
#include "transform.h"
static void drawObjectConstraint(TransInfo *t);
@@ -294,7 +288,7 @@ static void planeProjection(TransInfo *t, float in[3], float out[3])
sub_v3_v3v3(vec, out, in);
factor = dot_v3v3(vec, norm);
- if (fabs(factor) <= 0.001) {
+ if (fabsf(factor) <= 0.001f) {
return; /* prevent divide by zero */
}
factor = dot_v3v3(vec, vec) / factor;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index d7241555cc7..949266a0cc2 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -4880,7 +4880,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
/* only insert keyframes for this F-Curve if it affects the current bone */
if (strstr(fcu->rna_path, "bones")) {
- char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones[");
+ char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
/* only if bone name matches too...
* NOTE: this will do constraints too, but those are ok to do here too?
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 9f335b4afe7..dba597d316d 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -29,13 +29,12 @@
* \ingroup edtransform
*/
-
#include <string.h>
#include <math.h>
#include "MEM_guardedalloc.h"
-#include "BLO_sys_types.h" // for intptr_t support
+#include "BLO_sys_types.h" /* for intptr_t support */
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -58,14 +57,8 @@
#include "RNA_access.h"
-//#include "BIF_screen.h"
-//#include "BIF_mywindow.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
-//#include "BIF_editmesh.h"
-//#include "BIF_editsima.h"
-//#include "BIF_editparticle.h"
-//#include "BIF_meshtools.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
@@ -96,17 +89,11 @@
#include "ED_clip.h"
#include "ED_screen.h"
-//#include "BDR_unwrapper.h"
-
#include "WM_types.h"
#include "WM_api.h"
#include "UI_resources.h"
-//#include "blendef.h"
-//
-//#include "mydevice.h"
-
#include "transform.h"
/* ************************** Functions *************************** */
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 1507dbfddda..31250e3a50c 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -607,7 +607,7 @@ static void test_manipulator_axis(const bContext *C)
ED_view3d_global_to_vector(rv3d, rv3d->twmat[3], vec);
- angle = fabs(angle_v3v3(rv3d->twmat[0], vec));
+ angle = fabsf(angle_v3v3(rv3d->twmat[0], vec));
if (angle > (float)M_PI / 2.0f) {
angle = (float)M_PI - angle;
}
@@ -616,7 +616,7 @@ static void test_manipulator_axis(const bContext *C)
rv3d->twdrawflag &= ~(MAN_TRANS_X | MAN_SCALE_X);
}
- angle = fabs(angle_v3v3(rv3d->twmat[1], vec));
+ angle = fabsf(angle_v3v3(rv3d->twmat[1], vec));
if (angle > (float)M_PI / 2.0f) {
angle = (float)M_PI - angle;
}
@@ -625,7 +625,7 @@ static void test_manipulator_axis(const bContext *C)
rv3d->twdrawflag &= ~(MAN_TRANS_Y | MAN_SCALE_Y);
}
- angle = fabs(angle_v3v3(rv3d->twmat[2], vec));
+ angle = fabsf(angle_v3v3(rv3d->twmat[2], vec));
if (angle > (float)M_PI / 2.0f) {
angle = (float)M_PI - angle;
}
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 97fc173f9a1..b9583fc21e1 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -50,11 +50,6 @@
#include "BLF_translation.h"
-//#include "BIF_editmesh.h"
-//#include "BIF_interface.h"
-//#include "BIF_space.h"
-//#include "BIF_toolbox.h"
-
#include "ED_armature.h"
#include "ED_mesh.h"
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 3847087111e..0ea48e81029 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -29,7 +29,6 @@
* \ingroup edtransform
*/
-
#include <stdlib.h>
#include <math.h>
#include <float.h>
@@ -41,7 +40,7 @@
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h" // Temporary, for snapping to other unselected meshes
+#include "DNA_meshdata_types.h" /* Temporary, for snapping to other unselected meshes */
#include "DNA_node_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
@@ -54,20 +53,11 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-//#include "BDR_drawobject.h"
-//
-//#include "editmesh.h"
-//#include "BIF_editsima.h"
#include "BIF_gl.h"
-//#include "BIF_mywindow.h"
-//#include "BIF_screen.h"
-//#include "BIF_editsima.h"
-//#include "BIF_drawimage.h"
-//#include "BIF_editmesh.h"
#include "BKE_DerivedMesh.h"
#include "BKE_object.h"
-#include "BKE_anim.h" /* for duplis */
+#include "BKE_anim.h" /* for duplis */
#include "BKE_context.h"
#include "BKE_tessmesh.h"
#include "BKE_mesh.h"
@@ -88,8 +78,6 @@
#include "transform.h"
-//#include "blendef.h" /* for selection modes */
-
#define USE_BVH_FACE_SNAP
/********************* PROTOTYPES ***********************/
@@ -1093,7 +1081,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
- if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
+ if (closest == NULL || fabsf(dist) < fabsf(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
@@ -1109,7 +1097,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
- if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
+ if (closest == NULL || fabsf(dist) < fabsf(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
@@ -1132,7 +1120,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
- if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
+ if (closest == NULL || fabsf(dist) < fabsf(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 91290829662..281b682465d 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -66,6 +66,7 @@ void outputNumInput(NumInput *n, char *str)
char cur;
char inv[] = "1/";
short i, j;
+ const int ln = NUM_STR_REP_LEN;
for (j = 0; j <= n->idx_max; j++) {
/* if AFFECTALL and no number typed and cursor not on number, use first number */
@@ -85,34 +86,34 @@ void outputNumInput(NumInput *n, char *str)
inv[0] = 0;
if (n->val[i] > 1e10f || n->val[i] < -1e10f)
- BLI_snprintf(&str[j * 20], 20, "%s%.4e%c", inv, n->val[i], cur);
+ BLI_snprintf(&str[j * ln], ln, "%s%.4e%c", inv, n->val[i], cur);
else
switch (n->ctrl[i]) {
case 0:
- BLI_snprintf(&str[j * 20], 20, "%sNONE%c", inv, cur);
+ BLI_snprintf(&str[j * ln], ln, "%sNONE%c", inv, cur);
break;
case 1:
case -1:
- BLI_snprintf(&str[j * 20], 20, "%s%.0f%c", inv, n->val[i], cur);
+ BLI_snprintf(&str[j * ln], ln, "%s%.0f%c", inv, n->val[i], cur);
break;
case 10:
case -10:
- BLI_snprintf(&str[j * 20], 20, "%s%.f.%c", inv, n->val[i], cur);
+ BLI_snprintf(&str[j * ln], ln, "%s%.f.%c", inv, n->val[i], cur);
break;
case 100:
case -100:
- BLI_snprintf(&str[j * 20], 20, "%s%.1f%c", inv, n->val[i], cur);
+ BLI_snprintf(&str[j * ln], ln, "%s%.1f%c", inv, n->val[i], cur);
break;
case 1000:
case -1000:
- BLI_snprintf(&str[j * 20], 20, "%s%.2f%c", inv, n->val[i], cur);
+ BLI_snprintf(&str[j * ln], ln, "%s%.2f%c", inv, n->val[i], cur);
break;
case 10000:
case -10000:
- BLI_snprintf(&str[j * 20], 20, "%s%.3f%c", inv, n->val[i], cur);
+ BLI_snprintf(&str[j * ln], ln, "%s%.3f%c", inv, n->val[i], cur);
break;
default:
- BLI_snprintf(&str[j * 20], 20, "%s%.4e%c", inv, n->val[i], cur);
+ BLI_snprintf(&str[j * ln], ln, "%s%.4e%c", inv, n->val[i], cur);
}
}
}
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 05bfc8d4a2e..0510ae21326 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -733,7 +733,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const
uv_poly_center(em, efa, cent);
- dist = fabs(co[0] - cent[0]) + fabs(co[1] - cent[1]);
+ dist = fabsf(co[0] - cent[0]) + fabsf(co[1] - cent[1]);
if (dist < mindist) {
hit->tf = tf;
@@ -869,7 +869,7 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float c
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- dist = fabs(co[0] - luv->uv[0]) + fabs(co[1] - luv->uv[1]);
+ dist = fabsf(co[0] - luv->uv[0]) + fabsf(co[1] - luv->uv[1]);
if (dist <= mindist) {
mindist = dist;
@@ -2479,7 +2479,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
if (uvedit_face_visible_test(scene, ima, efa, tf)) {
uv_poly_center(em, efa, cent);
- if (BLI_in_rctf(&rectf, cent[0], cent[1])) {
+ if (BLI_in_rctf_v(&rectf, cent)) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
change = 1;
}
@@ -2504,15 +2504,13 @@ static int border_select_exec(bContext *C, wmOperator *op)
if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) {
/* UV_SYNC_SELECTION - can't do pinned selection */
- if (BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1])) {
+ if (BLI_in_rctf_v(&rectf, luv->uv)) {
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
else uvedit_uv_select_disable(em, scene, l);
}
}
else if (pinned) {
- if ((luv->flag & MLOOPUV_PINNED) &&
- BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1]))
- {
+ if ((luv->flag & MLOOPUV_PINNED) && BLI_in_rctf_v(&rectf, luv->uv)) {
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
else uvedit_uv_select_disable(em, scene, l);
}
@@ -2685,7 +2683,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh
float cent[2];
uv_poly_center(em, efa, cent);
UI_view2d_view_to_region(&ar->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]);
- if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) &&
+ if (BLI_in_rcti_v(&rect, screen_uv) &&
BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
{
uvedit_face_select_enable(scene, em, efa, FALSE);
@@ -2702,7 +2700,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh
if ((select) != (uvedit_uv_select_test(em, scene, l))) {
MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
UI_view2d_view_to_region(&ar->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]);
- if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) &&
+ if (BLI_in_rcti_v(&rect, screen_uv) &&
BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
{
if (select) {
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 75ed7d7eb19..c44a181841e 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1595,7 +1595,7 @@ static int gpu_count_grid_quads(BLI_bitmap *grid_hidden,
int i, x, y, totquad;
/* grid hidden layer is present, so have to check each grid for
- * visiblity */
+ * visibility */
for (i = 0, totquad = 0; i < totgrid; i++) {
const BLI_bitmap gh = grid_hidden[grid_indices[i]];
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 8a31a454633..f4e1e0c1147 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -638,8 +638,9 @@ void GPU_create_gl_tex(unsigned int *bind, unsigned int *pix, float * frect, int
int tpy = recth;
/* scale if not a power of two. this is not strictly necessary for newer
- * GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures */
- if (!is_pow2_limit(rectw) || !is_pow2_limit(recth)) {
+ * GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures
+ * Then don't bother scaling for hardware that supports NPOT textures! */
+ if (!GLEW_ARB_texture_non_power_of_two && (!is_pow2_limit(rectw) || !is_pow2_limit(recth))) {
rectw= smaller_pow2_limit(rectw);
recth= smaller_pow2_limit(recth);
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index a0d7bfbaaf6..652b16a7c65 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -1618,7 +1618,7 @@ static void execute_scene(Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, fl
timestep = sts / 1000.0;
}
}
- // don't cache if we are reiterating because we don't want to distroy the cache unnecessarily
+ // don't cache if we are reiterating because we don't want to destroy the cache unnecessarily
ikscene->scene->update(timestamp, timestep, numstep, false, !reiterate, simulation);
if (reiterate) {
// how many times do we reiterate?
diff --git a/source/blender/imbuf/IMB_moviecache.h b/source/blender/imbuf/IMB_moviecache.h
index f6927d4f31d..5e52563a89e 100644
--- a/source/blender/imbuf/IMB_moviecache.h
+++ b/source/blender/imbuf/IMB_moviecache.h
@@ -35,7 +35,7 @@
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
-/* Cache system for movie data - now supports stoting ImBufs only
+/* Cache system for movie data - now supports storing ImBufs only
* Supposed to provide unified cache system for movie clips, sequencer and
* other movie-related areas */
@@ -44,10 +44,19 @@ struct MovieCache;
typedef void (*MovieCacheGetKeyDataFP) (void *userkey, int *framenr, int *proxy, int *render_flags);
+typedef void *(*MovieCacheGetPriorityDataFP) (void *userkey);
+typedef int (*MovieCacheGetItemPriorityFP) (void *last_userkey, void *priority_data);
+typedef void (*MovieCachePriorityDeleterFP) (void *priority_data);
+
void IMB_moviecache_init(void);
void IMB_moviecache_destruct(void);
-struct MovieCache *IMB_moviecache_create(int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp, MovieCacheGetKeyDataFP getdatafp);
+struct MovieCache *IMB_moviecache_create(const char *name, int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp);
+void IMB_moviecache_set_getdata_callback(struct MovieCache *cache, MovieCacheGetKeyDataFP getdatafp);
+void IMB_moviecache_set_priority_callback(struct MovieCache *cache, MovieCacheGetPriorityDataFP getprioritydatafp,
+ MovieCacheGetItemPriorityFP getitempriorityfp,
+ MovieCachePriorityDeleterFP prioritydeleterfp);
+
void IMB_moviecache_put(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
struct ImBuf* IMB_moviecache_get(struct MovieCache *cache, void *userkey);
void IMB_moviecache_free(struct MovieCache *cache);
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index 5114fcb3ae0..5c389925274 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -36,12 +36,6 @@
*
*/
-/* imageprocess.c MIXED MODEL
- *
- * april 95
- *
- */
-
#include <stdlib.h>
#include "BLI_utildefines.h"
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index 6477d40d695..9fb4cbae383 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -864,7 +864,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags)
/*
* configure the event callbacks (not required)
- * setting of each callback is optionnal
+ * setting of each callback is optional
*/
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
event_mgr.error_handler = error_callback;
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 03c949bc3d1..aea120cd841 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -67,8 +67,8 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla
/*
* In principle there are 4 jpeg formats.
*
- * 1. jpeg - standard printing, u & v at quarter of resulution
- * 2. jvid - standaard video, u & v half resolution, frame not interlaced
+ * 1. jpeg - standard printing, u & v at quarter of resolution
+ * 2. jvid - standard video, u & v half resolution, frame not interlaced
*
* type 3 is unsupported as of jul 05 2000 Frank.
*
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index 2992e4a0aa7..671c79a0659 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -29,12 +29,15 @@
* \ingroup bke
*/
+#undef DEBUG_MESSAGES
+
#include <stdlib.h> /* for qsort */
#include <memory.h>
#include "MEM_guardedalloc.h"
#include "MEM_CacheLimiterC-Api.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_mempool.h"
@@ -44,20 +47,37 @@
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
+#ifdef DEBUG_MESSAGES
+# if defined __GNUC__ || defined __sun
+# define PRINT(format, args ...) printf(format, ##args)
+# else
+# define PRINT(format, ...) printf(__VA_ARGS__)
+# endif
+#else
+# define PRINT(format, ...)
+#endif
+
static MEM_CacheLimiterC *limitor = NULL;
typedef struct MovieCache {
+ char name[64];
+
GHash *hash;
GHashHashFP hashfp;
GHashCmpFP cmpfp;
MovieCacheGetKeyDataFP getdatafp;
+ MovieCacheGetPriorityDataFP getprioritydatafp;
+ MovieCacheGetItemPriorityFP getitempriorityfp;
+ MovieCachePriorityDeleterFP prioritydeleterfp;
+
struct BLI_mempool *keys_pool;
struct BLI_mempool *items_pool;
struct BLI_mempool *userkeys_pool;
int keysize;
- unsigned long curtime;
+
+ void *last_userkey;
int totseg, *points, proxy, render_flags; /* for visual statistics optimization */
int pad;
@@ -72,7 +92,7 @@ typedef struct MovieCacheItem {
MovieCache *cache_owner;
ImBuf *ibuf;
MEM_CacheLimiterHandleC *c_handle;
- unsigned long last_access;
+ void *priority_data;
} MovieCacheItem;
static unsigned int moviecache_hashhash(const void *keyv)
@@ -94,18 +114,27 @@ static void moviecache_keyfree(void *val)
{
MovieCacheKey *key = (MovieCacheKey *)val;
+ BLI_mempool_free(key->cache_owner->userkeys_pool, key->userkey);
+
BLI_mempool_free(key->cache_owner->keys_pool, key);
}
static void moviecache_valfree(void *val)
{
MovieCacheItem *item = (MovieCacheItem *)val;
+ MovieCache *cache = item->cache_owner;
+
+ PRINT("%s: cache '%s' free item %p buffer %p\n", __func__, cache->name, item, item->ibuf);
if (item->ibuf) {
MEM_CacheLimiter_unmanage(item->c_handle);
IMB_freeImBuf(item->ibuf);
}
+ if (item->priority_data && cache->prioritydeleterfp) {
+ cache->prioritydeleterfp(item->priority_data);
+ }
+
BLI_mempool_free(item->cache_owner->items_pool, item);
}
@@ -117,10 +146,17 @@ static void check_unused_keys(MovieCache *cache)
while (!BLI_ghashIterator_isDone(iter)) {
MovieCacheKey *key = BLI_ghashIterator_getKey(iter);
MovieCacheItem *item = BLI_ghashIterator_getValue(iter);
+ int remove = 0;
BLI_ghashIterator_step(iter);
- if (!item->ibuf)
+ remove = !item->ibuf;
+
+ if (remove) {
+ PRINT("%s: cache '%s' remove item %p without buffer\n", __func__, cache->name, item);
+ }
+
+ if (remove)
BLI_ghash_remove(cache->hash, key, moviecache_keyfree, moviecache_valfree);
}
@@ -137,12 +173,21 @@ static int compare_int(const void *av, const void *bv)
static void IMB_moviecache_destructor(void *p)
{
MovieCacheItem *item = (MovieCacheItem *) p;
+ MovieCache *cache = item->cache_owner;
+
+ PRINT("%s: cache '%s' destroy item %p buffer %p\n", __func__, cache->name, item, item->ibuf);
if (item && item->ibuf) {
IMB_freeImBuf(item->ibuf);
item->ibuf = NULL;
item->c_handle = NULL;
+
+ /* force cached segments to be updated */
+ if (cache->points) {
+ MEM_freeN(cache->points);
+ cache->points = NULL;
+ }
}
}
@@ -187,9 +232,30 @@ static size_t get_item_size(void *p)
return size;
}
+static int get_item_priority(void *item_v, int default_priority)
+{
+ MovieCacheItem *item = (MovieCacheItem *) item_v;
+ MovieCache *cache = item->cache_owner;
+ int priority;
+
+ if (!cache->getitempriorityfp) {
+ PRINT("%s: cache '%s' item %p use default priority %d\n", __func__, cache-> name, item, default_priority);
+
+ return default_priority;
+ }
+
+ priority = cache->getitempriorityfp(cache->last_userkey, item->priority_data);
+
+ PRINT("%s: cache '%s' item %p priority %d\n", __func__, cache-> name, item, priority);
+
+ return priority;
+}
+
void IMB_moviecache_init(void)
{
limitor = new_MEM_CacheLimiter(IMB_moviecache_destructor, get_item_size);
+
+ MEM_CacheLimiter_ItemPriority_Func_set(limitor, get_item_priority);
}
void IMB_moviecache_destruct(void)
@@ -198,12 +264,16 @@ void IMB_moviecache_destruct(void)
delete_MEM_CacheLimiter(limitor);
}
-MovieCache *IMB_moviecache_create(int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp,
- MovieCacheGetKeyDataFP getdatafp)
+MovieCache *IMB_moviecache_create(const char *name, int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp)
{
MovieCache *cache;
+ PRINT("%s: cache '%s' create\n", __func__, name);
+
cache = MEM_callocN(sizeof(MovieCache), "MovieCache");
+
+ BLI_strncpy(cache->name, name, sizeof(cache->name));
+
cache->keys_pool = BLI_mempool_create(sizeof(MovieCacheKey), 64, 64, 0);
cache->items_pool = BLI_mempool_create(sizeof(MovieCacheItem), 64, 64, 0);
cache->userkeys_pool = BLI_mempool_create(keysize, 64, 64, 0);
@@ -212,12 +282,27 @@ MovieCache *IMB_moviecache_create(int keysize, GHashHashFP hashfp, GHashCmpFP cm
cache->keysize = keysize;
cache->hashfp = hashfp;
cache->cmpfp = cmpfp;
- cache->getdatafp = getdatafp;
cache->proxy = -1;
return cache;
}
+void IMB_moviecache_set_getdata_callback(MovieCache *cache, MovieCacheGetKeyDataFP getdatafp)
+{
+ cache->getdatafp = getdatafp;
+}
+
+void IMB_moviecache_set_priority_callback(struct MovieCache *cache, MovieCacheGetPriorityDataFP getprioritydatafp,
+ MovieCacheGetItemPriorityFP getitempriorityfp,
+ MovieCachePriorityDeleterFP prioritydeleterfp)
+{
+ cache->last_userkey = MEM_mallocN(cache->keysize, "movie cache last user key");
+
+ cache->getprioritydatafp = getprioritydatafp;
+ cache->getitempriorityfp = getitempriorityfp;
+ cache->prioritydeleterfp = prioritydeleterfp;
+}
+
void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
{
MovieCacheKey *key;
@@ -234,16 +319,27 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
memcpy(key->userkey, userkey, cache->keysize);
item = BLI_mempool_alloc(cache->items_pool);
+
+ PRINT("%s: cache '%s' put %p, item %p\n", __func__, cache-> name, ibuf, item);
+
item->ibuf = ibuf;
item->cache_owner = cache;
- item->last_access = cache->curtime++;
item->c_handle = NULL;
+ item->priority_data = NULL;
+
+ if (cache->getprioritydatafp) {
+ item->priority_data = cache->getprioritydatafp(userkey);
+ }
BLI_ghash_remove(cache->hash, key, moviecache_keyfree, moviecache_valfree);
BLI_ghash_insert(cache->hash, key, item);
item->c_handle = MEM_CacheLimiter_insert(limitor, item);
+ if (cache->last_userkey) {
+ memcpy(cache->last_userkey, userkey, cache->keysize);
+ }
+
MEM_CacheLimiter_ref(item->c_handle);
MEM_CacheLimiter_enforce_limits(limitor);
MEM_CacheLimiter_unref(item->c_handle);
@@ -267,8 +363,6 @@ ImBuf *IMB_moviecache_get(MovieCache *cache, void *userkey)
item = (MovieCacheItem *)BLI_ghash_lookup(cache->hash, &key);
if (item) {
- item->last_access = cache->curtime++;
-
if (item->ibuf) {
MEM_CacheLimiter_touch(item->c_handle);
IMB_refImBuf(item->ibuf);
@@ -282,6 +376,8 @@ ImBuf *IMB_moviecache_get(MovieCache *cache, void *userkey)
void IMB_moviecache_free(MovieCache *cache)
{
+ PRINT("%s: create '%s' free\n", __func__, cache->name);
+
BLI_ghash_free(cache->hash, moviecache_keyfree, moviecache_valfree);
BLI_mempool_destroy(cache->keys_pool);
@@ -291,6 +387,9 @@ void IMB_moviecache_free(MovieCache *cache)
if (cache->points)
MEM_freeN(cache->points);
+ if (cache->last_userkey)
+ MEM_freeN(cache->last_userkey);
+
MEM_freeN(cache);
}
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 27034317396..810cb88c06e 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -774,7 +774,7 @@ static void q_scale_float(float *in, float *out, int in_width,
* Should be comparable in speed to the ImBuf ..._fast functions at least
* for byte-buffers.
*
- * NOTE: disabled, due to inacceptable inaccuracy and quality loss, see bug #18609 (ton)
+ * NOTE: disabled, due to unacceptable inaccuracy and quality loss, see bug #18609 (ton)
*/
static int q_scale_linear_interpolation(
struct ImBuf *ibuf, int newx, int newy)
@@ -1460,7 +1460,7 @@ struct ImBuf *IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int
scalefast_Z_ImBuf(ibuf, newx, newy);
/* try to scale common cases in a fast way */
- /* disabled, quality loss is inacceptable, see report #18609 (ton) */
+ /* disabled, quality loss is unacceptable, see report #18609 (ton) */
if (0 && q_scale_linear_interpolation(ibuf, newx, newy)) {
return ibuf;
}
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 17ee8723e53..7cf0d588710 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -628,7 +628,7 @@ typedef enum eNlaStrip_Flag {
/* NLA strip length is synced to the length of the referenced action */
NLASTRIP_FLAG_SYNC_LENGTH = (1<<9),
- /* playback flags (may be overriden by F-Curves) */
+ /* playback flags (may be overridden by F-Curves) */
/* NLA strip blendin/out values are set automatically based on overlaps */
NLASTRIP_FLAG_AUTO_BLENDS = (1<<10),
/* NLA strip is played back in reverse order */
diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h
index 52fedd72e86..60bc3ee0ffc 100644
--- a/source/blender/makesdna/DNA_mask_types.h
+++ b/source/blender/makesdna/DNA_mask_types.h
@@ -127,6 +127,8 @@ typedef struct MaskLayer {
float alpha;
char blend;
char blend_flag;
+ char falloff;
+ char pad[7];
char flag; /* for animation */
char restrictflag; /* matching 'Object' flag of the same name - eventually use in the outliner */
@@ -137,7 +139,10 @@ typedef struct MaskLayer {
/* MaskSpline->flag */
/* reserve (1 << 0) for SELECT */
-#define MASK_SPLINE_CYCLIC (1 << 1)
+enum {
+ MASK_SPLINE_CYCLIC = (1 << 1),
+ MASK_SPLINE_NOFILL = (1 << 2)
+};
/* MaskSpline->weight_interp */
#define MASK_SPLINE_INTERP_LINEAR 1
@@ -162,8 +167,13 @@ enum {
/* masklay->blend */
enum {
- MASK_BLEND_ADD = 0,
- MASK_BLEND_SUBTRACT = 1
+ MASK_BLEND_ADD = 0,
+ MASK_BLEND_SUBTRACT = 1,
+ MASK_BLEND_LIGHTEN = 2,
+ MASK_BLEND_DARKEN = 3,
+ MASK_BLEND_MUL = 4,
+ MASK_BLEND_REPLACE = 5,
+ MASK_BLEND_DIFFERENCE = 6
};
/* masklay->blend_flag */
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index e4b5a264ba3..a7f854f603c 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -178,9 +178,7 @@ typedef struct bNode {
char label[64]; /* custom user-defined label, MAX_NAME */
short custom1, custom2; /* to be abused for buttons */
float custom3, custom4;
- int highlight; /* 0 = not highlighted, 1-N = highlighted*/
- int pad;
-
+
short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */
void *threaddata; /* optional extra storage for use in thread (read only then!) */
rctf totr; /* entire boundbox */
@@ -376,6 +374,10 @@ enum {
CMP_NODEFLAG_MASK_NO_FEATHER = (1 << 1)
};
+enum {
+ CMP_NODEFLAG_BLUR_REFERENCE = (1 << 0),
+};
+
typedef struct NodeFrame {
short flag;
short label_size;
@@ -654,6 +656,7 @@ typedef struct NodeKeyingScreenData {
typedef struct NodeKeyingData {
float screen_balance;
float despill_factor;
+ float despill_balance;
int edge_kernel_radius;
float edge_kernel_tolerance;
float clip_black, clip_white;
@@ -663,6 +666,11 @@ typedef struct NodeKeyingData {
int blur_pre, blur_post;
} NodeKeyingData;
+typedef struct NodeTrackPosData {
+ char tracking_object[64];
+ char track_name[64];
+} NodeTrackPosData;
+
/* frame node flags */
#define NODE_FRAME_SHRINK 1 /* keep the bounding box minimal */
#define NODE_FRAME_RESIZEABLE 2 /* test flag, if frame can be resized by user */
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 606c466ac74..5257fb6e2cf 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -204,7 +204,7 @@ typedef struct Tex {
/* newnoise: musgrave parameters */
float mg_H, mg_lacunarity, mg_octaves, mg_offset, mg_gain;
- /* newnoise: distorted noise amount, musgrave & voronoi ouput scale */
+ /* newnoise: distorted noise amount, musgrave & voronoi output scale */
float dist_amount, ns_outscale;
/* newnoise: voronoi nearest neighbor weights, minkovsky exponent, distance metric & color type */
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 8be743335cc..f5cf7e3ea3b 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -105,7 +105,7 @@ typedef long long __int64;
* - location within a struct (everthing can be randomly mixed up)
* - struct within struct (within struct etc), this is recursive
* - adding new elements, will be default initialized zero
- * - remving elements
+ * - removing elements
* - change of array sizes
* - change of a pointer type: when the name doesn't change the contents is copied
*
@@ -122,7 +122,7 @@ typedef long long __int64;
* - only use a long in Blender if you want this to be the size of a pointer. so it is
* 32 bits or 64 bits, dependent at the cpu architecture
* - chars are always unsigned
- * - aligment of variables has to be done in such a way, that any system does
+ * - alignment of variables has to be done in such a way, that any system does
* not create 'padding' (gaps) in structures. So make sure that:
* - short: 2 aligned
* - int: 4 aligned
@@ -556,7 +556,7 @@ static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr)
/* Unsure of exact function - compares the sdna argument to
* newsdna and sets up the information necessary to convert
- * data written with a dna of oldsdna to inmemory data with a
+ * data written with a dna of oldsdna to in-memory data with a
* structure defined by the newsdna sdna (I think). -zr
*/
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index a0614a9d82a..2fbee1e9e1a 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -127,6 +127,8 @@ extern EnumPropertyItem ramp_blend_items[];
extern EnumPropertyItem prop_dynamicpaint_type_items[];
+extern EnumPropertyItem clip_editor_mode_items[];
+
struct bContext;
struct PointerRNA;
struct PropertyRNA;
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 348efaed8c6..511999dfa37 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -203,7 +203,7 @@ typedef enum PropertyFlag {
PROP_CONTEXT_UPDATE = (1 << 22),
PROP_CONTEXT_PROPERTY_UPDATE = (1 << 22) | (1 << 27),
- /* Use for arrays or for any data that should not have a referene kept
+ /* Use for arrays or for any data that should not have a reference kept
* most common case is functions that return arrays where the array */
PROP_THICK_WRAP = (1 << 23),
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 5eb15cf31b6..a0d64723a5c 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -55,7 +55,7 @@ EnumPropertyItem fmodifier_type_items[] = {
{FMODIFIER_TYPE_ENVELOPE, "ENVELOPE", 0, "Envelope", ""},
{FMODIFIER_TYPE_CYCLES, "CYCLES", 0, "Cycles", ""},
{FMODIFIER_TYPE_NOISE, "NOISE", 0, "Noise", ""},
- {FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""},
+ /*{FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""},*/ /* FIXME: not implemented yet! */
/*{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""}, *//* FIXME: not implemented yet! */
{FMODIFIER_TYPE_LIMITS, "LIMITS", 0, "Limits", ""},
{FMODIFIER_TYPE_STEPPED, "STEPPED", 0, "Stepped Interpolation", ""},
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index 6e42b47afce..d4082cf3d9f 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -224,6 +224,10 @@ static void rna_def_latticepoint(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "LatticePoint", "Point in the lattice grid");
RNA_def_struct_path_func(srna, "rna_LatticePoint_path");
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
+ RNA_def_property_ui_text(prop, "Point selected", "Selection status");
+
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index b879d2b19f7..2987057aeb6 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -35,6 +35,7 @@
#include "BKE_tracking.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "rna_internal.h"
@@ -565,7 +566,14 @@ static void rna_def_maskSpline(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_CYCLIC);
RNA_def_property_ui_text(prop, "Cyclic", "Make this spline a closed loop");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
+
+ /* fill */
+ prop = RNA_def_property(srna, "use_fill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_SPLINE_NOFILL);
+ RNA_def_property_ui_text(prop, "Fill", "Make this spline filled");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
}
static void rna_def_mask_layer(BlenderRNA *brna)
@@ -573,6 +581,11 @@ static void rna_def_mask_layer(BlenderRNA *brna)
static EnumPropertyItem masklay_blend_mode_items[] = {
{MASK_BLEND_ADD, "ADD", 0, "Add", ""},
{MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
+ {MASK_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
+ {MASK_BLEND_DARKEN, "DARKEN", 0, "Darken", ""},
+ {MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
+ {MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
+ {MASK_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -629,7 +642,7 @@ static void rna_def_mask_layer(BlenderRNA *brna)
/* render settings */
prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "alpha");
- RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
RNA_def_property_ui_text(prop, "Opacity", "Render Opacity");
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
@@ -646,6 +659,12 @@ static void rna_def_mask_layer(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Restrict View", "Invert the mask black/white");
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+ prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "falloff");
+ RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items);
+ RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+
}
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index edfbf0f2efd..b47f957ac76 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -357,6 +357,43 @@ static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *report
}
}
+/* Set the 'solo' setting for the given NLA-track, making sure that it is the only one
+ * that has this status in its AnimData block.
+ */
+void rna_NlaTrack_solo_set(PointerRNA *ptr, int value)
+{
+ NlaTrack *data = (NlaTrack*)ptr->data;
+ AnimData *adt = BKE_animdata_from_id(ptr->id.data);
+ NlaTrack *nt;
+
+ if (data == NULL) {
+ return;
+ }
+
+ /* firstly, make sure 'solo' flag for all tracks is disabled */
+ for (nt = data; nt; nt = nt->next) {
+ nt->flag &= ~NLATRACK_SOLO;
+ }
+ for (nt = data; nt; nt = nt->prev) {
+ nt->flag &= ~NLATRACK_SOLO;
+ }
+
+ /* now, enable 'solo' for the given track if appropriate */
+ if (value) {
+ /* set solo status */
+ data->flag |= NLATRACK_SOLO;
+
+ /* set solo-status on AnimData */
+ adt->flag |= ADT_NLA_SOLO_TRACK;
+ }
+ else {
+ /* solo status was already cleared on track */
+
+ /* clear solo-status on AnimData */
+ adt->flag &= ~ADT_NLA_SOLO_TRACK;
+ }
+}
+
#else
/* enum defines exported for rna_animation.c */
@@ -637,13 +674,13 @@ static void rna_def_nlatrack(BlenderRNA *brna)
prop = RNA_def_property(srna, "is_solo", PROP_BOOLEAN, PROP_NONE);
/* can be made editable by hooking it up to the necessary NLA API methods */
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SOLO);
RNA_def_property_ui_text(prop, "Solo",
"NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the "
"same AnimData block are disabled)");
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
-
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaTrack_solo_set");
+
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SELECTED);
RNA_def_property_ui_text(prop, "Select", "NLA Track is selected");
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index a39c168c594..055c8dcbebb 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1191,6 +1191,11 @@ static void def_math(StructRNA *srna)
RNA_def_property_enum_items(prop, node_math_items);
RNA_def_property_ui_text(prop, "Operation", "");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
+ RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_vector_math(StructRNA *srna)
@@ -1272,6 +1277,11 @@ static void def_mix_rgb(StructRNA *srna)
RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", 2);
+ RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_texture(StructRNA *srna)
@@ -1703,6 +1713,11 @@ static void def_cmp_blur(StructRNA *srna)
{0, NULL, 0, NULL, NULL}
};
+ prop = RNA_def_property(srna, "use_reference", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_REFERENCE);
+ RNA_def_property_ui_text(prop, "Reference", "Use size socket as a reference image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
@@ -1761,7 +1776,6 @@ static void def_cmp_blur(StructRNA *srna)
RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1);
RNA_def_property_ui_text(prop, "Gamma", "Apply filter on gamma corrected values");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
}
static void def_cmp_filter(StructRNA *srna)
@@ -3580,7 +3594,13 @@ static void def_cmp_keying(StructRNA *srna)
prop = RNA_def_property(srna, "despill_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "despill_factor");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Despill", "Factor of despilling screen color from image");
+ RNA_def_property_ui_text(prop, "Despill Factor", "Factor of despilling screen color from image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "despill_balance", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "despill_balance");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Despill Balance", "Balance between non-key colors used to detect amount of key color to be removed");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "clip_black", PROP_FLOAT, PROP_FACTOR);
@@ -3638,6 +3658,35 @@ static void def_cmp_keying(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+static void def_cmp_trackpos(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(prop, "Relative", "Return relative position to first track's marker");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeTrackPosData", "storage");
+
+ prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "tracking_object");
+ RNA_def_property_ui_text(prop, "Tracking Object", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "track_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "track_name");
+ RNA_def_property_ui_text(prop, "Track", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+}
+
/* -- Texture Nodes --------------------------------------------------------- */
static void def_tex_output(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index 5ebaddda043..a4837a88b17 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -170,6 +170,7 @@ DefNode( CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection,"COLOR
DefNode( CompositorNode, CMP_NODE_MASK, def_cmp_mask, "MASK", Mask, "Mask", "" )
DefNode( CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, "KEYINGSCREEN", KeyingScreen, "KeyingScreen", "" )
DefNode( CompositorNode, CMP_NODE_KEYING, def_cmp_keying, "KEYING", Keying, "Keying", "" )
+DefNode( CompositorNode, CMP_NODE_TRACKPOS, def_cmp_trackpos, "TRACKPOS", TrackPos, "Track Position", "" )
DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" )
DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" )
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index a3e538da9b1..ae8c331bf1e 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -84,7 +84,9 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
switch (ob->type) {
case OB_FONT:
case OB_CURVE:
- case OB_SURF:
+ case OB_SURF: {
+ ListBase dispbase = {NULL, NULL};
+ DerivedMesh *derivedFinal = NULL;
/* copies object and modifiers (but not the data) */
tmpobj = BKE_object_copy(ob);
@@ -105,12 +107,16 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
copycu->editnurb = tmpcu->editnurb;
/* get updated display list, and convert to a mesh */
- BKE_displist_make_curveTypes(sce, tmpobj, 0);
+ BKE_displist_make_curveTypes_forRender(sce, tmpobj, &dispbase, &derivedFinal, FALSE);
copycu->editfont = NULL;
copycu->editnurb = NULL;
- BKE_mesh_from_nurbs(tmpobj);
+ tmpobj->derivedFinal = derivedFinal;
+
+ BKE_mesh_from_nurbs_displist(tmpobj, &dispbase);
+
+ BKE_displist_free(&dispbase);
/* BKE_mesh_from_nurbs changes the type to a mesh, check it worked */
if (tmpobj->type != OB_MESH) {
@@ -121,6 +127,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
tmpmesh = tmpobj->data;
BKE_libblock_free_us(&G.main->object, tmpobj);
break;
+ }
case OB_MBALL: {
/* metaballs don't have modifiers, so just convert to mesh */
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 13b60498900..61be48f3f02 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -60,7 +60,7 @@ void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
BKE_scene_update_for_newframe(G.main, scene, (1 << 20) - 1);
BKE_scene_camera_switch_update(scene);
- /* cant use NC_SCENE|ND_FRAME because this casues wm_event_do_notifiers to call
+ /* cant use NC_SCENE|ND_FRAME because this causes wm_event_do_notifiers to call
* BKE_scene_update_for_newframe which will loose any un-keyed changes [#24690] */
/* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index fb8ba2f863e..5c851550cc6 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -59,7 +59,7 @@ typedef struct EffectInfo {
#ifdef RNA_RUNTIME
-/* build a temp referene to the parent */
+/* build a temp reference to the parent */
static void meta_tmp_ref(Sequence *seq_par, Sequence *seq)
{
for (; seq; seq = seq->next) {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index d5bac7a8c26..4473a9ef0f6 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -118,6 +118,15 @@ EnumPropertyItem viewport_shade_items[] = {
{0, NULL, 0, NULL, NULL}
};
+EnumPropertyItem clip_editor_mode_items[] = {
+ {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
+ {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
+ "Show tracking/reconstruction tools"},
+ {SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
+ {SC_MODE_MASKEDIT, "MASKEDIT", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
+ {0, NULL, 0, NULL, NULL}
+};
+
#ifdef RNA_RUNTIME
#include "DNA_anim_types.h"
@@ -3011,15 +3020,6 @@ static void rna_def_space_clip(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem mode_items[] = {
- {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
- {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
- "Show tracking/reconstruction tools"},
- {SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
- {SC_MODE_MASKEDIT, "MASKEDIT", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
- {0, NULL, 0, NULL, NULL}
- };
-
static EnumPropertyItem view_items[] = {
{SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"},
{SC_VIEW_GRAPH, "GRAPH", ICON_IPO, "Graph", "Show graph view for active element"},
@@ -3086,7 +3086,7 @@ static void rna_def_space_clip(BlenderRNA *brna)
/* mode */
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_enum_items(prop, clip_editor_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_clip_mode_update");
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 0270a7643a6..483e3ab7f8a 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -1443,12 +1443,12 @@ static void rna_def_texture_voronoi(BlenderRNA *brna)
"The length of the distance in axial directions"},
{TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev",
"The length of the longest Axial journey"},
- {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkovsky 1/2",
- "Set Minkovsky variable to 0.5"},
- {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkovsky 4",
- "Set Minkovsky variable to 4"},
- {TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkovsky",
- "Use the Minkowsky function to calculate distance "
+ {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkowski 1/2",
+ "Set Minkowski variable to 0.5"},
+ {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkowski 4",
+ "Set Minkowski variable to 4"},
+ {TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkowski",
+ "Use the Minkowski function to calculate distance "
"(exponent value determines the shape of the boundaries)"},
{0, NULL, 0, NULL, NULL}
};
@@ -1494,7 +1494,7 @@ static void rna_def_texture_voronoi(BlenderRNA *brna)
prop = RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vn_mexp");
RNA_def_property_range(prop, 0.01, 10);
- RNA_def_property_ui_text(prop, "Minkovsky Exponent", "Minkovsky exponent");
+ RNA_def_property_ui_text(prop, "Minkowski Exponent", "Minkowski exponent");
RNA_def_property_update(prop, 0, "rna_Texture_update");
prop = RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index a4ba9ba35bb..26682e30841 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -172,7 +172,7 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
BMElem *ele;
int *index_map, i;
- BMO_op_initf(bm, &find_op,
+ BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"find_doubles verts=%av dist=%f keep_verts=%s",
amd->merge_dist, dupe_op, "geom");
@@ -189,7 +189,7 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
i++;
}
/* above loops over all, so set all to dirty, if this is somehow
- * setting valid values, this line can be remvoed - campbell */
+ * setting valid values, this line can be removed - campbell */
bm->elem_index_dirty |= BM_VERT | BM_EDGE | BM_FACE;
(*index_map_length) = i;
@@ -234,7 +234,7 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
BMOIter oiter;
BMOperator find_op;
- BMO_op_initf(bm, &find_op,
+ BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"find_doubles verts=%Hv dist=%f keep_verts=%s",
BM_ELEM_TAG, amd->merge_dist,
dupe_op, dupe_slot_name);
@@ -286,7 +286,7 @@ static void merge_first_last(BMesh *bm,
BMOIter oiter;
BMVert *v, *v2;
- BMO_op_initf(bm, &find_op,
+ BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"find_doubles verts=%s dist=%f keep_verts=%s",
dupe_first, "geom", amd->merge_dist,
dupe_first, "geom");
@@ -410,9 +410,11 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
bmesh_edit_begin(em->bm, 0);
if (amd->flags & MOD_ARR_MERGE)
- BMO_op_init(em->bm, &weld_op, "weld_verts");
+ BMO_op_init(em->bm, &weld_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+ "weld_verts");
- BMO_op_initf(em->bm, &dupe_op, "duplicate geom=%avef");
+ BMO_op_initf(em->bm, &dupe_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+ "duplicate geom=%avef");
first_dupe_op = dupe_op;
for (j = 0; j < count - 1; j++) {
@@ -421,8 +423,11 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
BMOpSlot *newout_slot;
BMOIter oiter;
- if (j != 0)
- BMO_op_initf(em->bm, &dupe_op, "duplicate geom=%s", &old_dupe_op, "newout");
+ if (j != 0) {
+ BMO_op_initf(em->bm, &dupe_op,
+ (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+ "duplicate geom=%s", &old_dupe_op, "newout");
+ }
BMO_op_exec(em->bm, &dupe_op);
geom_slot = BMO_slot_get(&dupe_op, "geom");
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 6c91cd6e2d1..cdb200ff180 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -143,7 +143,8 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
}
}
- BMO_op_callf(bm, "bevel geom=%fe percent=%f use_even=%b use_dist=%b",
+ BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
+ "bevel geom=%fe percent=%f use_even=%b use_dist=%b",
EDGE_MARK, bmd->value, (bmd->flags & BME_BEVEL_EVEN) != 0, (bmd->flags & BME_BEVEL_DIST) != 0);
BMO_pop(bm);
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 5e791a9f748..c80b4dfa4de 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -381,9 +381,9 @@ static void cuboid_do(
}
/* we want a symmetric bound box around the origin */
- if (fabs(min[0]) > fabs(max[0])) max[0] = fabs(min[0]);
- if (fabs(min[1]) > fabs(max[1])) max[1] = fabs(min[1]);
- if (fabs(min[2]) > fabs(max[2])) max[2] = fabs(min[2]);
+ if (fabsf(min[0]) > fabsf(max[0])) max[0] = fabsf(min[0]);
+ if (fabsf(min[1]) > fabsf(max[1])) max[1] = fabsf(min[1]);
+ if (fabsf(min[2]) > fabsf(max[2])) max[2] = fabsf(min[2]);
min[0] = -max[0];
min[1] = -max[1];
min[2] = -max[2];
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 39d78f777a0..b1c3459bf51 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -79,7 +79,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
if ((l1 = e->l) &&
(l2 = e->l->radial_next) != l1)
{
- if (/* 3+ faces on thsi edge, always split */
+ if (/* 3+ faces on this edge, always split */
UNLIKELY(l1 != l2->radial_next) ||
/* 2 face edge - check angle*/
(dot_v3v3(l1->f->no, l2->f->no) < threshold))
@@ -103,7 +103,8 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
}
}
- BMO_op_callf(bm, "split_edges edges=%fe", EDGE_MARK);
+ BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
+ "split_edges edges=%fe", EDGE_MARK);
BMO_pop(bm);
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 74026efecc5..c034832bfb4 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -238,8 +238,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* TODO: incremental rotations somehow */
if (state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) {
- state.rot[0] = 1;
- state.rot[1] = state.rot[2] = state.rot[3] = 0.0f;
+ unit_qt(state.rot);
}
else {
float temp[3] = {0.0f, 0.0f, 0.0f};
@@ -250,7 +249,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* state.vel[axis] is the only component surviving from a dot product with the axis */
axis_angle_to_quat(state.rot, cross, saacos(state.vel[axis]));
}
-
}
else {
state.time = -1.0;
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 46987f30205..50e7a3e6da9 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -91,6 +91,7 @@ typedef enum {
CAP_START = 1,
CAP_END = 2,
SEAM_FRAME = 4,
+ ROOT = 8
} SkinNodeFlag;
typedef struct Frame {
@@ -235,7 +236,8 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
* selected after the operator is run */
BM_mesh_elem_hflag_disable_all(bm, BM_ALL, BM_ELEM_SELECT, 0);
- BMO_op_initf(bm, &op, "convex_hull input=%hv", BM_ELEM_TAG);
+ BMO_op_initf(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+ "convex_hull input=%hv", BM_ELEM_TAG);
BMO_op_exec(bm, &op);
if (BMO_error_occurred(bm)) {
@@ -318,7 +320,9 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
BMO_op_finish(bm, &op);
- BMO_op_callf(bm, "delete geom=%hef context=%i", BM_ELEM_TAG, DEL_ONLYTAGGED);
+ BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
+ "delete geom=%hef context=%i",
+ BM_ELEM_TAG, DEL_ONLYTAGGED);
return TRUE;
}
@@ -502,6 +506,9 @@ static void end_node_frames(int v, SkinNode *skin_nodes, const MVert *mvert,
/* End frame */
create_frame(&skin_nodes[v].frames[0], mvert[v].co, rad, mat, 0);
}
+
+ if (nodes[v].flag & MVERT_SKIN_ROOT)
+ skin_nodes[v].flag |= ROOT;
}
/* Returns 1 for seam, 0 otherwise */
@@ -1035,7 +1042,7 @@ static BMFace *collapse_face_corners(BMesh *bm, BMFace *f, int n,
int i;
shortest_edge = BM_face_find_shortest_loop(f)->e;
- BMO_op_initf(bm, &op, "weld_verts");
+ BMO_op_initf(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), "weld_verts");
/* Note: could probably calculate merges in one go to be
* faster */
@@ -1175,7 +1182,8 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
/* Extrude the split face */
BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
BM_elem_flag_enable(split_face, BM_ELEM_TAG);
- BMO_op_initf(bm, &op, "extrude_discrete_faces faces=%hf", BM_ELEM_TAG);
+ BMO_op_initf(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+ "extrude_discrete_faces faces=%hf", BM_ELEM_TAG);
BMO_op_exec(bm, &op);
/* Update split face (should only be one new face created
@@ -1198,7 +1206,8 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
BM_mesh_elem_hflag_disable_all(bm, BM_EDGE, BM_ELEM_TAG, FALSE);
BM_elem_flag_enable(longest_edge, BM_ELEM_TAG);
- BMO_op_callf(bm, "subdivide_edges edges=%he numcuts=%i quadcornertype=%i",
+ BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
+ "subdivide_edges edges=%he numcuts=%i quadcornertype=%i",
BM_ELEM_TAG, 1, SUBD_STRAIGHT_CUT);
}
else if (split_face->len > 4) {
@@ -1230,7 +1239,8 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
/* Delete split face and merge */
BM_face_kill(bm, split_face);
- BMO_op_init(bm, &op, "weld_verts");
+ BMO_op_init(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
+ "weld_verts");
for (i = 0; i < 4; i++) {
BMO_slot_map_ptr_insert(bm, &op, "targetmap",
verts[i], frame->verts[best_order[i]]);
@@ -1395,7 +1405,9 @@ static void hull_merge_triangles(SkinOutput *so, const SkinModifierData *smd)
}
}
- BMO_op_callf(so->bm, "delete geom=%hef context=%i", BM_ELEM_TAG, DEL_ONLYTAGGED);
+ BMO_op_callf(so->bm, BMO_FLAG_DEFAULTS,
+ "delete geom=%hef context=%i",
+ BM_ELEM_TAG, DEL_ONLYTAGGED);
BLI_heap_free(heap, NULL);
}
@@ -1493,18 +1505,27 @@ static void skin_output_end_nodes(SkinOutput *so, SkinNode *skin_nodes,
}
if (sn->flag & CAP_START) {
- add_poly(so,
- sn->frames[0].verts[3],
- sn->frames[0].verts[2],
- sn->frames[0].verts[1],
- sn->frames[0].verts[0]);
+ if (sn->flag & ROOT) {
+ add_poly(so,
+ sn->frames[0].verts[0],
+ sn->frames[0].verts[1],
+ sn->frames[0].verts[2],
+ sn->frames[0].verts[3]);
+ }
+ else {
+ add_poly(so,
+ sn->frames[0].verts[3],
+ sn->frames[0].verts[2],
+ sn->frames[0].verts[1],
+ sn->frames[0].verts[0]);
+ }
}
if (sn->flag & CAP_END) {
add_poly(so,
- sn->frames[1].verts[3],
- sn->frames[1].verts[2],
+ sn->frames[1].verts[0],
sn->frames[1].verts[1],
- sn->frames[1].verts[0]);
+ sn->frames[1].verts[2],
+ sn->frames[1].verts[3]);
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 6f8e65a6e8e..fc74b446762 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -199,7 +199,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
return dataMask;
}
-/* spesific function for solidify - define locally */
+/* specific function for solidify - define locally */
BLI_INLINE void madd_v3v3short_fl(float r[3], const short a[3], const float f)
{
r[0] += (float)a[0] * f;
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 70b9eafdac5..d5deb50e1f9 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -183,7 +183,7 @@ static float get_ob2ob_distance(const Object *ob, const Object *obr)
}
/**
- * Maps distances to weights, with an optionnal "smoothing" mapping.
+ * Maps distances to weights, with an optional "smoothing" mapping.
*/
void do_map(float *weights, const int nidx, const float min_d, const float max_d, short mode)
{
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index ce5ce1d87c1..e8dd4acb63b 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -103,6 +103,7 @@ set(SRC
composite/nodes/node_composite_stabilize2d.c
composite/nodes/node_composite_texture.c
composite/nodes/node_composite_tonemap.c
+ composite/nodes/node_composite_trackpos.c
composite/nodes/node_composite_transform.c
composite/nodes/node_composite_translate.c
composite/nodes/node_composite_valToRgb.c
diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h
index 33d6327ece1..3b4fa49ea05 100644
--- a/source/blender/nodes/NOD_composite.h
+++ b/source/blender/nodes/NOD_composite.h
@@ -132,4 +132,6 @@ void register_node_type_cmp_bokehimage(struct bNodeTreeType *ttype);
void register_node_type_cmp_bokehblur(struct bNodeTreeType *ttype);
void register_node_type_cmp_switch(struct bNodeTreeType *ttype);
+void register_node_type_cmp_trackpos(struct bNodeTreeType *ttype);
+
#endif
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index b9acf821efe..18ab3b7d6d1 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -61,7 +61,7 @@
#include "node_composite_util.h"
#ifdef WITH_COMPOSITOR
-# include "COM_compositor.h"
+ #include "COM_compositor.h"
#endif
static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
@@ -684,6 +684,8 @@ static void ntreeCompositExecTreeOld(bNodeTree *ntree, RenderData *rd, int do_pr
}
#endif
+void *COM_linker_hack = NULL;
+
void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int do_preview)
{
#ifdef WITH_COMPOSITOR
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index 98ded3ea3b3..1b9ff610e4c 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -647,7 +647,7 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
if (stackbuf_use!=stackbuf)
free_compbuf(stackbuf_use);
- BLI_lock_thread(LOCK_PREVIEW);
+ // BLI_lock_thread(LOCK_PREVIEW);
if (preview->rect)
MEM_freeN(preview->rect);
@@ -655,7 +655,7 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
preview->ysize= ysize;
preview->rect= rect;
- BLI_unlock_thread(LOCK_PREVIEW);
+ // BLI_unlock_thread(LOCK_PREVIEW);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
index 6eb70636efa..c206b9a1a5d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
@@ -909,7 +909,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
int x; // x = pixel loop counter
int a; // a = temporary pixel index buffer loop counter
unsigned int ud; // ud = unscaled edge distance
- unsigned int dmin; // dmin = minimun edge distance
+ unsigned int dmin; // dmin = minimum edge distance
unsigned int rsl; // long used for finding fast 1.0/sqrt
unsigned int gradientFillOffset;
@@ -1027,7 +1027,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
unsigned int gradientFillOffset;
unsigned int t;
unsigned int ud; // ud = unscaled edge distance
- unsigned int dmin; // dmin = minimun edge distance
+ unsigned int dmin; // dmin = minimum edge distance
float odist; // odist = current outer edge distance
float idist; // idist = current inner edge distance
int dx; // dx = X-delta (used for distance proportion calculation)
@@ -1084,7 +1084,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
* pixel color as |GI| / (|GI| + |GO|). Since these are reciprocals, GI serves the
* purpose of GO for the proportion calculation.
*
- * For the purposes of the minimun distance comparisons, we only check
+ * For the purposes of the minimum distance comparisons, we only check
* the sums-of-squares against each other, since they are in the same
* mathematical sort-order as if we did go ahead and take square roots
*
@@ -1130,7 +1130,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
/*
* Note once again that since we are using reciprocals of distance values our
* proportion is already the correct intensity, and does not need to be
- * subracted from 1.0 like it would have if we used real distances.
+ * subtracted from 1.0 like it would have if we used real distances.
*/
/*
diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.c b/source/blender/nodes/composite/nodes/node_composite_keying.c
index f37c3686e2b..f3074bc8ed3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keying.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keying.c
@@ -71,6 +71,7 @@ static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode* node, bNo
data = MEM_callocN(sizeof(NodeKeyingData), "node keying data");
data->screen_balance = 0.5f;
+ data->despill_balance = 0.5f;
data->despill_factor = 1.0f;
data->edge_kernel_radius = 3;
data->edge_kernel_tolerance = 0.1f;
diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.c b/source/blender/nodes/composite/nodes/node_composite_trackpos.c
new file mode 100644
index 00000000000..09eb42b4d93
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.c
@@ -0,0 +1,65 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/composite/nodes/node_composite_movieclip.c
+ * \ingroup cmpnodes
+ */
+
+
+#include "node_composite_util.h"
+
+static bNodeSocketTemplate cmp_node_trackpos_out[] = {
+ { SOCK_FLOAT, 1, N_("X")},
+ { SOCK_FLOAT, 1, N_("Y")},
+ { -1, 0, "" }
+};
+
+static void node_composit_exec_trackpos(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
+{
+}
+
+static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ NodeTrackPosData *data = MEM_callocN(sizeof(NodeTrackPosData), "node track position data");
+
+ node->storage = data;
+}
+
+void register_node_type_cmp_trackpos(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, cmp_node_trackpos_out);
+ node_type_size(&ntype, 120, 80, 300);
+ node_type_init(&ntype, init);
+ node_type_storage(&ntype, "NodeTrackPosData", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, node_composit_exec_trackpos);
+
+ nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 9aa3c76e0a5..56704b981be 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -211,7 +211,7 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns)
gs->name = "";
gs->hasinput= ns->hasinput && ns->data;
- /* XXX Commented out the ns->data check here, as it seems it's not alwas set,
+ /* XXX Commented out the ns->data check here, as it seems it's not always set,
* even though there *is* a valid connection/output... But that might need
* further investigation.
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index 98382e24290..4832f19f2c7 100644
--- a/source/blender/nodes/texture/nodes/node_texture_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -65,7 +65,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
if (node->custom2 || node->need_exec==0) {
/* this node refers to its own texture tree! */
- copy_v4_v4(out, (fabs(co[0] - co[1]) < 0.01) ? white : red);
+ copy_v4_v4(out, (fabsf(co[0] - co[1]) < 0.01f) ? white : red);
}
else if (nodetex) {
TexResult texres;
diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c
index 53ddcecd7a8..9c871f14a68 100644
--- a/source/blender/python/bmesh/bmesh_py_ops.c
+++ b/source/blender/python/bmesh/bmesh_py_ops.c
@@ -109,7 +109,8 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
}
/* TODO - error check this!, though we do the error check on attribute access */
- BMO_op_init(bm, &bmop, self->opname);
+ /* TODO - make flags optional */
+ BMO_op_init(bm, &bmop, BMO_FLAG_DEFAULTS, self->opname);
if (kw && PyDict_Size(kw) > 0) {
/* setup properties, see bpy_rna.c: pyrna_py_to_prop()
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 65bff1db7f6..a82562d4445 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -1578,7 +1578,7 @@ PyDoc_STRVAR(bpy_bmloop_calc_normal_doc,
".. method:: calc_normal()\n"
"\n"
" Return normal at this loops corner of the face.\n"
-" Falls back to the face normal for straignt lines.\n"
+" Falls back to the face normal for straight lines.\n"
"\n"
" :return: a normalized vector.\n"
" :rtype: :class:`mathutils.Vector`\n"
@@ -1595,7 +1595,7 @@ PyDoc_STRVAR(bpy_bmloop_calc_tangent_doc,
".. method:: calc_tangent()\n"
"\n"
" Return the tangent at this loops corner of the face (pointing inward into the face).\n"
-" Falls back to the face normal for straignt lines.\n"
+" Falls back to the face normal for straight lines.\n"
"\n"
" :return: a normalized vector.\n"
" :rtype: :class:`mathutils.Vector`\n"
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index b2cc0d73481..1b21f62a115 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -363,7 +363,7 @@ PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *data)
* weight = dv[group_nr]
* del dv[group_nr]
*
- * \note: there is nothing BMesh spesific here,
+ * \note: there is nothing BMesh specific here,
* its only that BMesh is the only part of blender that uses a hand written api like this.
* This type could eventually be used to access lattice weights.
*
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c
index c76c7d975e4..40d39539894 100644
--- a/source/blender/python/bmesh/bmesh_py_types_select.c
+++ b/source/blender/python/bmesh/bmesh_py_types_select.c
@@ -29,7 +29,7 @@
* This file defines the types for 'BMesh.select_history'
* sequence and iterator.
*
- * select_history is very loosely based on pytons set() type,
+ * select_history is very loosely based on pythons set() type,
* since items can only exist once. however they do have an order.
*/
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 3a46c6971cf..d4158210cc8 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -48,12 +48,15 @@
#include "BLI_utildefines.h"
/* UNUSED */
-#include "BKE_text.h" /* txt_to_buf */
+#include "BKE_text.h" /* txt_to_buf */
#include "BKE_main.h"
static Main *bpy_import_main = NULL;
static ListBase bpy_import_main_list;
+static PyMethodDef bpy_import_meth;
+static PyMethodDef bpy_reload_meth;
+
/* 'builtins' is most likely PyEval_GetBuiltins() */
void bpy_import_init(PyObject *builtins)
{
@@ -287,7 +290,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
}
else {
/* no blender text was found that could import the module
- * rause the original error from PyImport_ImportModuleEx */
+ * reuse the original error from PyImport_ImportModuleEx */
PyErr_Restore(exception, err, tb);
}
return newmodule;
@@ -335,5 +338,5 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
return newmodule;
}
-PyMethodDef bpy_import_meth = {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"};
-PyMethodDef bpy_reload_meth = {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"};
+static PyMethodDef bpy_import_meth = {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"};
+static PyMethodDef bpy_reload_meth = {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"};
diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h
index 980e6edca03..1592ec52b4c 100644
--- a/source/blender/python/generic/bpy_internal_import.h
+++ b/source/blender/python/generic/bpy_internal_import.h
@@ -55,9 +55,6 @@ PyObject* bpy_text_reimport(PyObject *module, int *found);
void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text);
-extern PyMethodDef bpy_import_meth;
-extern PyMethodDef bpy_reload_meth;
-
/* The game engine has its own Main struct, if this is set search this rather than G.main */
struct Main *bpy_import_main_get(void);
void bpy_import_main_set(struct Main *maggie);
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 15eeb5934d8..06b6192a091 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -152,7 +152,7 @@ PyObject *BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent)
}
}
-#if 0 /* UNUSED, currenly assignment overwrites into new properties, rather than setting in-place */
+#if 0 /* UNUSED, currently assignment overwrites into new properties, rather than setting in-place */
static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value)
{
switch (prop->type) {
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index fd12f7f483d..657844ebfff 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -152,6 +152,21 @@ void PyC_LineSpit(void)
fprintf(stderr, "%s:%d\n", filename, lineno);
}
+void PyC_StackSpit(void)
+{
+ /* Note, allow calling from outside python (RNA) */
+ if (!PYC_INTERPRETER_ACTIVE) {
+ fprintf(stderr, "python line lookup failed, interpreter inactive\n");
+ return;
+ }
+ else {
+ /* lame but handy */
+ PyGILState_STATE gilstate = PyGILState_Ensure();
+ PyRun_SimpleString("__import__('traceback').print_stack()");
+ PyGILState_Release(gilstate);
+ }
+}
+
void PyC_FileAndNum(const char **filename, int *lineno)
{
PyFrameObject *frame;
@@ -229,7 +244,7 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
/* similar to PyErr_Format(),
*
* implementation - we cant actually preprend the existing exception,
- * because it could have _any_ argiments given to it, so instead we get its
+ * because it could have _any_ arguments given to it, so instead we get its
* __str__ output and raise our own exception including it.
*/
PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...)
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 9ef171256aa..481cfb17c7a 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -24,12 +24,13 @@
* \ingroup pygen
*/
-
+
#ifndef __PY_CAPI_UTILS_H__
#define __PY_CAPI_UTILS_H__
void PyC_ObSpit(const char *name, PyObject *var);
void PyC_LineSpit(void);
+void PyC_StackSpit(void);
PyObject * PyC_ExceptionBuffer(void);
PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 7375ad454a0..90ea589fde4 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -232,7 +232,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
#ifdef BPY_RELEASE_GIL
/* release GIL, since a thread could be started from an operator
* that updates a driver */
- /* note: I havve not seen any examples of code that does this
+ /* note: I have not seen any examples of code that does this
* so it may not be officially supported but seems to work ok. */
{
PyThreadState *ts = PyEval_SaveThread();
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index f8609859251..a781dbb33b5 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -307,7 +307,7 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
} (void)0
/* terse macros for error checks shared between all funcs cant use function
- * calls because of static strins passed to pyrna_set_to_enum_bitfield */
+ * calls because of static strings passed to pyrna_set_to_enum_bitfield */
#define BPY_PROPDEF_CHECK(_func, _property_flag_items) \
if (id_len >= MAX_IDPROP_NAME) { \
PyErr_Format(PyExc_TypeError, \
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index e85adf21477..609c549dfcb 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -7000,7 +7000,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
Py_INCREF(py_class_instance);
#endif
/*
- * This would work fine but means __init__ functions wouldnt run.
+ * This would work fine but means __init__ functions wouldn't run.
* none of blenders default scripts use __init__ but its nice to call it
* for general correctness. just to note why this is here when it could be safely removed.
*/
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 5c59c1e620a..70815d9f8bf 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -342,7 +342,7 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop,
/* Regarding PySequence_GetItem() failing.
*
- * This should never be NULL since we validated it, _but_ some triky python
+ * This should never be NULL since we validated it, _but_ some tricky python
* developer could write their own sequence type which succeeds on
* validating but fails later somehow, so include checks for safety.
*/
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 59c57e916d4..8a87938d825 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -147,7 +147,7 @@ static PyObject *Color_str(ColorObject *self)
}
//------------------------tp_richcmpr
-//returns -1 execption, 0 false, 1 true
+//returns -1 exception, 0 false, 1 true
static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
{
PyObject *res;
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 895352ccf93..d98c6e9d2fd 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -2443,7 +2443,7 @@ PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user,
/* ----------------------------------------------------------------------------
- * special type for alaternate access */
+ * special type for alternate access */
typedef struct {
PyObject_HEAD /* required python macro */
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 79285b7778d..c7911cb1572 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1864,7 +1864,7 @@ static double vec_magnitude_nosqrt(float *data, int size)
/*------------------------tp_richcmpr
- * returns -1 execption, 0 false, 1 true */
+ * returns -1 exception, 0 false, 1 true */
static PyObject *Vector_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
{
VectorObject *vecA = NULL, *vecB = NULL;
@@ -2908,7 +2908,7 @@ PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTy
}
else { /* new empty */
fill_vn_fl(self->vec, size, 0.0f);
- if (size == 4) { /* do the homogenous thing */
+ if (size == 4) { /* do the homogeneous thing */
self->vec[3] = 1.0f;
}
}
diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index 9460c4d0b36..da32e36dc02 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -717,7 +717,7 @@ PyDoc_STRVAR(M_Noise_voronoi_doc,
" :type position: :class:`mathutils.Vector`\n"
" :arg distance_metric: Method of measuring distance.\n"
" :type distance_metric: Value in noise.distance_metrics or int\n"
-" :arg exponent: The exponent for Minkovsky distance metric.\n"
+" :arg exponent: The exponent for Minkowski distance metric.\n"
" :type exponent: float\n"
" :return: A list of distances to the four closest features and their locations.\n"
" :rtype: list of four floats, list of four :class:`mathutils.Vector` types\n"
@@ -729,7 +729,7 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
float vec[3];
float da[4], pa[12];
int dtype = 0;
- float me = 2.5f; /* default minkovsky exponent */
+ float me = 2.5f; /* default minkowski exponent */
int i;
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index b4a89eae89e..f8b09ae8b1b 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -400,13 +400,13 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
qtexport->audioInputFormat.mFormatFlags |= kLinearPCMFormatFlagIsPacked;
- /*Ouput format*/
+ /*Output format*/
qtexport->audioOutputFormat.mFormatID = rd->qtcodecsettings.audiocodecType;
//TODO: set audio channels
qtexport->audioOutputFormat.mChannelsPerFrame = 2;
qtexport->audioOutputFormat.mSampleRate = rd->qtcodecsettings.audioSampleRate;
- /* Default value for compressed formats, overriden after if not the case */
+ /* Default value for compressed formats, overridden after if not the case */
qtexport->audioOutputFormat.mFramesPerPacket = 0;
qtexport->audioOutputFormat.mBytesPerFrame = 0;
qtexport->audioOutputFormat.mBytesPerPacket = 0;
diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m
index 197cbdc2f0b..073fb31ff96 100644
--- a/source/blender/quicktime/apple/qtkit_import.m
+++ b/source/blender/quicktime/apple/qtkit_import.m
@@ -85,7 +85,7 @@ int anim_is_quicktime (const char *name)
if( BLI_testextensie(name, ".swf") ||
BLI_testextensie(name, ".txt") ||
BLI_testextensie(name, ".mpg") ||
- BLI_testextensie(name, ".avi") || // wouldnt be appropriate ;)
+ BLI_testextensie(name, ".avi") || // wouldn't be appropriate ;)
BLI_testextensie(name, ".mov") || // disabled, suboptimal decoding speed
BLI_testextensie(name, ".mp4") || // disabled, suboptimal decoding speed
BLI_testextensie(name, ".m4v") || // disabled, suboptimal decoding speed
diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c
index f3e71feec58..5b13d77a030 100644
--- a/source/blender/quicktime/apple/quicktime_import.c
+++ b/source/blender/quicktime/apple/quicktime_import.c
@@ -195,7 +195,7 @@ int anim_is_quicktime(const char *name)
if (BLI_testextensie(name, ".swf") ||
BLI_testextensie(name, ".txt") ||
BLI_testextensie(name, ".mpg") ||
- BLI_testextensie(name, ".avi") || /* wouldnt be appropriate ;) */
+ BLI_testextensie(name, ".avi") || /* wouldn't be appropriate ;) */
BLI_testextensie(name, ".tga") ||
BLI_testextensie(name, ".png") ||
BLI_testextensie(name, ".bmp") ||
diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h
index cdf171443d7..99bde3fe02b 100644
--- a/source/blender/render/intern/include/zbuf.h
+++ b/source/blender/render/intern/include/zbuf.h
@@ -46,7 +46,7 @@ struct StrandShadeCache;
void fillrect(int *rect, int x, int y, int val);
/**
- * Converts a world coordinate into a homogenous coordinate in view
+ * Converts a world coordinate into a homogeneous coordinate in view
* coordinates.
*/
void projectvert(const float v1[3], float winmat[][4], float adr[4]);
@@ -95,7 +95,7 @@ typedef struct ZSpan {
float zmulx, zmuly, zofsx, zofsy; /* transform from hoco to zbuf co */
- int *rectz, *arectz; /* zbuffers, arectz is for transparant */
+ int *rectz, *arectz; /* zbuffers, arectz is for transparent */
int *rectz1; /* seconday z buffer for shadowbuffer (2nd closest z) */
int *rectp; /* polygon index buffer */
int *recto; /* object buffer */
diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h
index 1e9a0319b2f..a9ed71a76bc 100644
--- a/source/blender/render/intern/raytrace/reorganize.h
+++ b/source/blender/render/intern/raytrace/reorganize.h
@@ -421,7 +421,7 @@ struct VBVH_optimalPackSIMD {
}
}
- //Save the ways to archieve the minimum cost with a given cutsize
+ /* Save the ways to archive the minimum cost with a given cutsize */
for (int i = nchilds; i <= MAX_CUT_SIZE; i++) {
node->cut_cost[i - 1] = cost[nchilds][i];
if (cost[nchilds][i] < INFINITY) {
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 803a9a95571..a6f6458392f 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -27,7 +27,6 @@
* \ingroup render
*/
-
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
@@ -2375,9 +2374,8 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
displace_render_vert(re, obr, &shi, vlr->v4, 3, scale, mat, imat);
/* closest in displace value. This will help smooth edges. */
- if ( fabs(vlr->v1->accum - vlr->v3->accum) > fabs(vlr->v2->accum - vlr->v4->accum))
- vlr->flag |= R_DIVIDE_24;
- else vlr->flag &= ~R_DIVIDE_24;
+ if (fabsf(vlr->v1->accum - vlr->v3->accum) > fabsf(vlr->v2->accum - vlr->v4->accum)) vlr->flag |= R_DIVIDE_24;
+ else vlr->flag &= ~R_DIVIDE_24;
}
/* Recalculate the face normal - if flipped before, flip now */
@@ -3391,7 +3389,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
ma= give_render_material(re, ob, a1+1);
- /* test for 100% transparant */
+ /* test for 100% transparent */
ok= 1;
if (ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f && (ma->mode & MA_TRANSP) && (ma->mode & MA_RAYMIRROR)==0) {
ok= 0;
@@ -4261,8 +4259,8 @@ static void check_non_flat_quads(ObjectRen *obr)
normal_tri_v3(nor, vlr->v2->co, vlr->v3->co, vlr->v4->co);
d2 = dot_v3v3(nor, vlr->v2->n);
- if ( fabs(d1) < fabs(d2) ) vlr->flag |= R_DIVIDE_24;
- else vlr->flag &= ~R_DIVIDE_24;
+ if (fabsf(d1) < fabsf(d2) ) vlr->flag |= R_DIVIDE_24;
+ else vlr->flag &= ~R_DIVIDE_24;
/* new vertex pointers */
if (vlr->flag & R_DIVIDE_24) {
@@ -5495,7 +5493,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
camco[1] = dot_v3v3(imat[1], fsvec);
camco[2] = dot_v3v3(imat[2], fsvec);
- /* get homogenous coordinates */
+ /* get homogeneous coordinates */
projectvert(camco, winmat, hoco);
projectvert(ver->co, winmat, ho);
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index a0ba2a82ead..3e6d0f281fd 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -539,7 +539,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
*/
/* note: actually minx etc isn't in the proper range... this due to filter size and offset vectors for bump */
/* note: talpha must be initialized */
- /* note: even when 'imaprepeat' is set, this can only repeate once in any direction.
+ /* note: even when 'imaprepeat' is set, this can only repeat once in any direction.
* the point which min/max is derived from is assumed to be wrapped */
TexResult texr;
rctf *rf, stack[8];
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 33a777381aa..cc8f6682781 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -27,8 +27,6 @@
* \ingroup render
*/
-
-
/* Global includes */
#include <math.h>
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 8a936545903..cb7122c834c 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -1043,7 +1043,7 @@ static void QMC_initPixel(QMCSampler *qsa, int thread)
}
else { /* SAMP_TYPE_HALTON */
- /* generate a new randomised halton sequence per pixel
+ /* generate a new randomized halton sequence per pixel
* to alleviate qmc artifacts and make it reproducible
* between threads/frames */
double ht_invprimes[2], ht_nums[2];
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index c8ef3e4a8dd..3703f819b3b 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -791,9 +791,9 @@ static int cubemap(MTex *mtex, VlakRen *vlr, const float n[3], float x, float y,
float nor[3];
normal_tri_v3(nor, vlr->v1->orco, vlr->v2->orco, vlr->v3->orco);
- if ( fabs(nor[0])<fabs(nor[2]) && fabs(nor[1])<fabs(nor[2]) ) vlr->puno |= ME_PROJXY;
- else if ( fabs(nor[0])<fabs(nor[1]) && fabs(nor[2])<fabs(nor[1]) ) vlr->puno |= ME_PROJXZ;
- else vlr->puno |= ME_PROJYZ;
+ if (fabsf(nor[0]) < fabsf(nor[2]) && fabsf(nor[1]) < fabsf(nor[2])) vlr->puno |= ME_PROJXY;
+ else if (fabsf(nor[0]) < fabsf(nor[1]) && fabsf(nor[2]) < fabsf(nor[1])) vlr->puno |= ME_PROJXZ;
+ else vlr->puno |= ME_PROJYZ;
}
else return cubemap_glob(n, x, y, z, adr1, adr2);
}
@@ -2985,7 +2985,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
}
else {
/* this value has no angle, the vector is directly along the view.
- * avoide divide by zero and use a dummy value. */
+ * avoid divide by zero and use a dummy value. */
tempvec[0]= 1.0f;
tempvec[1]= 0.0;
tempvec[2]= 0.0;
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 85d0c36be1a..db045284d5b 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -49,7 +49,7 @@
* - If the entry has no block allocated for it yet, memory is
* allocated.
*
- * The pointer to the correct entry is returned. Memory is guarateed
+ * The pointer to the correct entry is returned. Memory is guaranteed
* to exist (as long as the malloc does not break). Since guarded
* allocation is used, memory _must_ be available. Otherwise, an
* exit(0) would occur.
@@ -1309,11 +1309,11 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
/* the Zd value is still not really correct for pano */
- vec[2]-= har->hasize; /* z negative, otherwise it's clipped */
+ vec[2] -= har->hasize; /* z negative, otherwise it's clipped */
projectfunc(vec, re->winmat, hoco);
- zn= hoco[3];
- zn= fabs( (float)har->zs - 0x7FFFFF*(hoco[2]/zn));
- har->zd= CLAMPIS(zn, 0, INT_MAX);
+ zn = hoco[3];
+ zn = fabsf((float)har->zs - 0x7FFFFF * (hoco[2] / zn));
+ har->zd = CLAMPIS(zn, 0, INT_MAX);
}
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index f696f95781b..7dc77d3632a 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -1176,8 +1176,8 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
dy[0]= xs1 - dy[0];
dy[1]= ys1 - dy[1];
- xres= fac*(fabs(dx[0]) + fabs(dy[0]));
- yres= fac*(fabs(dx[1]) + fabs(dy[1]));
+ xres = fac * (fabsf(dx[0]) + fabsf(dy[0]));
+ yres = fac * (fabsf(dx[1]) + fabsf(dy[1]));
if (xres<1.0f) xres= 1.0f;
if (yres<1.0f) yres= 1.0f;
@@ -1815,7 +1815,7 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
return;
/* if face boundbox is outside of branch rect, give up */
- if (0==BLI_isect_rctf((rctf *)&face->box, (rctf *)&bspn->box, NULL))
+ if (0==BLI_rctf_isect((rctf *)&face->box, (rctf *)&bspn->box, NULL))
return;
/* test all points inside branch */
@@ -1824,7 +1824,7 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
if ((samp->facenr!=face->facenr || samp->obi!=face->obi) && samp->shadfac) {
if (face->box.zmin < samp->zco[2]) {
- if (BLI_in_rctf((rctf *)&face->box, samp->zco[0], samp->zco[1])) {
+ if (BLI_in_rctf_v((rctf *)&face->box, samp->zco)) {
int inshadow= 0;
if (face->type) {
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index 0e7c8a13043..51be519d5b8 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -577,8 +577,8 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
/* add to pixel list */
if (zverg < bufferz && (spart->totapixbuf[offset] < MAX_ZROW)) {
if (!spart->rectmask || zverg > maskz) {
- t = u*spart->t[0] + v*spart->t[1] + (1.0f-u-v)*spart->t[2];
- s = fabs(u*spart->s[0] + v*spart->s[1] + (1.0f-u-v)*spart->s[2]);
+ t = u * spart->t[0] + v * spart->t[1] + (1.0f - u - v) * spart->t[2];
+ s = fabsf(u * spart->s[0] + v * spart->s[1] + (1.0f - u - v) * spart->s[2]);
apn= spart->apixbuf + offset;
while (apn) {
diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c
index ddc7dff7b06..6a1517e19fb 100644
--- a/source/blender/render/intern/source/sunsky.c
+++ b/source/blender/render/intern/source/sunsky.c
@@ -360,7 +360,7 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
* rayf, Rayleigh scattering factor, this factor currently call with 1.0
* inscattf, inscatter light factor that range from 0.0 to 1.0, 0.0 means no inscatter light and 1.0 means full inscatter light
* extincf, extinction light factor that range from 0.0 to 1.0, 0.0 means no extinction and 1.0 means full extinction
- * disf, is distance factor, multiplyed to pixle's z value to compute each pixle's distance to camera,
+ * disf, is distance factor, multiplied to pixle's z value to compute each pixle's distance to camera,
* */
void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float rayf,
float inscattf, float extincf, float disf)
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index 67e453577e4..220fcd3e986 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -415,7 +415,7 @@ static void vol_get_transmittance_seg(ShadeInput *shi, float tr[3], float stepsi
vol_get_sigma_t(shi, sigma_t, co);
- /* homogenous volume within the sampled distance */
+ /* homogeneous volume within the sampled distance */
tau[0] += stepd * sigma_t[0];
tau[1] += stepd * sigma_t[1];
tau[2] += stepd * sigma_t[2];
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 1ebb963a790..e09529fd8ac 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -443,7 +443,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], co
mask= zspan->mask;
- if (fabs(dx) > fabs(dy)) {
+ if (fabsf(dx) > fabsf(dy)) {
/* all lines from left to right */
if (vec1[0]<vec2[0]) {
@@ -597,7 +597,7 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], cons
dx= vec2[0]-vec1[0];
dy= vec2[1]-vec1[1];
- if (fabs(dx) > fabs(dy)) {
+ if (fabsf(dx) > fabsf(dy)) {
/* all lines from left to right */
if (vec1[0]<vec2[0]) {
@@ -727,7 +727,7 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), con
dx= vec2[0]-vec1[0];
dy= vec2[1]-vec1[1];
- if (fabs(dx) > fabs(dy)) {
+ if (fabsf(dx) > fabsf(dy)) {
/* all lines from left to right */
if (vec1[0]<vec2[0]) {
@@ -1626,7 +1626,7 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
v13= clipcrop*v1[3];
}
/* according the original article by Liang&Barsky, for clipping of
- * homogenous coordinates with viewplane, the value of "0" is used instead of "-w" .
+ * homogeneous coordinates with viewplane, the value of "0" is used instead of "-w" .
* This differs from the other clipping cases (like left or top) and I considered
* it to be not so 'homogenic'. But later it has proven to be an error,
* who would have thought that of L&B!
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 275aeb3317c..c5aaeeb8171 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -143,4 +143,8 @@ if(WIN322)
)
endif()
+if(WITH_COMPOSITOR)
+ add_definitions(-DWITH_COMPOSITOR)
+endif()
+
blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript
index 57d632c7d04..bf219bb9c06 100644
--- a/source/blender/windowmanager/SConscript
+++ b/source/blender/windowmanager/SConscript
@@ -43,4 +43,7 @@ if env['BF_BUILDINFO']:
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
+if env['WITH_BF_COMPOSITOR']:
+ defs.append("WITH_COMPOSITOR")
+
env.BlenderLib ( 'bf_windowmanager', sources, Split(incs), defines=defs, libtype=['core'], priority=[5] )
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index ff1f47cbbaa..8652870e280 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -193,7 +193,7 @@ static void wm_flush_regions_down(bScreen *screen, rcti *dirty)
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
+ if (BLI_rcti_isect(dirty, &ar->winrct, NULL)) {
ar->do_draw = RGN_DRAW;
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
ar->swap = WIN_NONE_OK;
@@ -208,7 +208,7 @@ static void wm_flush_regions_up(bScreen *screen, rcti *dirty)
ARegion *ar;
for (ar = screen->regionbase.first; ar; ar = ar->next) {
- if (BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
+ if (BLI_rcti_isect(dirty, &ar->winrct, NULL)) {
ar->do_draw = RGN_DRAW;
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
ar->swap = WIN_NONE_OK;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 9795c482af2..202a9d46f33 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -628,7 +628,7 @@ int WM_operator_call(bContext *C, wmOperator *op)
/* this is intended to be used when an invoke operator wants to call exec on its self
* and is basically like running op->type->exec() directly, no poll checks no freeing,
- * since we assume whoever called invokle will take care of that */
+ * since we assume whoever called invoke will take care of that */
int WM_operator_call_notest(bContext *C, wmOperator *op)
{
return wm_operator_exec_notest(C, op);
@@ -919,7 +919,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
ScrArea *sa = CTX_wm_area(C);
if (ar && ar->regiontype == RGN_TYPE_WINDOW && event &&
- BLI_in_rcti(&ar->winrct, event->x, event->y))
+ BLI_in_rcti_v(&ar->winrct, &event->x))
{
winrect = &ar->winrct;
}
@@ -1636,19 +1636,19 @@ static int handler_boundbox_test(wmEventHandler *handler, wmEvent *event)
if (handler->bbwin) {
if (handler->bblocal) {
rcti rect = *handler->bblocal;
- BLI_translate_rcti(&rect, handler->bbwin->xmin, handler->bbwin->ymin);
+ BLI_rcti_translate(&rect, handler->bbwin->xmin, handler->bbwin->ymin);
- if (BLI_in_rcti(&rect, event->x, event->y))
+ if (BLI_in_rcti_v(&rect, &event->x))
return 1;
- else if (event->type == MOUSEMOVE && BLI_in_rcti(&rect, event->prevx, event->prevy))
+ else if (event->type == MOUSEMOVE && BLI_in_rcti_v(&rect, &event->prevx))
return 1;
else
return 0;
}
else {
- if (BLI_in_rcti(handler->bbwin, event->x, event->y))
+ if (BLI_in_rcti_v(handler->bbwin, &event->x))
return 1;
- else if (event->type == MOUSEMOVE && BLI_in_rcti(handler->bbwin, event->prevx, event->prevy))
+ else if (event->type == MOUSEMOVE && BLI_in_rcti_v(handler->bbwin, &event->prevx))
return 1;
else
return 0;
@@ -1826,10 +1826,10 @@ static int wm_event_inside_i(wmEvent *event, rcti *rect)
{
if (wm_event_always_pass(event))
return 1;
- if (BLI_in_rcti(rect, event->x, event->y))
+ if (BLI_in_rcti_v(rect, &event->x))
return 1;
if (event->type == MOUSEMOVE) {
- if (BLI_in_rcti(rect, event->prevx, event->prevy)) {
+ if (BLI_in_rcti_v(rect, &event->prevx)) {
return 1;
}
return 0;
@@ -1837,19 +1837,19 @@ static int wm_event_inside_i(wmEvent *event, rcti *rect)
return 0;
}
-static ScrArea *area_event_inside(bContext *C, int x, int y)
+static ScrArea *area_event_inside(bContext *C, const int xy[2])
{
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa;
if (screen)
for (sa = screen->areabase.first; sa; sa = sa->next)
- if (BLI_in_rcti(&sa->totrct, x, y))
+ if (BLI_in_rcti_v(&sa->totrct, xy))
return sa;
return NULL;
}
-static ARegion *region_event_inside(bContext *C, int x, int y)
+static ARegion *region_event_inside(bContext *C, const int xy[2])
{
bScreen *screen = CTX_wm_screen(C);
ScrArea *area = CTX_wm_area(C);
@@ -1857,7 +1857,7 @@ static ARegion *region_event_inside(bContext *C, int x, int y)
if (screen && area)
for (ar = area->regionbase.first; ar; ar = ar->next)
- if (BLI_in_rcti(&ar->winrct, x, y))
+ if (BLI_in_rcti_v(&ar->winrct, xy))
return ar;
return NULL;
}
@@ -1888,11 +1888,11 @@ static void wm_paintcursor_test(bContext *C, wmEvent *event)
wm_paintcursor_tag(C, wm->paintcursors.first, ar);
/* if previous position was not in current region, we have to set a temp new context */
- if (ar == NULL || !BLI_in_rcti(&ar->winrct, event->prevx, event->prevy)) {
+ if (ar == NULL || !BLI_in_rcti_v(&ar->winrct, &event->prevx)) {
ScrArea *sa = CTX_wm_area(C);
- CTX_wm_area_set(C, area_event_inside(C, event->prevx, event->prevy));
- CTX_wm_region_set(C, region_event_inside(C, event->prevx, event->prevy));
+ CTX_wm_area_set(C, area_event_inside(C, &event->prevx));
+ CTX_wm_region_set(C, region_event_inside(C, &event->prevx));
wm_paintcursor_tag(C, wm->paintcursors.first, CTX_wm_region(C));
@@ -2000,8 +2000,8 @@ void wm_event_do_handlers(bContext *C)
CTX_wm_window_set(C, win);
/* we let modal handlers get active area/region, also wm_paintcursor_test needs it */
- CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
- CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
+ CTX_wm_area_set(C, area_event_inside(C, &event->x));
+ CTX_wm_region_set(C, region_event_inside(C, &event->x));
/* MVC demands to not draw in event handlers... but we need to leave it for ogl selecting etc */
wm_window_make_drawable(C, win);
@@ -2061,7 +2061,7 @@ void wm_event_do_handlers(bContext *C)
if (CTX_wm_window(C) == NULL)
return;
- doit |= (BLI_in_rcti(&ar->winrct, event->x, event->y));
+ doit |= (BLI_in_rcti_v(&ar->winrct, &event->x));
if (action & WM_HANDLER_BREAK)
break;
@@ -2083,8 +2083,8 @@ void wm_event_do_handlers(bContext *C)
if ((action & WM_HANDLER_BREAK) == 0) {
/* also some non-modal handlers need active area/region */
- CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
- CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
+ CTX_wm_area_set(C, area_event_inside(C, &event->x));
+ CTX_wm_region_set(C, region_event_inside(C, &event->x));
wm_region_mouse_co(C, event);
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index b280b979280..c9f1a2587df 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -253,7 +253,7 @@ static void draw_filled_lasso(wmGesture *gt)
/* highly unlikely this will fail, but could crash if (gt->points == 0) */
if (sf_vert_first) {
- float zvec[3] = {0.0f, 0.0f, 1.0f};
+ const float zvec[3] = {0.0f, 0.0f, 1.0f};
BLI_scanfill_edge_add(&sf_ctx, sf_vert_first, sf_vert);
BLI_scanfill_calc_ex(&sf_ctx, FALSE, zvec);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 3dbb3b7ef66..7a885d60bff 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -28,7 +28,6 @@
* \ingroup wm
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -63,7 +62,6 @@
#include "BKE_tracking.h" /* free tracking clipboard */
#include "BLI_listbase.h"
-// #include "BLI_scanfill.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
@@ -75,7 +73,7 @@
#endif
#ifdef WITH_GAMEENGINE
-#include "BL_System.h"
+# include "BL_System.h"
#endif
#include "GHOST_Path-api.h"
#include "GHOST_C-api.h"
@@ -199,6 +197,14 @@ void WM_init(bContext *C, int argc, const char **argv)
#endif
BLI_strncpy(G.lib, G.main->name, FILE_MAX);
+
+#ifdef WITH_COMPOSITOR
+ if (1) {
+ extern void *COM_linker_hack;
+ extern void *COM_execute;
+ COM_linker_hack = COM_execute;
+ }
+#endif
}
void WM_init_splash(bContext *C)
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 2aa010f012e..a55efc0b216 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1066,7 +1066,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
/* clear so the OK button is left alone */
uiBlockSetFunc(block, NULL, NULL, NULL);
- /* new column so as not to interfear with custom layouts [#26436] */
+ /* new column so as not to interfere with custom layouts [#26436] */
{
uiBlock *col_block;
uiLayout *col;
@@ -1336,7 +1336,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemL(col, "Links", ICON_NONE);
uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits");
- uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-263");
+ uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-264");
uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.6/Manual");
uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 940c92b349c..9571153d037 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -909,9 +909,9 @@ endif()
)
if(WITH_COMPOSITOR)
- #added for opencl compositor
- list(APPEND BLENDER_SORTED_LIBS bf_compositor)
- list(APPEND BLENDER_SORTED_LIBS bf_opencl)
+ # added for opencl compositor
+ list_insert_before(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_compositor")
+ list_insert_after(BLENDER_SORTED_LIBS "bf_compositor" "bf_opencl")
endif()
if(WITH_LIBMV)
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 8b211385928..cef068ccbaa 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -82,10 +82,6 @@ extern "C" {
/* #include "BKE_screen.h" */ /* cant include this because of 'new' function name */
extern float BKE_screen_view3d_zoom_to_fac(float camzoom);
-
-//XXX #include "BIF_screen.h"
-//XXX #include "BIF_scrarea.h"
-
#include "BKE_main.h"
#include "BLI_blenlib.h"
#include "BLO_readfile.h"
@@ -93,7 +89,6 @@ extern float BKE_screen_view3d_zoom_to_fac(float camzoom);
#include "BKE_ipo.h"
/***/
-//XXX #include "BSE_headerbuttons.h"
#include "BKE_context.h"
#include "../../blender/windowmanager/WM_types.h"
#include "../../blender/windowmanager/wm_window.h"
@@ -525,7 +520,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic));
const Py_ssize_t numitems= PyList_GET_SIZE(gameLogic_keys_new);
Py_ssize_t listIndex;
- for (listIndex=0; listIndex < numitems; listIndex++) {
+ for (listIndex=0; listIndex < numitems; listIndex++) {
PyObject* item = PyList_GET_ITEM(gameLogic_keys_new, listIndex);
if (!PySequence_Contains(gameLogic_keys, item)) {
PyDict_DelItem( PyModule_GetDict(gameLogic), item);
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
index 9156102ab0d..1266250e942 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
@@ -383,8 +383,7 @@ void KX_BlenderRenderTools::MotionBlur(RAS_IRasterizer* rasterizer)
glAccum(GL_LOAD, 1.0);
rasterizer->SetMotionBlurState(2);
}
- else if (motionblurvalue>=0.0 && motionblurvalue<=1.0)
- {
+ else if (motionblurvalue >= 0.0f && motionblurvalue <= 1.0f) {
glAccum(GL_MULT, motionblurvalue);
glAccum(GL_ACCUM, 1-motionblurvalue);
glAccum(GL_RETURN, 1.0);
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index b580fc31585..cab6d0fc376 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -339,7 +339,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
}
}
- return true;
+ return m_flag & ACT_FLAG_ATTEMPT_PLAY;
}
#ifdef WITH_PYTHON
diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp
index f464d6c4b59..7344aa9378e 100644
--- a/source/gameengine/Converter/BL_ArmatureChannel.cpp
+++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp
@@ -258,7 +258,7 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str
joints[2] = -joint_mat[1][0];
norm = normalize_v3(joints);
if (norm < FLT_EPSILON) {
- norm = (joint_mat[1][1] < 0.f) ? M_PI : 0.f;
+ norm = (joint_mat[1][1] < 0.0f) ? (float)M_PI : 0.0f;
} else {
norm = acos(joint_mat[1][1]);
}
@@ -275,7 +275,7 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str
joints[2] = (joint_mat[0][1]-joint_mat[1][0])*0.5f;
sa = len_v3(joints);
ca = (joint_mat[0][0]+joint_mat[1][1]+joint_mat[1][1]-1.0f)*0.5f;
- if (sa > FLT_EPSILON) {
+ if (sa > (double)FLT_EPSILON) {
norm = atan2(sa,ca)/sa;
} else {
if (ca < 0.0) {
diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp
index ee78c4deed9..7939d6e9235 100644
--- a/source/gameengine/Converter/BL_ArmatureConstraint.cpp
+++ b/source/gameengine/Converter/BL_ArmatureConstraint.cpp
@@ -334,7 +334,7 @@ PyObject* BL_ArmatureConstraint::py_attr_getattr(void *self_v, const struct KX_P
}
switch (attr_order) {
case BCA_IKWEIGHT:
- return PyFloat_FromDouble((ikconstraint)?ikconstraint->weight:0.0);
+ return PyFloat_FromDouble((ikconstraint)?ikconstraint->weight : 0.0f);
case BCA_IKTYPE:
return PyLong_FromLong(ikconstraint->type);
case BCA_IKFLAG:
@@ -370,7 +370,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
switch (attr_order) {
case BCA_ENFORCE:
dval = PyFloat_AsDouble(value);
- if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */
+ if (dval < 0.0 || dval > 1.0) { /* also accounts for non float */
PyErr_SetString(PyExc_AttributeError, "constraint.enforce = float: BL_ArmatureConstraint, expected a float between 0 and 1");
return PY_SET_ATTR_FAIL;
}
@@ -379,7 +379,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
case BCA_HEADTAIL:
dval = PyFloat_AsDouble(value);
- if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */
+ if (dval < 0.0 || dval > 1.0) { /* also accounts for non float */
PyErr_SetString(PyExc_AttributeError, "constraint.headtail = float: BL_ArmatureConstraint, expected a float between 0 and 1");
return PY_SET_ATTR_FAIL;
}
@@ -417,7 +417,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
switch (attr_order) {
case BCA_IKWEIGHT:
dval = PyFloat_AsDouble(value);
- if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */
+ if (dval < 0.0 || dval > 1.0) { /* also accounts for non float */
PyErr_SetString(PyExc_AttributeError, "constraint.weight = float: BL_ArmatureConstraint, expected a float between 0 and 1");
return PY_SET_ATTR_FAIL;
}
@@ -426,7 +426,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
case BCA_IKDIST:
dval = PyFloat_AsDouble(value);
- if (dval < 0.0f) { /* also accounts for non float */
+ if (dval < 0.0) { /* also accounts for non float */
PyErr_SetString(PyExc_AttributeError, "constraint.ik_dist = float: BL_ArmatureConstraint, expected a positive float");
return PY_SET_ATTR_FAIL;
}
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 3c9ca77b37e..84ad12477d0 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -30,7 +30,6 @@
* \ingroup bgeconv
*/
-
#if defined(WIN32) && !defined(FREE_WINDOWS)
#pragma warning (disable : 4786)
#endif
@@ -186,10 +185,8 @@ extern Material defmaterial; /* material.c */
#ifdef __cplusplus
extern "C" {
#endif
-//XXX #include "BSE_headerbuttons.h"
//XXX void update_for_newframe();
//void BKE_scene_update_for_newframe(struct Scene *sce, unsigned int lay);
-//#include "BKE_ipo.h"
//void do_all_data_ipos(void);
#ifdef __cplusplus
}
@@ -464,10 +461,10 @@ static void GetRGB(short type,
unsigned char cp[4];
unsigned int integer;
} col_converter;
- col_converter.cp[3] = (unsigned char) (mat->r*255.0);
- col_converter.cp[2] = (unsigned char) (mat->g*255.0);
- col_converter.cp[1] = (unsigned char) (mat->b*255.0);
- col_converter.cp[0] = (unsigned char) (mat->alpha*255.0);
+ col_converter.cp[3] = (unsigned char) (mat->r * 255.0f);
+ col_converter.cp[2] = (unsigned char) (mat->g * 255.0f);
+ col_converter.cp[1] = (unsigned char) (mat->b * 255.0f);
+ col_converter.cp[0] = (unsigned char) (mat->alpha * 255.0f);
color = col_converter.integer;
}
c0 = KX_rgbaint2uint_new(color);
@@ -1143,10 +1140,10 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
unsigned int integer;
} col_converter;
- col_converter.cp[3] = (unsigned char) (ma->r*255.0);
- col_converter.cp[2] = (unsigned char) (ma->g*255.0);
- col_converter.cp[1] = (unsigned char) (ma->b*255.0);
- col_converter.cp[0] = (unsigned char) (ma->alpha*255.0);
+ col_converter.cp[3] = (unsigned char) (ma->r * 255.0f);
+ col_converter.cp[2] = (unsigned char) (ma->g * 255.0f);
+ col_converter.cp[1] = (unsigned char) (ma->b * 255.0f);
+ col_converter.cp[0] = (unsigned char) (ma->alpha * 255.0f);
color = col_converter.integer;
}
@@ -1330,8 +1327,8 @@ static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blendero
MT_assert(0.0f <= blenderobject->damping && blenderobject->damping <= 1.0f);
MT_assert(0.0f <= blenderobject->rdamping && blenderobject->rdamping <= 1.0f);
- shapeProps->m_lin_drag = 1.0 - blenderobject->damping;
- shapeProps->m_ang_drag = 1.0 - blenderobject->rdamping;
+ shapeProps->m_lin_drag = 1.0f - blenderobject->damping;
+ shapeProps->m_ang_drag = 1.0f - blenderobject->rdamping;
shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0];
shapeProps->m_friction_scaling[1] = blenderobject->anisotropicFriction[1];
@@ -1456,17 +1453,17 @@ static void my_tex_space_mesh(Mesh *me)
copy_v3_v3(me->size, size);
me->rot[0]= me->rot[1]= me->rot[2]= 0.0f;
- if (me->size[0]==0.0) me->size[0]= 1.0f;
- else if (me->size[0]>0.0 && me->size[0]< 0.00001f) me->size[0]= 0.00001f;
- else if (me->size[0]<0.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f;
+ if (me->size[0] == 0.0f) me->size[0] = 1.0f;
+ else if (me->size[0] > 0.0f && me->size[0]< 0.00001f) me->size[0]= 0.00001f;
+ else if (me->size[0] < 0.0f && me->size[0]> -0.00001f) me->size[0]= -0.00001f;
- if (me->size[1]==0.0) me->size[1]= 1.0f;
- else if (me->size[1]>0.0 && me->size[1]< 0.00001f) me->size[1]= 0.00001f;
- else if (me->size[1]<0.0 && me->size[1]> -0.00001f) me->size[1]= -0.00001f;
+ if (me->size[1] == 0.0f) me->size[1]= 1.0f;
+ else if (me->size[1] > 0.0f && me->size[1]< 0.00001f) me->size[1]= 0.00001f;
+ else if (me->size[1] < 0.0f && me->size[1]> -0.00001f) me->size[1]= -0.00001f;
- if (me->size[2]==0.0) me->size[2]= 1.0f;
- else if (me->size[2]>0.0 && me->size[2]< 0.00001f) me->size[2]= 0.00001f;
- else if (me->size[2]<0.0 && me->size[2]> -0.00001f) me->size[2]= -0.00001f;
+ if (me->size[2] == 0.0f) me->size[2]= 1.0f;
+ else if (me->size[2] > 0.0f && me->size[2]< 0.00001f) me->size[2]= 0.00001f;
+ else if (me->size[2] < 0.0f && me->size[2]> -0.00001f) me->size[2]= -0.00001f;
}
}
@@ -1522,13 +1519,13 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa
}
else
{
- size[0]= 0.5f*fabs(bb->vec[0][0] - bb->vec[4][0]);
- size[1]= 0.5f*fabs(bb->vec[0][1] - bb->vec[2][1]);
- size[2]= 0.5f*fabs(bb->vec[0][2] - bb->vec[1][2]);
+ size[0] = 0.5f * fabsf(bb->vec[0][0] - bb->vec[4][0]);
+ size[1] = 0.5f * fabsf(bb->vec[0][1] - bb->vec[2][1]);
+ size[2] = 0.5f * fabsf(bb->vec[0][2] - bb->vec[1][2]);
- center[0]= 0.5f*(bb->vec[0][0] + bb->vec[4][0]);
- center[1]= 0.5f*(bb->vec[0][1] + bb->vec[2][1]);
- center[2]= 0.5f*(bb->vec[0][2] + bb->vec[1][2]);
+ center[0] = 0.5f * (bb->vec[0][0] + bb->vec[4][0]);
+ center[1] = 0.5f * (bb->vec[0][1] + bb->vec[2][1]);
+ center[2] = 0.5f * (bb->vec[0][2] + bb->vec[1][2]);
}
}
diff --git a/source/gameengine/Converter/BL_MeshDeformer.h b/source/gameengine/Converter/BL_MeshDeformer.h
index c73e4efd245..c84d31c72cd 100644
--- a/source/gameengine/Converter/BL_MeshDeformer.h
+++ b/source/gameengine/Converter/BL_MeshDeformer.h
@@ -63,16 +63,16 @@ public:
m_lastDeformUpdate(-1)
{};
virtual ~BL_MeshDeformer();
- virtual void SetSimulatedTime(double time){}
+ virtual void SetSimulatedTime(double time) {}
virtual bool Apply(class RAS_IPolyMaterial *mat);
- virtual bool Update(void){ return false; }
- virtual bool UpdateBuckets(void){ return false; }
- virtual RAS_Deformer* GetReplica(){return NULL;}
+ virtual bool Update(void) { return false; }
+ virtual bool UpdateBuckets(void) { return false; }
+ virtual RAS_Deformer* GetReplica() {return NULL;}
virtual void ProcessReplica();
struct Mesh* GetMesh() { return m_bmesh; }
virtual class RAS_MeshObject* GetRasMesh() { return (RAS_MeshObject*)m_pMeshObject; }
virtual float (* GetTransVerts(int *tot))[3] { *tot= m_tvtot; return m_transverts; }
- // virtual void InitDeform(double time){}
+ // virtual void InitDeform(double time) {}
protected:
class RAS_MeshObject* m_pMeshObject;
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index 28e34769ab8..89a3f365140 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -109,7 +109,7 @@
* KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set
*/
-#define KX_BLENDERTRUNC(x) (( x < 0.0001 && x > -0.0001 ) ? 0.0 : x)
+#define KX_BLENDERTRUNC(x) (( x < 0.0001f && x > -0.0001f ) ? 0.0f : x)
void BL_ConvertActuators(const char* maggiename,
struct Object* blenderobject,
@@ -162,7 +162,7 @@ void BL_ConvertActuators(const char* maggiename,
KX_BLENDERTRUNC(obact->angularvelocity[1]),
KX_BLENDERTRUNC(obact->angularvelocity[2]));
short damping = obact->damping;
-
+
/* Blender uses a bit vector internally for the local-flags. In */
/* KX, we have four bools. The compiler should be smart enough */
/* to do the right thing. We need to explicitly convert here! */
@@ -431,7 +431,7 @@ void BL_ConvertActuators(const char* maggiename,
new KX_SoundActuator(gameobj,
snd_sound,
soundact->volume,
- (float)(exp((soundact->pitch / 12.0) * M_LN2)),
+ (float)(expf((soundact->pitch / 12.0f) * (float)M_LN2)),
is3d,
settings,
soundActuatorType);
@@ -578,8 +578,8 @@ void BL_ConvertActuators(const char* maggiename,
/* convert settings... degrees in the ui become radians */
/* internally */
if (conact->type == ACT_CONST_TYPE_ORI) {
- min = (float)((MT_2_PI * conact->minloc[0])/360.0);
- max = (float)((MT_2_PI * conact->maxloc[0])/360.0);
+ min = (float)(((float)MT_2_PI * conact->minloc[0]) / 360.0f);
+ max = (float)(((float)MT_2_PI * conact->maxloc[0]) / 360.0f);
switch (conact->mode) {
case ACT_CONST_DIRPX:
locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX;
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp
index 2bd1688ca6d..93eeaaf05fb 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -23,14 +23,14 @@
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
- * Conversion of Blender data blocks to KX sensor system
*/
/** \file gameengine/Converter/KX_ConvertSensors.cpp
* \ingroup bgeconv
+ *
+ * Conversion of Blender data blocks to KX sensor system
*/
-
#include <stdio.h>
#if defined(WIN32) && !defined(FREE_WINDOWS)
@@ -476,7 +476,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
// or the blenderradarsensor->angle?
// nzc: the angle is the opening angle. We need to init with
// the axis-hull angle,so /2.0.
- MT_Scalar factor = tan(MT_radians((blenderradarsensor->angle)/2.0));
+ MT_Scalar factor = tan(MT_radians((blenderradarsensor->angle) / 2.0f));
//MT_Scalar coneradius = coneheight * (factor / 2);
MT_Scalar coneradius = coneheight * factor;
@@ -519,7 +519,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
STR_String checkname = (bFindMaterial? blenderraysensor->matname : blenderraysensor->propname);
// don't want to get rays of length 0.0 or so
- double distance = (blenderraysensor->range < 0.01 ? 0.01 : blenderraysensor->range );
+ double distance = (blenderraysensor->range < 0.01f ? 0.01f : blenderraysensor->range);
int axis = blenderraysensor->axisflag;
diff --git a/source/gameengine/Expressions/ListValue.h b/source/gameengine/Expressions/ListValue.h
index 83f8232ca5e..4d104a4bd3a 100644
--- a/source/gameengine/Expressions/ListValue.h
+++ b/source/gameengine/Expressions/ListValue.h
@@ -57,7 +57,7 @@ public:
void Remove(int i);
void Resize(int num);
void SetValue(int i,CValue* val);
- CValue* GetValue(int i){ assertd(i < m_pValueArray.size()); return m_pValueArray[i];}
+ CValue* GetValue(int i) { assertd(i < m_pValueArray.size()); return m_pValueArray[i]; }
int GetCount() { return m_pValueArray.size(); }
virtual const STR_String & GetText();
diff --git a/source/gameengine/Expressions/VoidValue.h b/source/gameengine/Expressions/VoidValue.h
index 5599b226a60..a1a82f8aa65 100644
--- a/source/gameengine/Expressions/VoidValue.h
+++ b/source/gameengine/Expressions/VoidValue.h
@@ -45,12 +45,19 @@ class CVoidValue : public CPropValue
public:
/// Construction/destruction
- CVoidValue() : m_bDeleteOnDestruct(false), m_pAnything(NULL) { }
- CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype) : m_bDeleteOnDestruct(bDeleteOnDestruct), m_pAnything(voidptr) { if (alloctype == STACKVALUE) CValue::DisableRefCount(); }
- virtual ~CVoidValue(); // Destruct void value, delete memory if we're owning it
+ CVoidValue() : m_bDeleteOnDestruct(false), m_pAnything(NULL) { }
+ CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype) :
+ m_bDeleteOnDestruct(bDeleteOnDestruct),
+ m_pAnything(voidptr)
+ {
+ if (alloctype == STACKVALUE) {
+ CValue::DisableRefCount();
+ }
+ }
+ virtual ~CVoidValue(); /* Destruct void value, delete memory if we're owning it */
/// Value -> String or number
- virtual const STR_String & GetText(); // Get string description of void value (unimplemented)
+ virtual const STR_String & GetText(); /* Get string description of void value (unimplemented) */
virtual double GetNumber() { return -1; }
/// Value calculation
@@ -70,5 +77,5 @@ public:
#endif
};
-#endif // !defined _VOIDVALUE_H
+#endif /* __VOIDVALUE_H__ */
diff --git a/source/gameengine/GameLogic/SCA_IObject.cpp b/source/gameengine/GameLogic/SCA_IObject.cpp
index 5077ecaf816..b90952b2092 100644
--- a/source/gameengine/GameLogic/SCA_IObject.cpp
+++ b/source/gameengine/GameLogic/SCA_IObject.cpp
@@ -251,7 +251,7 @@ SCA_IActuator* SCA_IObject::FindActuator(const STR_String& actuatorname)
void SCA_IObject::Suspend()
{
if ((!m_ignore_activity_culling)
- && (!m_suspended)) {
+ && (!m_suspended)) {
m_suspended = true;
/* flag suspend for all sensors */
SCA_SensorList::iterator i = m_sensors.begin();
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.h b/source/gameengine/GameLogic/SCA_KeyboardSensor.h
index 778929a2551..c059aba305b 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.h
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.h
@@ -65,7 +65,7 @@ class SCA_KeyboardSensor : public SCA_ISensor
STR_String m_targetprop;
/**
* The property that indicates whether or not to log text when in
- * loggin mode. If the property equals 0, no loggin is done. For
+ * logging mode. If the property equals 0, no logging is done. For
* all other values, logging is active. Logging can only become
* active if there is a property to log to. Logging is independent
* from hotkey settings. */
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h
index 0e26c5ad729..25a50fbcac3 100644
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.h
+++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h
@@ -103,7 +103,7 @@ public:
void Resize(int width, int height);
- virtual void ResizeWindow(int width, int height){};
+ virtual void ResizeWindow(int width, int height) {}
/**
* \section Methods inherited from abstract base class RAS_ICanvas.
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp
index 19247664dfa..f2d67e9131d 100644
--- a/source/gameengine/Ketsji/BL_Texture.cpp
+++ b/source/gameengine/Ketsji/BL_Texture.cpp
@@ -169,7 +169,7 @@ bool BL_Texture::InitFromImage(int unit, Image *img, bool mipmap)
void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap)
{
- if (!is_power_of_2_i(x) || !is_power_of_2_i(y) ) {
+ if (!GLEW_ARB_texture_non_power_of_two && (!is_power_of_2_i(x) || !is_power_of_2_i(y)) ) {
InitNonPow2Tex(pix, x,y,mipmap);
return;
}
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 79e6c35e6a2..b28b8c86d33 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -154,15 +154,8 @@ void KX_BlenderMaterial::ReleaseMaterial()
mBlenderShader->ReloadMaterial();
}
-void KX_BlenderMaterial::OnConstruction(int layer)
+void KX_BlenderMaterial::InitTextures()
{
- if (mConstructed)
- // when material are reused between objects
- return;
-
- if (mMaterial->glslmat)
- SetBlenderGLSLShader(layer);
-
// for each unique material...
int i;
for (i=0; i<mMaterial->num_enabled; i++) {
@@ -177,7 +170,7 @@ void KX_BlenderMaterial::OnConstruction(int layer)
}
// If we're using glsl materials, the textures are handled by bf_gpu, so don't load them twice!
// However, if we're using a custom shader, then we still need to load the textures ourselves.
- else if (!mMaterial->glslmat || mBlenderShader) {
+ else if (!mMaterial->glslmat || mShader) {
if ( mMaterial->img[i] ) {
if ( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 ))
spit("unable to initialize image("<<i<<") in "<<
@@ -185,6 +178,18 @@ void KX_BlenderMaterial::OnConstruction(int layer)
}
}
}
+}
+
+void KX_BlenderMaterial::OnConstruction(int layer)
+{
+ if (mConstructed)
+ // when material are reused between objects
+ return;
+
+ if (mMaterial->glslmat)
+ SetBlenderGLSLShader(layer);
+
+ InitTextures();
mBlendFunc[0] =0;
mBlendFunc[1] =0;
@@ -879,7 +884,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
Py_RETURN_NONE;
}
- if (!GLEW_ARB_shader_objects) {
+ if (!GLEW_ARB_shader_objects) {
if (!mModified)
spit("GLSL not supported");
mModified = true;
@@ -892,6 +897,9 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
if (!mShader && !mModified) {
mShader = new BL_Shader();
mModified = true;
+
+ // Using a custom shader, make sure to initialize textures
+ InitTextures();
}
if (mShader && !mShader->GetError()) {
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 3a6dda06320..8fc86ef9cf2 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -138,6 +138,8 @@ private:
bool mModified;
bool mConstructed; // if false, don't clean on exit
+ void InitTextures();
+
void SetBlenderGLSLShader(int layer);
void ActivatGLMaterials( RAS_IRasterizer* rasty )const;
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index dfe45b8cfcd..e009478c803 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -192,10 +192,10 @@ static void Kx_VecUpMat3(float vec[3], float mat[][3], short axis)
mat[coz][2] = 0.0f;
}
- inp= mat[coz][2];
- mat[coy][0]= - inp*mat[coz][0];
- mat[coy][1]= - inp*mat[coz][1];
- mat[coy][2]= 1.0 - inp*mat[coz][2];
+ inp = mat[coz][2];
+ mat[coy][0] = - inp * mat[coz][0];
+ mat[coy][1] = - inp * mat[coz][1];
+ mat[coy][2] = 1.0f - inp * mat[coz][2];
if (Kx_Normalize((float *)mat[coy]) == 0.f) {
/* the camera is vertical, chose the y axis arbitrary */
@@ -260,7 +260,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
/* C2: blender test_visibility function. Can this be a ray-test? */
/* C3: fixed height */
- from[2] = (15.0*from[2] + lookat[2] + m_height)/16.0;
+ from[2] = (15.0f * from[2] + lookat[2] + m_height) / 16.0f;
/* C4: camera behind actor */
@@ -310,22 +310,22 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
break;
}
- inp= fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2];
- fac= (-1.0 + inp) * m_damping;
+ inp = fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2];
+ fac = (-1.0f + inp) * m_damping;
from[0]+= fac*fp1[0];
from[1]+= fac*fp1[1];
from[2]+= fac*fp1[2];
/* alleen alstie ervoor ligt: cross testen en loodrechte bijtellen */
- if (inp<0.0) {
- if (fp1[0]*fp2[1] - fp1[1]*fp2[0] > 0.0) {
- from[0]-= fac*fp1[1];
- from[1]+= fac*fp1[0];
+ if (inp < 0.0f) {
+ if (fp1[0] * fp2[1] - fp1[1] * fp2[0] > 0.0f) {
+ from[0] -= fac * fp1[1];
+ from[1] += fac * fp1[0];
}
else {
- from[0]+= fac*fp1[1];
- from[1]-= fac*fp1[0];
+ from[0] += fac * fp1[1];
+ from[1] -= fac * fp1[0];
}
}
@@ -334,17 +334,17 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
rc[0]= (lookat[0]-from[0]);
rc[1]= (lookat[1]-from[1]);
rc[2]= (lookat[2]-from[2]);
- distsq= rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2];
+ distsq = rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2];
if (distsq > maxdistsq) {
- distsq = 0.15*(distsq-maxdistsq)/distsq;
+ distsq = 0.15f * (distsq - maxdistsq) / distsq;
from[0] += distsq*rc[0];
from[1] += distsq*rc[1];
from[2] += distsq*rc[2];
}
else if (distsq < mindistsq) {
- distsq = 0.15*(mindistsq-distsq)/mindistsq;
+ distsq = 0.15f * (mindistsq - distsq) / mindistsq;
from[0] -= distsq*rc[0];
from[1] -= distsq*rc[1];
diff --git a/source/gameengine/Ketsji/KX_GameActuator.h b/source/gameengine/Ketsji/KX_GameActuator.h
index 8356bc1068b..0c1c4f0c277 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.h
+++ b/source/gameengine/Ketsji/KX_GameActuator.h
@@ -1,29 +1,29 @@
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
-//
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
/** \file KX_GameActuator.h
* \ingroup ketsji
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index c5145ef2171..496b3925456 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1162,8 +1162,8 @@ void KX_GameObject::NodeSetWorldScale(const MT_Vector3& scale)
{
// Make sure the objects have some scale
MT_Vector3 p_scale = parent->GetWorldScaling();
- if (fabs(p_scale[0]) < FLT_EPSILON ||
- fabs(p_scale[1]) < FLT_EPSILON ||
+ if (fabs(p_scale[0]) < FLT_EPSILON ||
+ fabs(p_scale[1]) < FLT_EPSILON ||
fabs(p_scale[2]) < FLT_EPSILON)
{
return;
@@ -1190,8 +1190,8 @@ void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans)
{
// Make sure the objects have some scale
MT_Vector3 scale = parent->GetWorldScaling();
- if (fabs(scale[0]) < FLT_EPSILON ||
- fabs(scale[1]) < FLT_EPSILON ||
+ if (fabs(scale[0]) < FLT_EPSILON ||
+ fabs(scale[1]) < FLT_EPSILON ||
fabs(scale[2]) < FLT_EPSILON)
{
return;
@@ -1203,7 +1203,7 @@ void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans)
MT_Vector3 newpos = invori*(trans-parent->GetWorldPosition())*scale;
NodeSetLocalPosition(MT_Point3(newpos[0],newpos[1],newpos[2]));
}
- else
+ else
{
NodeSetLocalPosition(trans);
}
@@ -1291,8 +1291,7 @@ void KX_GameObject::Resume(void)
void KX_GameObject::Suspend()
{
- if ((!m_ignore_activity_culling)
- && (!m_suspended)) {
+ if ((!m_ignore_activity_culling) && (!m_suspended)) {
SCA_IObject::Suspend();
if (GetPhysicsController())
GetPhysicsController()->SuspendDynamics();
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index 7e7e7f8cef2..5599f3e31c6 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -379,7 +379,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
void KX_IpoActuator::ResetStartTime()
{
- this->m_starttime = -2.0*fabs(this->m_endframe - this->m_startframe) - 1.0;
+ this->m_starttime = -2.0f * fabsf(this->m_endframe - this->m_startframe) - 1.0f;
}
int KX_IpoActuator::string2mode(const char *modename)
diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h
index 8924567acde..aec871d7700 100644
--- a/source/gameengine/Ketsji/KX_PyMath.h
+++ b/source/gameengine/Ketsji/KX_PyMath.h
@@ -138,9 +138,9 @@ bool PyVecTo(PyObject* pyval, T& vec)
#ifdef USE_MATHUTILS
/* no need for BaseMath_ReadCallback() here, reading the sequences will do this */
- if(VectorObject_Check(pyval)) {
+ if (VectorObject_Check(pyval)) {
VectorObject *pyvec= (VectorObject *)pyval;
- if(BaseMath_ReadCallback(pyvec) == -1) {
+ if (BaseMath_ReadCallback(pyvec) == -1) {
return false; /* exception raised */
}
if (pyvec->size != Size(vec)) {
@@ -150,9 +150,9 @@ bool PyVecTo(PyObject* pyval, T& vec)
vec.setValue((float *) pyvec->vec);
return true;
}
- else if(QuaternionObject_Check(pyval)) {
+ else if (QuaternionObject_Check(pyval)) {
QuaternionObject *pyquat= (QuaternionObject *)pyval;
- if(BaseMath_ReadCallback(pyquat) == -1) {
+ if (BaseMath_ReadCallback(pyquat) == -1) {
return false; /* exception raised */
}
if (4 != Size(vec)) {
@@ -163,9 +163,9 @@ bool PyVecTo(PyObject* pyval, T& vec)
vec.setValue((float *) pyquat->quat);
return true;
}
- else if(EulerObject_Check(pyval)) {
+ else if (EulerObject_Check(pyval)) {
EulerObject *pyeul= (EulerObject *)pyval;
- if(BaseMath_ReadCallback(pyeul) == -1) {
+ if (BaseMath_ReadCallback(pyeul) == -1) {
return false; /* exception raised */
}
if (3 != Size(vec)) {
@@ -174,10 +174,10 @@ bool PyVecTo(PyObject* pyval, T& vec)
}
vec.setValue((float *) pyeul->eul);
return true;
- } else
+ }
+ else
#endif
- if(PyTuple_Check(pyval))
- {
+ if (PyTuple_Check(pyval)) {
unsigned int numitems = PyTuple_GET_SIZE(pyval);
if (numitems != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec));
@@ -194,8 +194,8 @@ bool PyVecTo(PyObject* pyval, T& vec)
return true;
}
- else if (PyObject_TypeCheck(pyval, (PyTypeObject *)&PyObjectPlus::Type))
- { /* note, include this check because PySequence_Check does too much introspection
+ else if (PyObject_TypeCheck(pyval, (PyTypeObject *)&PyObjectPlus::Type)) {
+ /* note, include this check because PySequence_Check does too much introspection
* on the PyObject (like getting its __class__, on a BGE type this means searching up
* the parent list each time only to discover its not a sequence.
* GameObjects are often used as an alternative to vectors so this is a common case
@@ -207,16 +207,14 @@ bool PyVecTo(PyObject* pyval, T& vec)
PyErr_Format(PyExc_AttributeError, "expected a sequence type");
return false;
}
- else if (PySequence_Check(pyval))
- {
+ else if (PySequence_Check(pyval)) {
unsigned int numitems = PySequence_Size(pyval);
if (numitems != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec));
return false;
}
- for (unsigned int x = 0; x < numitems; x++)
- {
+ for (unsigned int x = 0; x < numitems; x++) {
PyObject *item = PySequence_GetItem(pyval, x); /* new ref */
vec[x] = PyFloat_AsDouble(item);
Py_DECREF(item);
@@ -228,8 +226,8 @@ bool PyVecTo(PyObject* pyval, T& vec)
}
return true;
- } else
- {
+ }
+ else {
PyErr_Format(PyExc_AttributeError, "not a sequence type, expected a sequence of numbers size %d", Size(vec));
}
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
index 39b7c44eda9..841feda5237 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
@@ -1,40 +1,39 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
/** \file gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
* \ingroup ketsji
+ *
+ * Add an object when this actuator is triggered
*/
-//
-// Add an object when this actuator is triggered
-//
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
-// Previously existed as:
-
-// \source\gameengine\GameLogic\SCA_AddObjectActuator.cpp
-
-// Please look here for revision history.
+/* Previously existed as:
+ * \source\gameengine\GameLogic\SCA_AddObjectActuator.cpp
+ * Please look here for revision history. */
#include "KX_SCA_AddObjectActuator.h"
#include "SCA_IScene.h"
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
index 40136f429a2..e0aba795e01 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
@@ -1,28 +1,29 @@
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
/** \file KX_SCA_AddObjectActuator.h
* \ingroup ketsji
@@ -40,7 +41,6 @@
#include "MT_Vector3.h"
-
class SCA_IScene;
class KX_SCA_AddObjectActuator : public SCA_IActuator
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
index ff44fad1f3f..35c791e427d 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
@@ -1,41 +1,38 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
/** \file gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
* \ingroup ketsji
+ * Adjust dynamics settins for this object
*/
-//
-// Adjust dynamics settins for this object
-//
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
-
-//
-// Previously existed as:
-
-// \source\gameengine\GameLogic\SCA_DynamicActuator.cpp
-
-// Please look here for revision history.
+
+/* Previously existed as:
+ * \source\gameengine\GameLogic\SCA_DynamicActuator.cpp
+ * Please look here for revision history. */
#include "KX_SCA_DynamicActuator.h"
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
index 885c7a0297f..01a91624c41 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
@@ -1,29 +1,29 @@
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): Campbell Barton
-//
-// ***** END GPL LICENSE BLOCK *****
-//
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
/** \file KX_SCA_DynamicActuator.h
* \ingroup ketsji
diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
index 374d5f2f211..1a503c074ed 100644
--- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
@@ -1,29 +1,29 @@
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
-//
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
/** \file KX_SCA_EndObjectActuator.h
* \ingroup ketsji
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
index 00a6e9e63d5..ffe5556cfe6 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
@@ -1,34 +1,35 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
/** \file gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
* \ingroup ketsji
+ *
+ * Replace the mesh for this actuator's parent
*/
-//
-// Replace the mesh for this actuator's parent
-//
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
//
// Previously existed as:
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
index c8e6123024d..d756c48f0f9 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
@@ -1,29 +1,29 @@
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
-//
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
/** \file KX_SCA_ReplaceMeshActuator.h
* \ingroup ketsji
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h
index 774f740dd00..8e157544e2e 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.h
+++ b/source/gameengine/Ketsji/KX_SceneActuator.h
@@ -1,29 +1,29 @@
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
-//
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
/** \file KX_SceneActuator.h
* \ingroup ketsji
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index af93121b50e..99732130f83 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -1,39 +1,40 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
/** \file gameengine/Ketsji/KX_TrackToActuator.cpp
* \ingroup ketsji
+ *
+ * Replace the mesh for this actuator's parent
*/
-//
-// Replace the mesh for this actuator's parent
-//
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
-
-// todo: not all trackflags / upflags are implemented/tested !
-// m_trackflag is used to determine the forward tracking direction
-// m_upflag for the up direction
-// normal situation is +y for forward, +z for up
+
+/* todo: not all trackflags / upflags are implemented/tested !
+ * m_trackflag is used to determine the forward tracking direction
+ * m_upflag for the up direction
+ * normal situation is +y for forward, +z for up */
#include "MT_Scalar.h"
#include "SCA_IActuator.h"
@@ -50,8 +51,6 @@
/* Native functions */
/* ------------------------------------------------------------------------- */
-
-
KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj,
SCA_IObject *ob,
int time,
@@ -123,19 +122,18 @@ MT_Matrix3x3 EulToMat3(float *eul)
/* old function from Blender */
-void Mat3ToEulOld(MT_Matrix3x3 mat, float *eul)
+void Mat3ToEulOld(MT_Matrix3x3 mat, float eul[3])
{
- MT_Scalar cy;
-
- cy = sqrt(mat[0][0]*mat[0][0] + mat[0][1]*mat[0][1]);
-
- if (cy > 16.0*FLT_EPSILON) {
- eul[0] = atan2(mat[1][2], mat[2][2]);
- eul[1] = atan2(-mat[0][2], cy);
- eul[2] = atan2(mat[0][1], mat[0][0]);
- } else {
- eul[0] = atan2(-mat[2][1], mat[1][1]);
- eul[1] = atan2(-mat[0][2], cy);
+ const float cy = sqrtf(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1]);
+
+ if (cy > (float)(16.0f * FLT_EPSILON)) {
+ eul[0] = atan2f( mat[1][2], mat[2][2]);
+ eul[1] = atan2f(-mat[0][2], cy);
+ eul[2] = atan2f( mat[0][1], mat[0][0]);
+ }
+ else {
+ eul[0] = atan2f(-mat[2][1], mat[1][1]);
+ eul[1] = atan2f(-mat[0][2], cy);
eul[2] = 0.0;
}
}
@@ -149,18 +147,18 @@ void compatible_eulFast(float *eul, float *oldrot)
/* angular difference of 360 degrees */
- dx= eul[0] - oldrot[0];
- dy= eul[1] - oldrot[1];
- dz= eul[2] - oldrot[2];
+ dx = eul[0] - oldrot[0];
+ dy = eul[1] - oldrot[1];
+ dz = eul[2] - oldrot[2];
- if ( fabs(dx) > MT_PI) {
- if (dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI;
+ if (fabsf(dx) > (float)MT_PI) {
+ if (dx > 0.0f) eul[0] -= (float)MT_2_PI; else eul[0] += (float)MT_2_PI;
}
- if ( fabs(dy) > MT_PI) {
- if (dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI;
+ if (fabsf(dy) > (float)MT_PI) {
+ if (dy > 0.0f) eul[1] -= (float)MT_2_PI; else eul[1] += (float)MT_2_PI;
}
- if ( fabs(dz) > MT_PI ) {
- if (dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI;
+ if (fabsf(dz) > (float)MT_PI) {
+ if (dz > 0.0f) eul[2] -= (float)MT_2_PI; else eul[2] += (float)MT_2_PI;
}
}
@@ -174,9 +172,9 @@ MT_Matrix3x3 matrix3x3_interpol(MT_Matrix3x3 oldmat, MT_Matrix3x3 mat, int m_tim
Mat3ToEulOld(mat, eul);
compatible_eulFast(eul, oldeul);
- eul[0]= (m_time*oldeul[0] + eul[0])/(1.0+m_time);
- eul[1]= (m_time*oldeul[1] + eul[1])/(1.0+m_time);
- eul[2]= (m_time*oldeul[2] + eul[2])/(1.0+m_time);
+ eul[0] = (m_time * oldeul[0] + eul[0]) / (1.0f + m_time);
+ eul[1] = (m_time * oldeul[1] + eul[1]) / (1.0f + m_time);
+ eul[2] = (m_time * oldeul[2] + eul[2]) / (1.0f + m_time);
return EulToMat3(eul);
}
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h b/source/gameengine/Ketsji/KX_TrackToActuator.h
index 8eb69b1ad08..fb2ced2a415 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.h
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.h
@@ -1,29 +1,29 @@
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
-//
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
/** \file KX_TrackToActuator.h
* \ingroup ketsji
diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h
index e4a73873fa1..5b35ca2ec54 100644
--- a/source/gameengine/Ketsji/KX_WorldInfo.h
+++ b/source/gameengine/Ketsji/KX_WorldInfo.h
@@ -43,7 +43,7 @@ class MT_CmMatrix4x4;
class KX_WorldInfo
{
public:
- KX_WorldInfo(){}
+ KX_WorldInfo() {}
virtual ~KX_WorldInfo();
virtual bool hasWorld()=0;
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index e63724fffc6..0a105ee1c1a 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -2048,6 +2048,15 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
m_forceReInstance= true;
}
+ // Make sure to also replace the mesh in the shape map! Otherwise we leave dangling references when we free.
+ // Note, this whole business could cause issues with shared meshes. If we update one mesh, do we replace
+ // them all?
+ std::map<RAS_MeshObject*,CcdShapeConstructionInfo*>::iterator mit = m_meshShapeMap.find(m_meshObject);
+ if (mit != m_meshShapeMap.end()) {
+ m_meshShapeMap.erase(mit);
+ m_meshShapeMap[meshobj] = this;
+ }
+
m_meshObject= meshobj;
if (dm) {
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
index 8fde9e289dc..30d63e6695d 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
@@ -107,7 +107,7 @@ class PHY_IPhysicsEnvironment
/// Perform an integration step of duration 'timeStep'.
virtual bool proceedDeltaTime(double curTime,float timeStep,float interval)=0;
///draw debug lines (make sure to call this during the render phase, otherwise lines are not drawn properly)
- virtual void debugDrawWorld(){}
+ virtual void debugDrawWorld() {}
virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)=0;
//returns 0.f if no fixed timestep is used
virtual float getFixedTimeStep()=0;
@@ -117,7 +117,7 @@ class PHY_IPhysicsEnvironment
///setNumIterations set the number of iterations for iterative solvers
virtual void setNumIterations(int numIter) {}
///setNumTimeSubSteps set the number of divisions of the timestep. Tradeoff quality versus performance.
- virtual void setNumTimeSubSteps(int numTimeSubSteps){}
+ virtual void setNumTimeSubSteps(int numTimeSubSteps) {}
///setDeactivationTime sets the minimum time that an objects has to stay within the velocity tresholds until it gets fully deactivated
virtual void setDeactivationTime(float dTime) {}
///setDeactivationLinearTreshold sets the linear velocity treshold, see setDeactivationTime
@@ -150,7 +150,7 @@ class PHY_IPhysicsEnvironment
float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0
)=0;
virtual void removeConstraint(int constraintid)=0;
- virtual float getAppliedImpulse(int constraintid){ return 0.f;}
+ virtual float getAppliedImpulse(int constraintid) { return 0.0f; }
//complex constraint for vehicles
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
index cf6ea653402..097c2a9c824 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
@@ -324,8 +324,8 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance)
void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas)
{
/* RAS_Rect canvas_rect = canvas->GetWindowArea(); */ /* UNUSED */
- texturewidth = canvas->GetWidth();
- textureheight = canvas->GetHeight();
+ texturewidth = canvas->GetWidth()+1;
+ textureheight = canvas->GetHeight()+1;
GLint i,j;
if (!GL_ARB_texture_non_power_of_two)
@@ -402,6 +402,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
GLuint viewport[4]={0};
glGetIntegerv(GL_VIEWPORT,(GLint *)viewport);
RAS_Rect rect = canvas->GetWindowArea();
+ int rect_width = rect.GetWidth()+1, rect_height = rect.GetHeight()+1;
if (canvaswidth != canvas->GetWidth() || canvasheight != canvas->GetHeight())
{
@@ -419,19 +420,19 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
if (need_depth) {
glActiveTextureARB(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, texname[1]);
- glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, rect.GetLeft(), rect.GetBottom(), rect.GetWidth(), rect.GetHeight(), 0);
+ glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0);
}
if (need_luminance) {
glActiveTextureARB(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, texname[2]);
- glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, rect.GetLeft(), rect.GetBottom(), rect.GetWidth(), rect.GetHeight(), 0);
+ glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0);
}
// reverting to texunit 0, without this we get bug [#28462]
glActiveTextureARB(GL_TEXTURE0);
- glViewport(rect.GetLeft(), rect.GetBottom(), rect.GetWidth()+1, rect.GetHeight()+1);
+ glViewport(rect.GetLeft(), rect.GetBottom(), rect_width, rect.GetHeight()+1);
glDisable(GL_DEPTH_TEST);
// in case the previous material was wire
@@ -454,7 +455,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
glActiveTextureARB(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texname[0]);
- glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rect.GetLeft(), rect.GetBottom(), rect.GetWidth(), rect.GetHeight(), 0); // Don't use texturewidth and textureheight in case we don't have NPOT support
+ glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0); // Don't use texturewidth and textureheight in case we don't have NPOT support
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
diff --git a/source/gameengine/Rasterizer/RAS_Deformer.h b/source/gameengine/Rasterizer/RAS_Deformer.h
index 627db2b63fb..51c4da3c49d 100644
--- a/source/gameengine/Rasterizer/RAS_Deformer.h
+++ b/source/gameengine/Rasterizer/RAS_Deformer.h
@@ -49,8 +49,8 @@ class RAS_MeshObject;
class RAS_Deformer
{
public:
- RAS_Deformer() : m_pMesh(NULL), m_bDynamic(false) {};
- virtual ~RAS_Deformer(){};
+ RAS_Deformer() : m_pMesh(NULL), m_bDynamic(false) {}
+ virtual ~RAS_Deformer() {}
virtual void Relink(CTR_Map<class CTR_HashedPtr, void*>*map)=0;
virtual bool Apply(class RAS_IPolyMaterial *polymat)=0;
virtual bool Update(void)=0;
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
index 0f89af490d8..169bc6e4ee6 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
@@ -174,7 +174,7 @@ public:
virtual bool UsesObjectColor() const;
virtual bool CastsShadows() const;
- virtual void Replace_IScene(SCA_IScene *val) {}; /* overridden by KX_BlenderMaterial */
+ virtual void Replace_IScene(SCA_IScene *val) {} /* overridden by KX_BlenderMaterial */
/**
* \return the equivalent drawing mode for the material settings (equivalent to old TexFace tface->mode).
@@ -184,7 +184,7 @@ public:
/*
* PreCalculate texture gen
*/
- virtual void OnConstruction(int layer){}
+ virtual void OnConstruction(int layer) {}
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index d4c19410eb1..7749c4af9d6 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -64,8 +64,8 @@ typedef vector< KX_IndexArray* > vecIndexArrays;
class RAS_IRasterizer
{
public:
- RAS_IRasterizer(RAS_ICanvas* canv){};
- virtual ~RAS_IRasterizer(){};
+ RAS_IRasterizer(RAS_ICanvas* canv) {};
+ virtual ~RAS_IRasterizer() {};
/**
* Drawing types
@@ -401,8 +401,8 @@ public:
virtual const MT_Matrix4x4& GetViewMatrix() const = 0;
virtual const MT_Matrix4x4& GetViewInvMatrix() const = 0;
- virtual bool QueryLists(){return false;}
- virtual bool QueryArrays(){return false;}
+ virtual bool QueryLists() { return false; }
+ virtual bool QueryArrays() { return false; }
virtual void EnableMotionBlur(float motionblurvalue)=0;
virtual void DisableMotionBlur()=0;
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
index 7cf7fee7845..295f2510313 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
@@ -54,7 +54,7 @@ class KX_ListSlot
protected:
int m_refcount;
public:
- KX_ListSlot(){ m_refcount=1; }
+ KX_ListSlot() { m_refcount = 1; }
virtual ~KX_ListSlot() {}
virtual int Release() {
if (--m_refcount > 0)
diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h
index 326110bea57..eb8655c8b1f 100644
--- a/source/gameengine/Rasterizer/RAS_MeshObject.h
+++ b/source/gameengine/Rasterizer/RAS_MeshObject.h
@@ -106,7 +106,7 @@ public:
/* modification state */
bool MeshModified();
- void SetMeshModified(bool v){m_bMeshModified = v;}
+ void SetMeshModified(bool v) { m_bMeshModified = v; }
/* original blender mesh */
Mesh* GetMesh() { return m_mesh; }
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
index 808c4f11dd8..a8eb2d5ffdf 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
@@ -72,7 +72,7 @@ public:
virtual void SetDrawingMode(int drawingmode);
- virtual bool QueryLists(){return true;}
+ virtual bool QueryLists() {return true;}
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index 7db433b5b4f..76d1a64a4c0 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -533,10 +533,10 @@ void RAS_OpenGLRasterizer::SetEye(const StereoEye eye)
glDrawBuffer(m_curreye == RAS_STEREO_LEFTEYE ? GL_BACK_LEFT : GL_BACK_RIGHT);
break;
case RAS_STEREO_ANAGLYPH:
- if (m_curreye == RAS_STEREO_LEFTEYE)
- {
+ if (m_curreye == RAS_STEREO_LEFTEYE) {
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
- } else {
+ }
+ else {
//glAccum(GL_LOAD, 1.0);
glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE);
ClearDepthBuffer();
@@ -892,7 +892,8 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
int current_blend_mode = GPU_get_material_alpha_blend();
ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM);
GPU_set_material_alpha_blend(current_blend_mode);
- } else {
+ }
+ else {
//ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol);
current_blmat_nr = current_polymat->GetMaterialIndex();
current_image = current_polymat->GetBlenderImage();
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
index 36f768f6474..e5eba249175 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
@@ -302,9 +302,9 @@ public:
virtual int GetMotionBlurState() { return m_motionblur; }
virtual void SetMotionBlurState(int newstate)
{
- if(newstate<0)
+ if (newstate < 0)
m_motionblur = 0;
- else if(newstate>2)
+ else if (newstate > 2)
m_motionblur = 2;
else
m_motionblur = newstate;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
index deda1c4603a..e881192171f 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
@@ -58,8 +58,8 @@ public:
private:
virtual void EnableTextures(bool enable);
- //virtual bool QueryArrays(){return true;}
- //virtual bool QueryLists(){return m_Lock;}
+ //virtual bool QueryArrays() {return true;}
+ //virtual bool QueryLists() {return m_Lock;}
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/SceneGraph/SG_BBox.cpp b/source/gameengine/SceneGraph/SG_BBox.cpp
index 4b2fc5410fa..3911babd2b5 100644
--- a/source/gameengine/SceneGraph/SG_BBox.cpp
+++ b/source/gameengine/SceneGraph/SG_BBox.cpp
@@ -217,7 +217,8 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const
right.m_min[2] = m_min[2];
right.m_max = m_max;
std::cout << "splity" << std::endl;
- } else {
+ }
+ else {
left.m_min = m_min;
left.m_max[0] = m_max[0];
left.m_max[1] = m_max[1];
@@ -229,9 +230,9 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const
right.m_max = m_max;
std::cout << "splitz" << std::endl;
}
- } else {
- if (sizex > sizez)
- {
+ }
+ else {
+ if (sizex > sizez) {
left.m_min = m_min;
left.m_max[0] = m_min[0] + sizex/2.0;
left.m_max[1] = m_max[1];
@@ -242,7 +243,8 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const
right.m_min[2] = m_min[2];
right.m_max = m_max;
std::cout << "splitx" << std::endl;
- } else {
+ }
+ else {
left.m_min = m_min;
left.m_max[0] = m_max[0];
left.m_max[1] = m_max[1];
diff --git a/source/gameengine/SceneGraph/SG_Spatial.cpp b/source/gameengine/SceneGraph/SG_Spatial.cpp
index e026419ca67..f8c4b5165ee 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.cpp
+++ b/source/gameengine/SceneGraph/SG_Spatial.cpp
@@ -151,10 +151,12 @@ RelativeTranslate(
) {
if (local) {
m_localPosition += m_localRotation * trans;
- } else {
+ }
+ else {
if (parent) {
m_localPosition += trans * parent->GetWorldOrientation();
- } else {
+ }
+ else {
m_localPosition += trans;
}
}
diff --git a/source/gameengine/SceneGraph/SG_Tree.cpp b/source/gameengine/SceneGraph/SG_Tree.cpp
index 738c0fdef22..0f8264985de 100644
--- a/source/gameengine/SceneGraph/SG_Tree.cpp
+++ b/source/gameengine/SceneGraph/SG_Tree.cpp
@@ -296,7 +296,8 @@ SG_Tree* SG_TreeFactory::MakeTreeDown(SG_BBox &bbox)
{
lefttree.Add(*it);
hasleft++;
- } else {
+ }
+ else {
righttree.Add(*it);
hasright++;
}
diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp
index 090b4f6ff4a..54c1939ce6b 100644
--- a/source/gameengine/VideoTexture/ImageBase.cpp
+++ b/source/gameengine/VideoTexture/ImageBase.cpp
@@ -246,7 +246,8 @@ bool ImageBase::checkSourceSizes (void)
// set current size as reference
refSize = curSize;
// otherwise check with current size
- } else if (curSize[0] != refSize[0] || curSize[1] != refSize[1]) {
+ }
+ else if (curSize[0] != refSize[0] || curSize[1] != refSize[1]) {
// if they don't match, report it
return false;
}
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index 97e52e3af3d..9fdd0cd393b 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -208,11 +208,11 @@ void ImageRender::Render()
frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
m_camera->SetProjectionMatrix(projmat);
- } else if (m_camera->hasValidProjectionMatrix())
- {
+ }
+ else if (m_camera->hasValidProjectionMatrix()) {
m_rasterizer->SetProjectionMatrix(m_camera->GetProjectionMatrix());
- } else
- {
+ }
+ else {
float lens = m_camera->GetLens();
float sensor_x = m_camera->GetSensorWidth();
float sensor_y = m_camera->GetSensorHeight();
@@ -241,8 +241,8 @@ void ImageRender::Render()
projmat = m_rasterizer->GetOrthoMatrix(
frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
- } else
- {
+ }
+ else {
RAS_FramingManager::ComputeDefaultFrustum(
nearfrust,
farfrust,
@@ -604,13 +604,12 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
mirrorVerts.push_back(v1);
mirrorVerts.push_back(v2);
mirrorVerts.push_back(v3);
- if (polygon->VertexCount() == 4)
- {
+ if (polygon->VertexCount() == 4) {
v4 = polygon->GetVertex(3);
mirrorVerts.push_back(v4);
area = normal_quad_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), (float*)v4->getXYZ());
- } else
- {
+ }
+ else {
area = normal_tri_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ());
}
area = fabs(area);
@@ -637,8 +636,8 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
// otherwise the Y axis is the up direction.
// If the mirror is not perfectly vertical(horizontal), the Z(Y) axis projection on the mirror
// plan by the normal will be the up direction.
- if (fabs(mirrorNormal[2]) > fabs(mirrorNormal[1]) &&
- fabs(mirrorNormal[2]) > fabs(mirrorNormal[0]))
+ if (fabsf(mirrorNormal[2]) > fabsf(mirrorNormal[1]) &&
+ fabsf(mirrorNormal[2]) > fabsf(mirrorNormal[0]))
{
// the mirror is more horizontal than vertical
copy_v3_v3(axis, yaxis);
@@ -649,7 +648,7 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
copy_v3_v3(axis, zaxis);
}
dist = dot_v3v3(mirrorNormal, axis);
- if (fabs(dist) < FLT_EPSILON)
+ if (fabsf(dist) < FLT_EPSILON)
{
// the mirror is already fully aligned with up axis
copy_v3_v3(mirrorUp, axis);
diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp
index f08a5a4a0b3..a21300018eb 100644
--- a/source/gameengine/VideoTexture/Texture.cpp
+++ b/source/gameengine/VideoTexture/Texture.cpp
@@ -130,13 +130,12 @@ short getMaterialID(PyObject * obj, const char *name)
if (mat == NULL)
break;
// name is a material name if it starts with MA and a UV texture name if it starts with IM
- if (name[0] == 'I' && name[1] == 'M')
- {
+ if (name[0] == 'I' && name[1] == 'M') {
// if texture name matches
if (strcmp(mat->GetTextureName().ReadPtr(), name) == 0)
return matID;
- } else
- {
+ }
+ else {
// if material name matches
if (strcmp(mat->GetMaterialName().ReadPtr(), name) == 0)
return matID;
diff --git a/source/gameengine/VideoTexture/VideoBase.h b/source/gameengine/VideoTexture/VideoBase.h
index 3657a20b841..e221d876358 100644
--- a/source/gameengine/VideoTexture/VideoBase.h
+++ b/source/gameengine/VideoTexture/VideoBase.h
@@ -130,7 +130,7 @@ public:
float getFrameRate (void) { return m_frameRate; }
/// set frame rate
virtual void setFrameRate (float rate)
- { if (m_isFile) m_frameRate = rate > 0.0 ? rate : 1.0f; }
+ { if (m_isFile) m_frameRate = rate > 0.0f ? rate : 1.0f; }
protected:
/// video format