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:
authorCampbell Barton <ideasman42@gmail.com>2012-06-19 12:16:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-19 12:16:07 +0400
commit66617d1b131dd51ca845cccb4453f85109b9e355 (patch)
treeff609bd2f929438875bfab0f24fb2b10af098ba9 /source/blender
parent9e79af949bd1e71910b598c0e4b995209854adc5 (diff)
parentfbbd64a118cb4f1bf96029599ed3ec9d91734d6b (diff)
svn merge ^/trunk/blender -r47961:48070
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/avi/intern/avi.c4
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c88
-rw-r--r--source/blender/blenkernel/intern/cloth.c12
-rw-r--r--source/blender/blenkernel/intern/collision.c4
-rw-r--r--source/blender/blenkernel/intern/curve.c2
-rw-r--r--source/blender/blenkernel/intern/implicit.c6
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/mesh.c4
-rw-r--r--source/blender/blenkernel/intern/movieclip.c29
-rw-r--r--source/blender/blenkernel/intern/node.c1
-rw-r--r--source/blender/blenkernel/intern/paint.c2
-rw-r--r--source/blender/blenkernel/intern/particle_system.c2
-rw-r--r--source/blender/blenkernel/intern/smoke.c2
-rw-r--r--source/blender/blenkernel/intern/tracking.c51
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c44
-rw-r--r--source/blender/blenlib/intern/fnmatch.c2
-rw-r--r--source/blender/blenlib/intern/string_utf8.c2
-rw-r--r--source/blender/blenlib/intern/threads.c18
-rw-r--r--source/blender/blenlib/intern/voronoi.c32
-rw-r--r--source/blender/blenloader/intern/readfile.c30
-rw-r--r--source/blender/collada/AnimationExporter.cpp2
-rw-r--r--source/blender/collada/ArmatureExporter.cpp116
-rw-r--r--source/blender/collada/ArmatureExporter.h26
-rw-r--r--source/blender/collada/DocumentImporter.cpp2
-rw-r--r--source/blender/collada/ExportSettings.h31
-rw-r--r--source/blender/collada/GeometryExporter.cpp2
-rw-r--r--source/blender/collada/MaterialExporter.cpp2
-rw-r--r--source/blender/collada/collada.cpp37
-rw-r--r--source/blender/collada/collada.h49
-rw-r--r--source/blender/collada/collada_utils.cpp71
-rw-r--r--source/blender/collada/collada_utils.h7
-rw-r--r--source/blender/compositor/CMakeLists.txt4
-rw-r--r--source/blender/compositor/COM_defines.h2
-rw-r--r--source/blender/compositor/intern/COM_CPUDevice.cpp4
-rw-r--r--source/blender/compositor/intern/COM_ChannelInfo.cpp4
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrder.cpp2
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp6
-rw-r--r--source/blender/compositor/intern/COM_Converter.cpp720
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cpp227
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp101
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp139
-rw-r--r--source/blender/compositor/intern/COM_InputSocket.cpp72
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp190
-rw-r--r--source/blender/compositor/intern/COM_Node.cpp41
-rw-r--r--source/blender/compositor/intern/COM_NodeBase.cpp13
-rw-r--r--source/blender/compositor/intern/COM_NodeBase.h4
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.cpp68
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.cpp6
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.h14
-rw-r--r--source/blender/compositor/intern/COM_OutputSocket.cpp18
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp2
-rw-r--r--source/blender/compositor/intern/COM_Socket.cpp6
-rw-r--r--source/blender/compositor/intern/COM_SocketConnection.cpp12
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp65
-rw-r--r--source/blender/compositor/nodes/COM_AlphaOverNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_BilateralBlurNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_BlurNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_BokehBlurNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_BokehImageNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_BoxMaskNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_BrightnessNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_ChannelMatteNode.cpp38
-rw-r--r--source/blender/compositor/nodes/COM_ChromaMatteNode.cpp8
-rw-r--r--source/blender/compositor/nodes/COM_ColorBalanceNode.cpp18
-rw-r--r--source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp13
-rw-r--r--source/blender/compositor/nodes/COM_ColorCurveNode.cpp16
-rw-r--r--source/blender/compositor/nodes/COM_ColorMatteNode.cpp8
-rw-r--r--source/blender/compositor/nodes/COM_ColorNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_ColorRampNode.cpp10
-rw-r--r--source/blender/compositor/nodes/COM_ColorSpillNode.cpp10
-rw-r--r--source/blender/compositor/nodes/COM_ColorToBWNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_CombineHSVANode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_CombineRGBANode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_CombineYCCANode.cpp3
-rw-r--r--source/blender/compositor/nodes/COM_CombineYUVANode.cpp3
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_CropNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_DefocusNode.cpp19
-rw-r--r--source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp14
-rw-r--r--source/blender/compositor/nodes/COM_DilateErodeNode.cpp63
-rw-r--r--source/blender/compositor/nodes/COM_DilateErodeNode.h1
-rw-r--r--source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_DisplaceNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_DistanceMatteNode.cpp8
-rw-r--r--source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_EllipseMaskNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_FilterNode.cpp69
-rw-r--r--source/blender/compositor/nodes/COM_FlipNode.cpp27
-rw-r--r--source/blender/compositor/nodes/COM_GammaNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_GlareNode.cpp45
-rw-r--r--source/blender/compositor/nodes/COM_GroupNode.cpp26
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp13
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp13
-rw-r--r--source/blender/compositor/nodes/COM_IDMaskNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.cpp76
-rw-r--r--source/blender/compositor/nodes/COM_InvertNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_KeyingNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_KeyingScreenNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_LensDistortionNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp8
-rw-r--r--source/blender/compositor/nodes/COM_MapUVNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_MapValueNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_MaskNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_MathNode.cpp38
-rw-r--r--source/blender/compositor/nodes/COM_MixNode.cpp118
-rw-r--r--source/blender/compositor/nodes/COM_MovieClipNode.cpp21
-rw-r--r--source/blender/compositor/nodes/COM_MovieDistortionNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_MuteNode.cpp20
-rw-r--r--source/blender/compositor/nodes/COM_NormalNode.cpp14
-rw-r--r--source/blender/compositor/nodes/COM_NormalizeNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_OutputFileNode.cpp25
-rw-r--r--source/blender/compositor/nodes/COM_RenderLayersNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_RotateNode.cpp21
-rw-r--r--source/blender/compositor/nodes/COM_ScaleNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_SeparateHSVANode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_SeparateRGBANode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_SeparateYCCANode.cpp3
-rw-r--r--source/blender/compositor/nodes/COM_SeparateYUVANode.cpp3
-rw-r--r--source/blender/compositor/nodes/COM_SetAlphaNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.cpp62
-rw-r--r--source/blender/compositor/nodes/COM_SplitViewerNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_Stabilize2dNode.cpp11
-rw-r--r--source/blender/compositor/nodes/COM_SwitchNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_TextureNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_TimeNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_TonemapNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_TransformNode.cpp29
-rw-r--r--source/blender/compositor/nodes/COM_TranslateNode.cpp3
-rw-r--r--source/blender/compositor/nodes/COM_ValueNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_VectorBlurNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_VectorCurveNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_ViewLevelsNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_ZCombineNode.cpp8
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp13
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp18
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp15
-rw-r--r--source/blender/compositor/operations/COM_AntiAliasOperation.cpp22
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.cpp29
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.h3
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.cpp18
-rw-r--r--source/blender/compositor/operations/COM_BokehImageOperation.cpp18
-rw-r--r--source/blender/compositor/operations/COM_BoxMaskOperation.cpp36
-rw-r--r--source/blender/compositor/operations/COM_BrightnessOperation.cpp16
-rw-r--r--source/blender/compositor/operations/COM_CalculateMeanOperation.cpp38
-rw-r--r--source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp51
-rw-r--r--source/blender/compositor/operations/COM_ChangeHSVOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ChannelMatteOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_ChromaMatteOperation.cpp28
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp26
-rw-r--r--source/blender/compositor/operations/COM_ColorCurveOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_ColorMatteOperation.cpp17
-rw-r--r--source/blender/compositor/operations/COM_ColorRampOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ColorSpillOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_CombineChannelsOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp22
-rw-r--r--source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp22
-rw-r--r--source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp22
-rw-r--r--source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp17
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp20
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_CurveBaseOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp16
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.cpp176
-rw-r--r--source/blender/compositor/operations/COM_DisplaceOperation.cpp16
-rw-r--r--source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_DistanceMatteOperation.cpp28
-rw-r--r--source/blender/compositor/operations/COM_DotproductOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp1062
-rw-r--r--source/blender/compositor/operations/COM_EllipseMaskOperation.cpp46
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp46
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_FlipOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_GammaCorrectOperation.cpp16
-rw-r--r--source/blender/compositor/operations/COM_GammaOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp190
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h62
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp190
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h62
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp18
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp18
-rw-r--r--source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_IDMaskOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ImageOperation.cpp52
-rw-r--r--source/blender/compositor/operations/COM_InvertOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_KeyingClipOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_KeyingDespillOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_KeyingOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_KeyingScreenOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp26
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.cpp72
-rw-r--r--source/blender/compositor/operations/COM_MapValueOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp17
-rw-r--r--source/blender/compositor/operations/COM_MixAddOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixBaseOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_MixBlendOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixBurnOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixColorOperation.cpp19
-rw-r--r--source/blender/compositor/operations/COM_MixDarkenOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixDifferenceOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixDivideOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixDodgeOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixGlareOperation.cpp11
-rw-r--r--source/blender/compositor/operations/COM_MixHueOperation.cpp19
-rw-r--r--source/blender/compositor/operations/COM_MixLightenOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixLinearLightOperation.cpp15
-rw-r--r--source/blender/compositor/operations/COM_MixMultiplyOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixOverlayOperation.cpp15
-rw-r--r--source/blender/compositor/operations/COM_MixSaturationOperation.cpp11
-rw-r--r--source/blender/compositor/operations/COM_MixScreenOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixSoftLightOperation.cpp15
-rw-r--r--source/blender/compositor/operations/COM_MixSubtractOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MixValueOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp26
-rw-r--r--source/blender/compositor/operations/COM_MovieClipOperation.cpp24
-rw-r--r--source/blender/compositor/operations/COM_MovieDistortionOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_MultilayerImageOperation.cpp34
-rw-r--r--source/blender/compositor/operations/COM_NormalizeOperation.cpp17
-rw-r--r--source/blender/compositor/operations/COM_OpenCLKernels.cl2
-rw-r--r--source/blender/compositor/operations/COM_OpenCLKernels.cl.h6
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cpp92
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.cpp32
-rw-r--r--source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp18
-rw-r--r--source/blender/compositor/operations/COM_QualityStepHelper.cpp64
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp8
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp26
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersImageProg.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_RotateOperation.cpp38
-rw-r--r--source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp98
-rw-r--r--source/blender/compositor/operations/COM_SeparateChannelOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_SetAlphaOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_SetColorOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_SetSamplerOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_SetValueOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_SetVectorOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.cpp26
-rw-r--r--source/blender/compositor/operations/COM_TonemapOperation.cpp17
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp32
-rw-r--r--source/blender/compositor/operations/COM_VectorCurveOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.cpp46
-rw-r--r--source/blender/compositor/operations/COM_ZCombineOperation.cpp14
-rw-r--r--source/blender/editors/CMakeLists.txt1
-rw-r--r--source/blender/editors/SConscript1
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/animation/keyframes_general.c2
-rw-r--r--source/blender/editors/animation/keyframing.c4
-rw-r--r--source/blender/editors/interface/interface_draw.c8
-rw-r--r--source/blender/editors/interface/interface_icons.c2
-rw-r--r--source/blender/editors/interface/resources.c3
-rw-r--r--source/blender/editors/io/CMakeLists.txt46
-rw-r--r--source/blender/editors/io/SConscript14
-rw-r--r--source/blender/editors/io/io_collada.c281
-rw-r--r--source/blender/editors/io/io_collada.h39
-rw-r--r--source/blender/editors/io/io_ops.c44
-rw-r--r--source/blender/editors/io/io_ops.h36
-rw-r--r--source/blender/editors/object/object_edit.c1
-rw-r--r--source/blender/editors/object/object_lattice.c4
-rw-r--r--source/blender/editors/screen/screen_ops.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c8
-rw-r--r--source/blender/editors/space_api/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_api/SConscript2
-rw-r--r--source/blender/editors/space_api/spacetypes.c3
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c3
-rw-r--r--source/blender/editors/space_clip/clip_draw.c62
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c360
-rw-r--r--source/blender/editors/space_file/file_draw.c118
-rw-r--r--source/blender/editors/space_file/file_intern.h14
-rw-r--r--source/blender/editors/space_file/file_ops.c366
-rw-r--r--source/blender/editors/space_file/file_panels.c74
-rw-r--r--source/blender/editors/space_file/filelist.c516
-rw-r--r--source/blender/editors/space_file/filelist.h82
-rw-r--r--source/blender/editors/space_file/filesel.c234
-rw-r--r--source/blender/editors/space_file/fsmenu.c6
-rw-r--r--source/blender/editors/space_file/fsmenu.h52
-rw-r--r--source/blender/editors/space_file/space_file.c142
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c16
-rw-r--r--source/blender/editors/space_text/text_draw.c2
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c40
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c4
-rw-r--r--source/blender/editors/transform/transform_snap.c2
-rw-r--r--source/blender/gpu/intern/gpu_draw.c4
-rw-r--r--source/blender/imbuf/intern/anim_movie.c4
-rw-r--r--source/blender/imbuf/intern/indexer.c16
-rw-r--r--source/blender/imbuf/intern/util.c4
-rw-r--r--source/blender/makesdna/DNA_node_types.h1
-rw-r--r--source/blender/makesdna/DNA_object_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c6
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c5
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h10
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c24
-rw-r--r--source/blender/makesrna/intern/rna_screen.c20
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c10
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c6
-rw-r--r--source/blender/nodes/composite/node_composite_util.c129
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c102
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_dilate.c91
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mask.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_particle_info.c12
-rw-r--r--source/blender/nodes/texture/node_texture_util.c6
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_coord.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_hueSatVal.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c2
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c2
-rw-r--r--source/blender/render/intern/source/external_engine.c80
-rw-r--r--source/blender/render/intern/source/initrender.c432
-rw-r--r--source/blender/render/intern/source/pixelblending.c295
-rw-r--r--source/blender/render/intern/source/volumetric.c4
-rw-r--r--source/blender/render/intern/source/zbuf.c2
-rw-r--r--source/blender/windowmanager/CMakeLists.txt1
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c11
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c233
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c7
-rw-r--r--source/blender/windowmanager/intern/wm_window.c22
359 files changed, 6305 insertions, 5058 deletions
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index e00982bae72..3d04db56d43 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -452,7 +452,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie)
return AVI_ERROR_FORMAT;
}
- movie->header = (AviMainHeader *) MEM_mallocN(sizeof (AviMainHeader), "movieheader");
+ movie->header = (AviMainHeader *) MEM_mallocN(sizeof(AviMainHeader), "movieheader");
if (GET_FCC(movie->fp) != FCC("AVI ") ||
GET_FCC(movie->fp) != FCC("LIST") ||
@@ -769,7 +769,7 @@ AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...)
if (movie->fp == NULL)
return AVI_ERROR_OPEN;
- movie->offset_table = (int64_t *) MEM_mallocN((1 + streams * 2) * sizeof (int64_t), "offsettable");
+ movie->offset_table = (int64_t *) MEM_mallocN((1 + streams * 2) * sizeof(int64_t), "offsettable");
for (i = 0; i < 1 + streams * 2; i++)
movie->offset_table[i] = -1L;
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index faa996b9888..144cbe2c18d 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 11
+#define BLENDER_SUBVERSION 12
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index d26a722b628..575c721bd54 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1627,7 +1627,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
int nextLvl = curLvl + 1;
int ptrIdx, cornerIdx, i;
int vertDataSize = ss->meshIFC.vertDataSize;
- void *q = ss->q, *r = ss->r;
+ float *q = ss->q, *r = ss->r;
#pragma omp parallel for private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
@@ -1642,11 +1642,11 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
for (x = 0; x < gridSize - 1; x++) {
int fx = 1 + 2 * x;
int fy = 1 + 2 * y;
- void *co0 = FACE_getIFCo(f, curLvl, S, x + 0, y + 0);
- void *co1 = FACE_getIFCo(f, curLvl, S, x + 1, y + 0);
- void *co2 = FACE_getIFCo(f, curLvl, S, x + 1, y + 1);
- void *co3 = FACE_getIFCo(f, curLvl, S, x + 0, y + 1);
- void *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
+ const float *co0 = FACE_getIFCo(f, curLvl, S, x + 0, y + 0);
+ const float *co1 = FACE_getIFCo(f, curLvl, S, x + 1, y + 0);
+ const float *co2 = FACE_getIFCo(f, curLvl, S, x + 1, y + 1);
+ const float *co3 = FACE_getIFCo(f, curLvl, S, x + 0, y + 1);
+ float *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
VertDataAvg4(co, co0, co1, co2, co3, ss);
}
@@ -1660,11 +1660,11 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
for (S = 0; S < f->numVerts; S++) {
for (x = 0; x < gridSize - 1; x++) {
int fx = x * 2 + 1;
- void *co0 = FACE_getIECo(f, curLvl, S, x + 0);
- void *co1 = FACE_getIECo(f, curLvl, S, x + 1);
- void *co2 = FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx);
- void *co3 = FACE_getIFCo(f, nextLvl, S, fx, 1);
- void *co = FACE_getIECo(f, nextLvl, S, fx);
+ const float *co0 = FACE_getIECo(f, curLvl, S, x + 0);
+ const float *co1 = FACE_getIECo(f, curLvl, S, x + 1);
+ const float *co2 = FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx);
+ const float *co3 = FACE_getIFCo(f, nextLvl, S, fx, 1);
+ float *co = FACE_getIECo(f, nextLvl, S, fx);
VertDataAvg4(co, co0, co1, co2, co3, ss);
}
@@ -1679,11 +1679,11 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
for (y = 0; y < gridSize - 1; y++) {
int fx = x * 2;
int fy = y * 2 + 1;
- void *co0 = FACE_getIFCo(f, curLvl, S, x, y + 0);
- void *co1 = FACE_getIFCo(f, curLvl, S, x, y + 1);
- void *co2 = FACE_getIFCo(f, nextLvl, S, fx - 1, fy);
- void *co3 = FACE_getIFCo(f, nextLvl, S, fx + 1, fy);
- void *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
+ const float *co0 = FACE_getIFCo(f, curLvl, S, x, y + 0);
+ const float *co1 = FACE_getIFCo(f, curLvl, S, x, y + 1);
+ const float *co2 = FACE_getIFCo(f, nextLvl, S, fx - 1, fy);
+ const float *co3 = FACE_getIFCo(f, nextLvl, S, fx + 1, fy);
+ float *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
VertDataAvg4(co, co0, co1, co2, co3, ss);
}
@@ -1694,11 +1694,11 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
for (x = 0; x < gridSize - 1; x++) {
int fx = x * 2 + 1;
int fy = y * 2;
- void *co0 = FACE_getIFCo(f, curLvl, S, x + 0, y);
- void *co1 = FACE_getIFCo(f, curLvl, S, x + 1, y);
- void *co2 = FACE_getIFCo(f, nextLvl, S, fx, fy - 1);
- void *co3 = FACE_getIFCo(f, nextLvl, S, fx, fy + 1);
- void *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
+ const float *co0 = FACE_getIFCo(f, curLvl, S, x + 0, y);
+ const float *co1 = FACE_getIFCo(f, curLvl, S, x + 1, y);
+ const float *co2 = FACE_getIFCo(f, nextLvl, S, fx, fy - 1);
+ const float *co3 = FACE_getIFCo(f, nextLvl, S, fx, fy + 1);
+ float *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
VertDataAvg4(co, co0, co1, co2, co3, ss);
}
@@ -1718,9 +1718,9 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
if (_edge_isBoundary(e) || sharpness > 1.0f) {
for (x = 0; x < edgeSize - 1; x++) {
int fx = x * 2 + 1;
- void *co0 = EDGE_getCo(e, curLvl, x + 0);
- void *co1 = EDGE_getCo(e, curLvl, x + 1);
- void *co = EDGE_getCo(e, nextLvl, fx);
+ const float *co0 = EDGE_getCo(e, curLvl, x + 0);
+ const float *co1 = EDGE_getCo(e, curLvl, x + 1);
+ float *co = EDGE_getCo(e, nextLvl, fx);
VertDataCopy(co, co0, ss);
VertDataAdd(co, co1, ss);
@@ -1730,9 +1730,9 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
else {
for (x = 0; x < edgeSize - 1; x++) {
int fx = x * 2 + 1;
- void *co0 = EDGE_getCo(e, curLvl, x + 0);
- void *co1 = EDGE_getCo(e, curLvl, x + 1);
- void *co = EDGE_getCo(e, nextLvl, fx);
+ const float *co0 = EDGE_getCo(e, curLvl, x + 0);
+ const float *co1 = EDGE_getCo(e, curLvl, x + 1);
+ float *co = EDGE_getCo(e, nextLvl, fx);
int numFaces = 0;
VertDataCopy(q, co0, ss);
@@ -1766,8 +1766,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
*/
for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
CCGVert *v = (CCGVert *) effectedV[ptrIdx];
- void *co = VERT_getCo(v, curLvl);
- void *nCo = VERT_getCo(v, nextLvl);
+ const float *co = VERT_getCo(v, curLvl);
+ float *nCo = VERT_getCo(v, nextLvl);
int sharpCount = 0, allSharp = 1;
float avgSharpness = 0.0;
int j, seam = VERT_seam(v), seamEdges = 0;
@@ -1878,8 +1878,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
/* r = co * 0.75 + q * 0.25 */
VertDataCopy(r, co, ss);
- VertDataMulN(r, .75f, ss);
- VertDataMulN(q, .25f, ss);
+ VertDataMulN(r, 0.75f, ss);
+ VertDataMulN(q, 0.25f, ss);
VertDataAdd(r, q, ss);
/* nCo = nCo + (r - nCo) * avgSharpness */
@@ -1914,14 +1914,18 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
avgSharpness = 0;
}
- if (_edge_isBoundary(e) && (!e->numFaces || sharpCount < 2)) {
+ if (_edge_isBoundary(e)) {
for (x = 1; x < edgeSize - 1; x++) {
int fx = x * 2;
- void *co = EDGE_getCo(e, curLvl, x);
- void *nCo = EDGE_getCo(e, nextLvl, fx);
+ const float *co = EDGE_getCo(e, curLvl, x);
+ float *nCo = EDGE_getCo(e, nextLvl, fx);
+
+ /* Average previous level's endpoints */
VertDataCopy(r, EDGE_getCo(e, curLvl, x - 1), ss);
VertDataAdd(r, EDGE_getCo(e, curLvl, x + 1), ss);
VertDataMulN(r, 0.5f, ss);
+
+ /* nCo = nCo * 0.75 + r * 0.25 */
VertDataCopy(nCo, co, ss);
VertDataMulN(nCo, 0.75f, ss);
VertDataMulN(r, 0.25f, ss);
@@ -1931,8 +1935,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
else {
for (x = 1; x < edgeSize - 1; x++) {
int fx = x * 2;
- void *co = EDGE_getCo(e, curLvl, x);
- void *nCo = EDGE_getCo(e, nextLvl, fx);
+ const float *co = EDGE_getCo(e, curLvl, x);
+ float *nCo = EDGE_getCo(e, nextLvl, fx);
int numFaces = 0;
VertDataZero(q, ss);
@@ -1974,7 +1978,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
#pragma omp parallel private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
{
- void *q, *r;
+ float *q, *r;
#pragma omp critical
{
@@ -2018,8 +2022,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
for (y = 1; y < gridSize - 1; y++) {
int fx = x * 2;
int fy = y * 2;
- void *co = FACE_getIFCo(f, curLvl, S, x, y);
- void *nCo = FACE_getIFCo(f, nextLvl, S, fx, fy);
+ const float *co = FACE_getIFCo(f, curLvl, S, x, y);
+ float *nCo = FACE_getIFCo(f, nextLvl, S, fx, fy);
VertDataAvg4(q,
FACE_getIFCo(f, nextLvl, S, fx - 1, fy - 1),
@@ -2049,8 +2053,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
*/
for (x = 1; x < gridSize - 1; x++) {
int fx = x * 2;
- void *co = FACE_getIECo(f, curLvl, S, x);
- void *nCo = FACE_getIECo(f, nextLvl, S, fx);
+ const float *co = FACE_getIECo(f, curLvl, S, x);
+ float *nCo = FACE_getIECo(f, nextLvl, S, fx);
VertDataAvg4(q,
FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx - 1),
@@ -2106,7 +2110,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, cornerIdx), VERT_getCo(FACE_getVerts(f)[S], nextLvl), ss);
VertDataCopy(FACE_getIECo(f, nextLvl, S, cornerIdx), EDGE_getCo(FACE_getEdges(f)[S], nextLvl, cornerIdx), ss);
for (x = 1; x < gridSize - 1; x++) {
- void *co = FACE_getIECo(f, nextLvl, S, x);
+ float *co = FACE_getIECo(f, nextLvl, S, x);
VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, 0), co, ss);
VertDataCopy(FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 0, x), co, ss);
}
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index b681426f8a7..a0cca25a841 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -1007,7 +1007,7 @@ int cloth_add_spring(ClothModifierData *clmd, unsigned int indexA, unsigned int
if (cloth) {
// TODO: look if this spring is already there
- spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
+ spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
if (!spring)
return 0;
@@ -1079,7 +1079,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
cloth->springs = NULL;
- edgelist = MEM_callocN ( sizeof ( LinkNode * ) * numverts, "cloth_edgelist_alloc" );
+ edgelist = MEM_callocN ( sizeof (LinkNode *) * numverts, "cloth_edgelist_alloc" );
if (!edgelist)
return 0;
@@ -1096,7 +1096,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
// structural springs
for ( i = 0; i < numedges; i++ ) {
- spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
+ spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
if ( spring ) {
spring->ij = MIN2(medge[i].v1, medge[i].v2);
@@ -1154,7 +1154,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
// if ( mface[i].v4 ) --> Quad face
- spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
+ spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
if (!spring) {
cloth_free_errorsprings(cloth, edgehash, edgelist);
@@ -1192,7 +1192,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
if (!BLI_edgehash_haskey(edgehash, MIN2(tspring2->ij, index2), MAX2(tspring2->ij, index2)) &&
(index2 != tspring2->ij))
{
- spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
+ spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
if (!spring) {
cloth_free_errorsprings(cloth, edgehash, edgelist);
@@ -1229,7 +1229,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
tspring2 = search2->link;
if (tspring->ij == tspring2->kl) {
- spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
+ spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
if (!spring) {
cloth_free_errorsprings(cloth, edgehash, edgelist);
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 44f524304d2..71b2f6952d5 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -643,12 +643,12 @@ static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, Collis
{
int i;
- *collisions = ( CollPair* ) MEM_mallocN ( sizeof ( CollPair ) * numresult * 64, "collision array" ); //*4 since cloth_collision_static can return more than 1 collision
+ *collisions = (CollPair *) MEM_mallocN(sizeof(CollPair) * numresult * 64, "collision array" ); //*4 since cloth_collision_static can return more than 1 collision
*collisions_index = *collisions;
for ( i = 0; i < numresult; i++ ) {
*collisions_index = cloth_collision ( (ModifierData *)clmd, (ModifierData *)collmd,
- overlap+i, *collisions_index, dt );
+ overlap+i, *collisions_index, dt );
}
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 623d4b8a931..674a2d98d07 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1713,7 +1713,7 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
t02 = x1 * x2 + y1 * y2;
if (fabs(t02) >= 1.0)
- t02 = .5 * M_PI;
+ t02 = 0.5 * M_PI;
else
t02 = (saacos(t02)) / 2.0f;
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 4aef47159df..4755fccff99 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -186,7 +186,7 @@ DO_INLINE void print_lfvector(float (*fLongVector)[3], unsigned int verts)
DO_INLINE lfVector *create_lfvector(unsigned int verts)
{
// TODO: check if memory allocation was successfull */
- return (lfVector *)MEM_callocN (verts * sizeof(lfVector), "cloth_implicit_alloc_vector");
+ return (lfVector *)MEM_callocN(verts * sizeof(lfVector), "cloth_implicit_alloc_vector");
// return (lfVector *)cloth_aligned_malloc(&MEMORY_BASE, verts * sizeof(lfVector));
}
/* delete long vector */
@@ -514,7 +514,7 @@ static void print_bfmatrix(fmatrix3x3 *m3)
DO_INLINE fmatrix3x3 *create_bfmatrix(unsigned int verts, unsigned int springs)
{
// TODO: check if memory allocation was successfull */
- fmatrix3x3 *temp = (fmatrix3x3 *)MEM_callocN (sizeof (fmatrix3x3) * (verts + springs), "cloth_implicit_alloc_matrix");
+ fmatrix3x3 *temp = (fmatrix3x3 *)MEM_callocN(sizeof(fmatrix3x3) * (verts + springs), "cloth_implicit_alloc_matrix");
temp[0].vcount = verts;
temp[0].scount = springs;
return temp;
@@ -720,7 +720,7 @@ int implicit_init(Object *UNUSED(ob), ClothModifierData *clmd)
verts = cloth->verts;
// create implicit base
- id = (Implicit_Data *)MEM_callocN (sizeof(Implicit_Data), "implicit vecmat");
+ id = (Implicit_Data *)MEM_callocN(sizeof(Implicit_Data), "implicit vecmat");
cloth->implicit = id;
/* process diagonal elements */
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index e3495a15871..d5b1d3c98c8 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -212,7 +212,7 @@ Lattice *BKE_lattice_copy(Lattice *lt)
if (lt->dvert) {
int tot = lt->pntsu * lt->pntsv * lt->pntsw;
- ltn->dvert = MEM_mallocN(sizeof (MDeformVert) * tot, "Lattice MDeformVert");
+ ltn->dvert = MEM_mallocN(sizeof(MDeformVert) * tot, "Lattice MDeformVert");
copy_dverts(ltn->dvert, lt->dvert, tot);
}
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index d0b9e73e295..e3b13ca0f17 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -444,7 +444,7 @@ void copy_dverts(MDeformVert *dst, MDeformVert *src, int copycount)
for (i = 0; i < copycount; i++) {
if (src[i].dw) {
dst[i].dw = MEM_callocN(sizeof(MDeformWeight) * src[i].totweight, "copy_deformWeight");
- memcpy(dst[i].dw, src[i].dw, sizeof (MDeformWeight) * src[i].totweight);
+ memcpy(dst[i].dw, src[i].dw, sizeof(MDeformWeight) * src[i].totweight);
}
}
@@ -957,7 +957,7 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, MLoop *alll
}
final++;
- (*alledge) = medge = MEM_callocN(sizeof (MEdge) * final, "BKE_mesh_make_edges mdge");
+ (*alledge) = medge = MEM_callocN(sizeof(MEdge) * final, "BKE_mesh_make_edges mdge");
(*_totedge) = final;
for (a = totedge, ed = edsort; a > 1; a--, ed++) {
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 68adb599c6c..04edc58157b 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -451,6 +451,21 @@ static MovieClip *movieclip_alloc(const char *name)
return clip;
}
+static void movieclip_load_get_szie(MovieClip *clip)
+{
+ int width, height;
+ MovieClipUser user = {0};
+
+ user.framenr = 1;
+ BKE_movieclip_get_size(clip, &user, &width, &height);
+
+ if (width && height) {
+ clip->tracking.camera.principal[0] = ((float)width) / 2.0f;
+ clip->tracking.camera.principal[1] = ((float)height) / 2.0f;
+
+ }
+}
+
/* checks if image was already loaded, then returns same image
* otherwise creates new.
* does not load ibuf itself
@@ -458,8 +473,7 @@ static MovieClip *movieclip_alloc(const char *name)
MovieClip *BKE_movieclip_file_add(const char *name)
{
MovieClip *clip;
- MovieClipUser user = {0};
- int file, len, width, height;
+ int file, len;
const char *libname;
char str[FILE_MAX], strtest[FILE_MAX];
@@ -502,11 +516,9 @@ MovieClip *BKE_movieclip_file_add(const char *name)
else
clip->source = MCLIP_SRC_SEQUENCE;
- user.framenr = 1;
- BKE_movieclip_get_size(clip, &user, &width, &height);
- if (width && height) {
- clip->tracking.camera.principal[0] = ((float)width) / 2.0f;
- clip->tracking.camera.principal[1] = ((float)height) / 2.0f;
+ movieclip_load_get_szie(clip);
+ if (clip->lastsize[0]) {
+ int width = clip->lastsize[0];
clip->tracking.camera.focal = 24.0f * width / clip->tracking.camera.sensor_width;
}
@@ -1022,6 +1034,9 @@ void BKE_movieclip_reload(MovieClip *clip)
else
clip->source = MCLIP_SRC_SEQUENCE;
+ clip->lastsize[0] = clip->lastsize[1] = 0;
+ movieclip_load_get_szie(clip);
+
movieclip_calc_length(clip);
}
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index bd3690e2174..a5e081d122d 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2098,4 +2098,3 @@ void clear_scene_in_nodes(Main *bmain, Scene *sce)
}
}
}
-
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index f7e3e103e99..ef3fd5c93d0 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -96,7 +96,7 @@ Paint *paint_get_active_from_context(const bContext *C)
obact = sce->basact->object;
if (CTX_wm_space_image(C) != NULL) {
- if (obact->mode == OB_MODE_EDIT) {
+ if (obact && obact->mode == OB_MODE_EDIT) {
if (ts->use_uv_sculpt)
return &ts->uvsculpt->paint;
else
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 6c7336958b5..569e69f2d51 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -4114,7 +4114,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
if (ptype&readMask) {
activeParts++;
- gzread(gzf, &(pa->size), sizeof( float ));
+ gzread(gzf, &(pa->size), sizeof(float));
pa->size /= 10.0f;
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index ebc31517524..32def1be647 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1856,7 +1856,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
BKE_ptcache_write(&pid, framenr);
tend();
- // printf ( "Frame: %d, Time: %f\n\n", (int)smd->time, ( float ) tval() );
+ // printf ( "Frame: %d, Time: %f\n\n", (int)smd->time, (float) tval() );
}
}
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 7edc240ff0a..3992f2be052 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -216,7 +216,7 @@ void BKE_tracking_get_camera_object_matrix(Scene *scene, Object *ob, float mat[4
}
void BKE_tracking_get_projection_matrix(MovieTracking *tracking, MovieTrackingObject *object,
- int framenr, int winx, int winy, float mat[4][4])
+ int framenr, int winx, int winy, float mat[4][4])
{
MovieReconstructedCamera *camera;
float lens = tracking->camera.focal * tracking->camera.sensor_width / (float)winx;
@@ -831,7 +831,7 @@ static bGPDlayer *track_mask_gpencil_layer_get(MovieTrackingTrack *track)
}
static void track_mask_gpencil_layer_rasterize(int frame_width, int frame_height,
- MovieTrackingMarker *marker, bGPDlayer *layer,
+ MovieTrackingMarker *marker, bGPDlayer *layer,
float *mask, int mask_width, int mask_height)
{
bGPDframe *frame = layer->frames.first;
@@ -853,7 +853,8 @@ static void track_mask_gpencil_layer_rasterize(int frame_width, int frame_height
fp[1] = (stroke_points[i].y - marker->search_min[1]) * frame_height / mask_height;
}
- PLX_raskterize((float (*)[2])mask_points, stroke->totpoints, mask, mask_width, mask_height, FALSE /* XXX- TODO: make on/off for AA*/);
+ /* TODO: add an option to control wether AA is enabled or not */
+ PLX_raskterize((float (*)[2])mask_points, stroke->totpoints, mask, mask_width, mask_height, FALSE);
MEM_freeN(mask_points);
}
@@ -1415,13 +1416,13 @@ void BKE_tracking_distortion_update(MovieDistortion *distortion, MovieTracking *
distortion->intrinsics = libmv_CameraIntrinsicsNew(camera->focal,
camera->principal[0], camera->principal[1] * aspy,
camera->k1, camera->k2, camera->k3,
- calibration_width, calibration_height * aspy);
+ calibration_width, calibration_height * aspy);
}
else {
libmv_CameraIntrinsicsUpdate(distortion->intrinsics, camera->focal,
camera->principal[0], camera->principal[1] * aspy,
camera->k1, camera->k2, camera->k3,
- calibration_width, calibration_height * aspy);
+ calibration_width, calibration_height * aspy);
}
#else
(void) distortion;
@@ -1558,7 +1559,7 @@ ImBuf *BKE_tracking_undistort_frame(MovieTracking *tracking, ImBuf *ibuf, int ca
camera->intrinsics = BKE_tracking_distortion_new();
return BKE_tracking_distortion_exec(camera->intrinsics, tracking, ibuf, calibration_width,
- calibration_height, overscan, TRUE);
+ calibration_height, overscan, TRUE);
}
ImBuf *BKE_tracking_distort_frame(MovieTracking *tracking, ImBuf *ibuf, int calibration_width,
@@ -1570,7 +1571,7 @@ ImBuf *BKE_tracking_distort_frame(MovieTracking *tracking, ImBuf *ibuf, int cali
camera->intrinsics = BKE_tracking_distortion_new();
return BKE_tracking_distortion_exec(camera->intrinsics, tracking, ibuf, calibration_width,
- calibration_height, overscan, FALSE);
+ calibration_height, overscan, FALSE);
}
/*********************** Image sampling *************************/
@@ -1578,14 +1579,14 @@ ImBuf *BKE_tracking_distort_frame(MovieTracking *tracking, ImBuf *ibuf, int cali
static void disable_imbuf_channels(ImBuf *ibuf, MovieTrackingTrack *track, int grayscale)
{
BKE_tracking_disable_channels(ibuf, track->flag & TRACK_DISABLE_RED,
- track->flag & TRACK_DISABLE_GREEN,
- track->flag & TRACK_DISABLE_BLUE, grayscale);
+ track->flag & TRACK_DISABLE_GREEN,
+ track->flag & TRACK_DISABLE_BLUE, grayscale);
}
ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *search_ibuf,
- MovieTrackingTrack *track, MovieTrackingMarker *marker,
- int use_mask, int num_samples_x, int num_samples_y,
- float pos[2])
+ MovieTrackingTrack *track, MovieTrackingMarker *marker,
+ int use_mask, int num_samples_x, int num_samples_y,
+ float pos[2])
{
#ifdef WITH_LIBMV
ImBuf *pattern_ibuf;
@@ -1661,7 +1662,7 @@ ImBuf *BKE_tracking_get_pattern_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, Mo
search_ibuf = BKE_tracking_get_search_imbuf(ibuf, track, marker, anchored, disable_channels);
pattern_ibuf = BKE_tracking_sample_pattern(ibuf->x, ibuf->y, search_ibuf, track, marker,
- FALSE, num_samples_x, num_samples_y, NULL);
+ FALSE, num_samples_x, num_samples_y, NULL);
IMB_freeImBuf(search_ibuf);
@@ -1711,7 +1712,7 @@ ImBuf *BKE_tracking_get_search_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, Mov
* out, do a partial grayscale conversion so the display is better.
*/
void BKE_tracking_disable_channels(ImBuf *ibuf, int disable_red, int disable_green, int disable_blue,
- int grayscale)
+ int grayscale)
{
int x, y;
float scale;
@@ -2470,9 +2471,9 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
/* run the tracker! */
tracked = libmv_trackRegion(&options,
track_context->search_area,
- track_context->search_area_width,
- track_context->search_area_height,
- patch_new, width, height,
+ track_context->search_area_width,
+ track_context->search_area_height,
+ patch_new, width, height,
src_pixel_x, src_pixel_y,
&result,
dst_pixel_x, dst_pixel_y);
@@ -2482,7 +2483,7 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
#pragma omp critical
{
tracking_insert_new_marker(context, track, marker, curfra, tracked,
- frame_width, frame_height, dst_pixel_x, dst_pixel_y);
+ frame_width, frame_height, dst_pixel_x, dst_pixel_y);
}
ok = TRUE;
@@ -2869,18 +2870,6 @@ static void reconstruct_update_solve_cb(void *customdata, double progress, const
}
#endif
-#if 0
-static int solve_reconstruction_testbreak_cb(void *customdata)
-{
- ReconstructProgressData *progressdata = customdata;
-
- if (progressdata->stop && *progressdata->stop)
- return TRUE;
-
- return G.afbreek;
-}
-#endif
-
void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *stop, short *do_update,
float *progress, char *stats_message, int message_size)
{
@@ -3070,7 +3059,7 @@ void BKE_tracking_detect_fast(MovieTracking *tracking, ListBase *tracksbase, ImB
MEM_freeN(pixels);
detect_retrieve_libmv_features(tracking, tracksbase, features, framenr,
- ibuf->x, ibuf->y, layer, place_outside_layer);
+ ibuf->x, ibuf->y, layer, place_outside_layer);
libmv_destroyFeatures(features);
#else
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 40471514b48..b3101638a4e 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -42,8 +42,8 @@
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/rational.h>
+#include <libavutil/samplefmt.h>
#include <libswscale/swscale.h>
-#include <libavcodec/opt.h>
#include "MEM_guardedalloc.h"
@@ -615,7 +615,7 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
c->sample_rate = rd->ffcodecdata.audio_mixrate;
c->bit_rate = ffmpeg_audio_bitrate * 1000;
- c->sample_fmt = SAMPLE_FMT_S16;
+ c->sample_fmt = AV_SAMPLE_FMT_S16;
c->channels = rd->ffcodecdata.audio_channels;
codec = avcodec_find_encoder(c->codec_id);
if (!codec) {
@@ -657,11 +657,21 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
}
/* essential functions -- start, append, end */
+static void ffmpeg_dict_set_int(AVDictionary **dict, const char *key, int value)
+{
+ char buffer[32];
+
+ BLI_snprintf(buffer, sizeof(buffer), "%d", value);
+
+ av_dict_set(dict, key, buffer, 0);
+}
+
static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, ReportList *reports)
{
/* Handle to the output file */
AVFormatContext *of;
AVOutputFormat *fmt;
+ AVDictionary *opts = NULL;
char name[256];
const char **exts;
@@ -707,13 +717,14 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
of->oformat = fmt;
of->packet_size = rd->ffcodecdata.mux_packet_size;
if (ffmpeg_audio_codec != CODEC_ID_NONE) {
- of->mux_rate = rd->ffcodecdata.mux_rate;
+ ffmpeg_dict_set_int(&opts, "muxrate", rd->ffcodecdata.mux_rate);
}
else {
- of->mux_rate = 0;
+ av_dict_set(&opts, "muxrate", "0", 0);
}
- of->preload = (int)(0.5 * AV_TIME_BASE);
+ ffmpeg_dict_set_int(&opts, "preload", (int)(0.5 * AV_TIME_BASE));
+
of->max_delay = (int)(0.7 * AV_TIME_BASE);
fmt->audio_codec = ffmpeg_audio_codec;
@@ -776,6 +787,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
fmt->audio_codec = CODEC_ID_PCM_S16LE;
if (ffmpeg_audio_codec != CODEC_ID_NONE && rd->ffcodecdata.audio_mixrate != 48000 && rd->ffcodecdata.audio_channels != 2) {
BKE_report(reports, RPT_ERROR, "FFMPEG only supports 48khz / stereo audio for DV!");
+ av_dict_free(&opts);
return 0;
}
}
@@ -785,6 +797,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
printf("alloc video stream %p\n", video_stream);
if (!video_stream) {
BKE_report(reports, RPT_ERROR, "Error initializing video stream.");
+ av_dict_free(&opts);
return 0;
}
}
@@ -793,27 +806,26 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of);
if (!audio_stream) {
BKE_report(reports, RPT_ERROR, "Error initializing audio stream.");
+ av_dict_free(&opts);
return 0;
}
}
- if (av_set_parameters(of, NULL) < 0) {
- BKE_report(reports, RPT_ERROR, "Error setting output parameters.");
- return 0;
- }
if (!(fmt->flags & AVFMT_NOFILE)) {
if (avio_open(&of->pb, name, AVIO_FLAG_WRITE) < 0) {
BKE_report(reports, RPT_ERROR, "Could not open file for writing.");
+ av_dict_free(&opts);
return 0;
}
}
-
- if (av_write_header(of) < 0) {
+ if (avformat_write_header(of, NULL) < 0) {
BKE_report(reports, RPT_ERROR, "Could not initialize streams. Probably unsupported codec combination.");
+ av_dict_free(&opts);
return 0;
}
outfile = of;
av_dump_format(of, 0, name, 1);
+ av_dict_free(&opts);
return 1;
}
@@ -1194,7 +1206,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char
char name_[128];
char *name;
char *param;
- IDProperty *prop;
+ IDProperty *prop = NULL;
avcodec_get_context_defaults(&c);
@@ -1222,9 +1234,11 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char
}
if (param && o->type != FF_OPT_TYPE_CONST && o->unit) {
p = my_av_find_opt(&c, param, o->unit, 0, 0);
- prop = BKE_ffmpeg_property_add(rd,
- (char *) type, p - c.av_class->option,
- o - c.av_class->option);
+ if (p) {
+ prop = BKE_ffmpeg_property_add(rd,
+ (char *) type, p - c.av_class->option,
+ o - c.av_class->option);
+ }
}
else {
prop = BKE_ffmpeg_property_add(rd,
diff --git a/source/blender/blenlib/intern/fnmatch.c b/source/blender/blenlib/intern/fnmatch.c
index e29f31897c0..60e898a3f19 100644
--- a/source/blender/blenlib/intern/fnmatch.c
+++ b/source/blender/blenlib/intern/fnmatch.c
@@ -25,8 +25,8 @@
#endif
#include <errno.h>
-#include <BLI_fnmatch.h>
#include <ctype.h>
+#include "BLI_fnmatch.h"
/* Comment out all this code if we are using the GNU C Library, and are not
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 9795d4dea2d..ff234a971aa 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -211,7 +211,7 @@ size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t max
{
size_t len = 0;
while (*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isn't known :| */
- len += BLI_str_utf8_from_unicode(*src++, dst+len);
+ len += BLI_str_utf8_from_unicode(*src++, dst + len);
}
dst[len]= '\0';
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index dc4c15a82fc..d591f98ddc0 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -44,14 +44,14 @@
/* for checking system threads - BLI_system_thread_count */
#ifdef WIN32
-#include "windows.h"
-#include <sys/timeb.h>
+# include <windows.h>
+# include <sys/timeb.h>
#elif defined(__APPLE__)
-#include <sys/types.h>
-#include <sys/sysctl.h>
+# include <sys/types.h>
+# include <sys/sysctl.h>
#else
-#include <unistd.h>
-#include <sys/time.h>
+# include <unistd.h>
+# include <sys/time.h>
#endif
#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
@@ -576,7 +576,7 @@ void *BLI_thread_queue_pop(ThreadQueue *queue)
if (!BLI_gsqueue_is_empty(queue->queue)) {
BLI_gsqueue_pop(queue->queue, &work);
- if(BLI_gsqueue_is_empty(queue->queue))
+ if (BLI_gsqueue_is_empty(queue->queue))
pthread_cond_broadcast(&queue->finish_cond);
}
@@ -642,7 +642,7 @@ void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms)
if (!BLI_gsqueue_is_empty(queue->queue)) {
BLI_gsqueue_pop(queue->queue, &work);
- if(BLI_gsqueue_is_empty(queue->queue))
+ if (BLI_gsqueue_is_empty(queue->queue))
pthread_cond_broadcast(&queue->finish_cond);
}
@@ -678,7 +678,7 @@ void BLI_thread_queue_wait_finish(ThreadQueue *queue)
/* wait for finish condition */
pthread_mutex_lock(&queue->mutex);
- while(!BLI_gsqueue_is_empty(queue->queue))
+ while (!BLI_gsqueue_is_empty(queue->queue))
pthread_cond_wait(&queue->finish_cond, &queue->mutex);
pthread_mutex_unlock(&queue->mutex);
diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c
index 0088d24d741..727e42dc8de 100644
--- a/source/blender/blenlib/intern/voronoi.c
+++ b/source/blender/blenlib/intern/voronoi.c
@@ -49,10 +49,10 @@ enum {
typedef struct VoronoiEvent {
struct VoronoiEvent *next, *prev;
- int type; /* type of event (site or circle) */
- float site[2]; /* site for which event was generated */
+ int type; /* type of event (site or circle) */
+ float site[2]; /* site for which event was generated */
- struct VoronoiParabola *parabola; /* parabola for which event was generated */
+ struct VoronoiParabola *parabola; /* parabola for which event was generated */
} VoronoiEvent;
typedef struct VoronoiParabola {
@@ -254,9 +254,9 @@ static float voronoi_getXOfEdge(VoronoiProcess *process, VoronoiParabola *par, f
b = b1 - b2;
c = c1 - c2;
- disc = b*b - 4 * a * c;
- x1 = (-b + sqrtf(disc)) / (2*a);
- x2 = (-b - sqrtf(disc)) / (2*a);
+ disc = b * b - 4 * a * c;
+ x1 = (-b + sqrtf(disc)) / (2 * a);
+ x2 = (-b - sqrtf(disc)) / (2 * a);
if (p[1] < r[1])
ry = MAX2(x1, x2);
@@ -268,7 +268,7 @@ static float voronoi_getXOfEdge(VoronoiProcess *process, VoronoiParabola *par, f
static VoronoiParabola *voronoi_getParabolaByX(VoronoiProcess *process, float xx)
{
- VoronoiParabola * par = process->root;
+ VoronoiParabola *par = process->root;
float x = 0.0f;
float ly = process->current_y;
@@ -371,7 +371,7 @@ static void voronoi_addParabola(VoronoiProcess *process, float site[2])
s[0] = (site[0] + fp[0]) / 2.0f;
s[1] = process->height;
- if(site[0] > fp[0])
+ if (site[0] > fp[0])
root->edge = voronoiEdge_new(s, fp, site);
else
root->edge = voronoiEdge_new(s, site, fp);
@@ -506,12 +506,12 @@ void voronoi_finishEdge(VoronoiProcess *process, VoronoiParabola *parabola)
void voronoi_clampEdgeVertex(int width, int height, float *coord, float *other_coord)
{
const float corners[4][2] = {{0.0f, 0.0f},
- {width - 1, 0.0f},
- {width - 1, height - 1},
- {0.0f, height - 1}};
+ {width - 1, 0.0f},
+ {width - 1, height - 1},
+ {0.0f, height - 1}};
int i;
- if (IN_RANGE_INCL(coord[0], 0, width-1) && IN_RANGE_INCL(coord[1], 0, height-1)) {
+ if (IN_RANGE_INCL(coord[0], 0, width - 1) && IN_RANGE_INCL(coord[1], 0, height - 1)) {
return;
}
@@ -609,9 +609,9 @@ static int voronoi_getNextSideCoord(ListBase *edges, float coord[2], int dim, in
static void voronoi_createBoundaryEdges(ListBase *edges, int width, int height)
{
const float corners[4][2] = {{width - 1, 0.0f},
- {width - 1, height - 1},
- {0.0f, height - 1},
- {0.0f, 0.0f}};
+ {width - 1, height - 1},
+ {0.0f, height - 1},
+ {0.0f, 0.0f}};
int i, dim = 0, dir = 1;
float coord[2] = {0.0f, 0.0f};
@@ -756,7 +756,7 @@ static void voronoi_addTriangle(int v1, int v2, int v3, int (**triangles)[3], in
*triangles = MEM_callocN(sizeof(int[3]), "trianglulation triangles");
}
- triangle = (int*)&(*triangles)[(*triangles_total)];
+ triangle = (int *)&(*triangles)[(*triangles_total)];
triangle[0] = v1;
triangle[1] = v2;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 48f9d1df687..b481fd421dc 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6787,17 +6787,24 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
node->storage = nimf;
- /* split off filename from the old path, to be used as socket sub-path */
- BLI_split_dirfile(old_data->name, basepath, filename, sizeof(basepath), sizeof(filename));
-
- BLI_strncpy(nimf->base_path, basepath, sizeof(nimf->base_path));
- nimf->format = old_data->im_format;
+ /* looks like storage data can be messed up somehow, stupid check here */
+ if (old_data) {
+ /* split off filename from the old path, to be used as socket sub-path */
+ BLI_split_dirfile(old_data->name, basepath, filename, sizeof(basepath), sizeof(filename));
+
+ BLI_strncpy(nimf->base_path, basepath, sizeof(nimf->base_path));
+ nimf->format = old_data->im_format;
+ }
+ else {
+ basepath[0] = '\0';
+ BLI_strncpy(filename, old_image->name, sizeof(filename));
+ }
/* if z buffer is saved, change the image type to multilayer exr.
* XXX this is slightly messy, Z buffer was ignored before for anything but EXR and IRIS ...
* i'm just assuming here that IRIZ means IRIS with z buffer ...
*/
- if (ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
+ if (old_data && ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
char sockpath[FILE_MAX];
nimf->format.imtype = R_IMF_IMTYPE_MULTILAYER;
@@ -6832,7 +6839,8 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
nodeRemoveSocket(ntree, node, old_image);
nodeRemoveSocket(ntree, node, old_z);
- MEM_freeN(old_data);
+ if (old_data)
+ MEM_freeN(old_data);
}
else if (node->type==CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) {
NodeImageMultiFile *nimf = node->storage;
@@ -7773,6 +7781,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 12)) {
+ Material *ma;
+
+ for (ma = main->mat.first; ma; ma = ma->id.next)
+ if (ma->strand_widthfade == 2.0f)
+ ma->strand_widthfade = 0.0f;
+ }
+
/* 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! */
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 9582da4fe5c..57829f777c5 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -1114,7 +1114,7 @@ bool AnimationExporter::hasAnimations(Scene *sce)
{
LinkNode *node;
- for(node=this->export_settings->export_set; node; node=node->next) {
+ for (node=this->export_settings->export_set; node; node=node->next) {
Object *ob = (Object *)node->link;
FCurve *fcu = 0;
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 98047df8aa4..9ac943f369c 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -80,6 +80,18 @@ bool ArmatureExporter::is_skinned_mesh(Object *ob)
return bc_get_assigned_armature(ob) != NULL;
}
+
+void ArmatureExporter::write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone)
+{
+ if (bc_is_root_bone(bone, this->export_settings->deform_bones_only))
+ ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm)));
+ else {
+ for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
+ write_bone_URLs(ins, ob_arm, child);
+ }
+ }
+}
+
bool ArmatureExporter::add_instance_controller(Object *ob)
{
Object *ob_arm = bc_get_assigned_armature(ob);
@@ -96,8 +108,7 @@ bool ArmatureExporter::add_instance_controller(Object *ob)
// write root bone URLs
Bone *bone;
for (bone = (Bone *)arm->bonebase.first; bone; bone = bone->next) {
- if (!bone->parent)
- ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm)));
+ write_bone_URLs(ins, ob_arm, bone);
}
InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob);
@@ -164,67 +175,76 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce,
SceneExporter *se,
std::list<Object *>& child_objects)
{
- std::string node_id = get_joint_id(bone, ob_arm);
- std::string node_name = std::string(bone->name);
- std::string node_sid = get_joint_sid(bone, ob_arm);
+ if (!(this->export_settings->deform_bones_only && bone->flag & BONE_NO_DEFORM)) {
+ std::string node_id = get_joint_id(bone, ob_arm);
+ std::string node_name = std::string(bone->name);
+ std::string node_sid = get_joint_sid(bone, ob_arm);
- COLLADASW::Node node(mSW);
+ COLLADASW::Node node(mSW);
- node.setType(COLLADASW::Node::JOINT);
- node.setNodeId(node_id);
- node.setNodeName(node_name);
- node.setNodeSid(node_sid);
+ node.setType(COLLADASW::Node::JOINT);
+ node.setNodeId(node_id);
+ node.setNodeName(node_name);
+ node.setNodeSid(node_sid);
- /*if ( bone->childbase.first == NULL || BLI_countlist(&(bone->childbase))>=2)
- add_blender_leaf_bone( bone, ob_arm , node );
- else{*/
- node.start();
+#if 0
+ if (bone->childbase.first == NULL || BLI_countlist(&(bone->childbase)) >= 2) {
+ add_blender_leaf_bone( bone, ob_arm , node );
+ }
+ else {
+#endif
+ node.start();
- add_bone_transform(ob_arm, bone, node);
+ add_bone_transform(ob_arm, bone, node);
- // Write nodes of childobjects, remove written objects from list
- std::list<Object *>::iterator i = child_objects.begin();
+ // Write nodes of childobjects, remove written objects from list
+ std::list<Object *>::iterator i = child_objects.begin();
- while (i != child_objects.end()) {
- if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) {
- float backup_parinv[4][4];
- copy_m4_m4(backup_parinv, (*i)->parentinv);
+ while (i != child_objects.end()) {
+ if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) {
+ float backup_parinv[4][4];
+ copy_m4_m4(backup_parinv, (*i)->parentinv);
- // crude, temporary change to parentinv
- // so transform gets exported correctly.
+ // crude, temporary change to parentinv
+ // so transform gets exported correctly.
- // Add bone tail- translation... don't know why
- // bone parenting is against the tail of a bone
- // and not it's head, seems arbitrary.
- (*i)->parentinv[3][1] += bone->length;
+ // Add bone tail- translation... don't know why
+ // bone parenting is against the tail of a bone
+ // and not it's head, seems arbitrary.
+ (*i)->parentinv[3][1] += bone->length;
- // SECOND_LIFE_COMPATIBILITY
- // TODO: when such objects are animated as
- // single matrix the tweak must be applied
- // to the result.
- if (export_settings->second_life) {
- // tweak objects parentinverse to match compatibility
- float temp[4][4];
+ // SECOND_LIFE_COMPATIBILITY
+ // TODO: when such objects are animated as
+ // single matrix the tweak must be applied
+ // to the result.
+ if (export_settings->second_life) {
+ // tweak objects parentinverse to match compatibility
+ float temp[4][4];
- copy_m4_m4(temp, bone->arm_mat);
- temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
+ copy_m4_m4(temp, bone->arm_mat);
+ temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
- mult_m4_m4m4((*i)->parentinv, temp, (*i)->parentinv);
- }
+ mult_m4_m4m4((*i)->parentinv, temp, (*i)->parentinv);
+ }
- se->writeNodes(*i, sce);
+ se->writeNodes(*i, sce);
- copy_m4_m4((*i)->parentinv, backup_parinv);
- child_objects.erase(i++);
+ copy_m4_m4((*i)->parentinv, backup_parinv);
+ child_objects.erase(i++);
+ }
+ else i++;
}
- else i++;
- }
- for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
- add_bone_node(child, ob_arm, sce, se, child_objects);
+ for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
+ add_bone_node(child, ob_arm, sce, se, child_objects);
+ }
+ node.end();
+ }
+ else {
+ for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
+ add_bone_node(child, ob_arm, sce, se, child_objects);
+ }
}
- node.end();
- //}
}
#if 0
@@ -325,7 +345,7 @@ void ArmatureExporter::export_controller(Object *ob, Object *ob_arm)
Mesh *me;
if (this->export_settings->apply_modifiers) {
- me = bc_to_mesh_apply_modifiers(scene, ob);
+ me = bc_to_mesh_apply_modifiers(scene, ob, this->export_settings->export_mesh_type);
}
else {
me = (Mesh *)ob->data;
diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h
index beef77af767..086c16f0cd5 100644
--- a/source/blender/collada/ArmatureExporter.h
+++ b/source/blender/collada/ArmatureExporter.h
@@ -53,14 +53,14 @@ class SceneExporter;
// XXX exporter writes wrong data for shared armatures. A separate
// controller should be written for each armature-mesh binding how do
// we make controller ids then?
-class ArmatureExporter: public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
+class ArmatureExporter : public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
{
public:
ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
// write bone nodes
- void add_armature_bones(Object *ob_arm, Scene* sce, SceneExporter* se,
- std::list<Object*>& child_objects);
+ void add_armature_bones(Object *ob_arm, Scene *sce, SceneExporter *se,
+ std::list<Object *>& child_objects);
bool is_skinned_mesh(Object *ob);
@@ -76,7 +76,7 @@ private:
const ExportSettings *export_settings;
#if 0
- std::vector<Object*> written_armatures;
+ std::vector<Object *> written_armatures;
bool already_written(Object *ob_arm);
@@ -89,8 +89,8 @@ private:
// Scene, SceneExporter and the list of child_objects
// are required for writing bone parented objects
- void add_bone_node(Bone *bone, Object *ob_arm, Scene* sce, SceneExporter* se,
- std::list<Object*>& child_objects);
+ void add_bone_node(Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se,
+ std::list<Object *>& child_objects);
void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node);
@@ -100,10 +100,10 @@ private:
// ob should be of type OB_MESH
// both args are required
- void export_controller(Object* ob, Object *ob_arm);
+ void export_controller(Object *ob, Object *ob_arm);
void add_joints_element(ListBase *defbase,
- const std::string& joints_source_id, const std::string& inv_bind_mat_source_id);
+ const std::string& joints_source_id, const std::string& inv_bind_mat_source_id);
void add_bind_shape_mat(Object *ob);
@@ -111,15 +111,17 @@ private:
std::string add_inv_bind_mats_source(Object *ob_arm, ListBase *defbase, const std::string& controller_id);
- Bone *get_bone_from_defgroup(Object *ob_arm, bDeformGroup* def);
+ Bone *get_bone_from_defgroup(Object *ob_arm, bDeformGroup *def);
- bool is_bone_defgroup(Object *ob_arm, bDeformGroup* def);
+ bool is_bone_defgroup(Object *ob_arm, bDeformGroup *def);
std::string add_weights_source(Mesh *me, const std::string& controller_id,
- const std::list<float>& weights);
+ const std::list<float>& weights);
void add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id,
- const std::list<int>& vcount, const std::list<int>& joints);
+ const std::list<int>& vcount, const std::list<int>& joints);
+
+ void write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone);
};
#endif
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 6c9d277de54..ca07512f439 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -386,7 +386,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
Object *new_child = NULL;
if (inodes.getCount()) { // \todo loop through instance nodes
const COLLADAFW::UniqueId& id = inodes[0]->getInstanciatedObjectId();
- fprintf(stderr, "Doing %d child nodes\n", node_map.count(id));
+ fprintf(stderr, "Doing %d child nodes\n", (int)node_map.count(id));
new_child = create_instance_node(object_map.find(id)->second, node_map[id], child_node, sce, is_library_node);
}
else {
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index e856eefab99..1b2dfde641b 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -24,25 +24,24 @@
* \ingroup collada
*/
-extern "C" {
-#include "BLI_linklist.h"
-}
-
#ifndef __EXPORTSETTINGS_H__
#define __EXPORTSETTINGS_H__
-struct ExportSettings
-{
- public:
- bool selected;
- bool apply_modifiers;
- bool include_armatures;
- bool include_children;
- bool use_object_instantiation;
- bool sort_by_name;
- bool second_life;
- char *filepath;
- LinkNode *export_set;
+#include "collada.h"
+
+struct ExportSettings {
+public:
+ bool apply_modifiers;
+ BC_export_mesh_type export_mesh_type;
+ bool selected;
+ bool include_children;
+ bool include_armatures;
+ bool deform_bones_only;
+ bool use_object_instantiation;
+ bool sort_by_name;
+ bool second_life;
+ char *filepath;
+ LinkNode *export_set;
};
#endif
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 94b977ca01c..baa20ab07b7 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -78,7 +78,7 @@ void GeometryExporter::operator()(Object *ob)
bool use_instantiation = this->export_settings->use_object_instantiation;
Mesh *me;
if (this->export_settings->apply_modifiers) {
- me = bc_to_mesh_apply_modifiers(mScene, ob);
+ me = bc_to_mesh_apply_modifiers(mScene, ob, this->export_settings->export_mesh_type);
}
else {
me = (Mesh *)ob->data;
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp
index ef22a76d28e..07e11183dd0 100644
--- a/source/blender/collada/MaterialExporter.cpp
+++ b/source/blender/collada/MaterialExporter.cpp
@@ -49,7 +49,7 @@ void MaterialsExporter::exportMaterials(Scene *sce)
bool MaterialsExporter::hasMaterials(Scene *sce)
{
LinkNode *node;
- for(node=this->export_settings->export_set; node; node = node->next) {
+ for (node=this->export_settings->export_set; node; node = node->next) {
Object *ob = (Object *)node->link;
int a;
for (a = 0; a < ob->totcol; a++) {
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index 9a4fd44b9e9..da1ca6c30c8 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -28,9 +28,9 @@
/* COLLADABU_ASSERT, may be able to remove later */
#include "COLLADABUPlatform.h"
-#include "ExportSettings.h"
#include "DocumentExporter.h"
#include "DocumentImporter.h"
+#include "ExportSettings.h"
extern "C"
{
@@ -40,6 +40,7 @@ extern "C"
/* make dummy file */
#include "BLI_fileops.h"
#include "BLI_path_util.h"
+#include "BLI_linklist.h"
int collada_import(bContext *C, const char *filepath)
{
@@ -49,18 +50,20 @@ int collada_import(bContext *C, const char *filepath)
return 0;
}
-int collada_export(
- Scene *sce,
- const char *filepath,
- int selected,
- int apply_modifiers,
+int collada_export(Scene *sce,
+ const char *filepath,
+
+ int apply_modifiers,
+ BC_export_mesh_type export_mesh_type,
- int include_armatures,
- int include_children,
+ int selected,
+ int include_children,
+ int include_armatures,
+ int deform_bones_only,
- int use_object_instantiation,
- int sort_by_name,
- int second_life)
+ int use_object_instantiation,
+ int sort_by_name,
+ int second_life)
{
ExportSettings export_settings;
@@ -73,15 +76,19 @@ int collada_export(
}
/* end! */
+ export_settings.filepath = (char *)filepath;
- export_settings.selected = selected != 0;
export_settings.apply_modifiers = apply_modifiers != 0;
+ export_settings.export_mesh_type = export_mesh_type;
+ export_settings.selected = selected != 0;
+ export_settings.include_children = include_children != 0;
export_settings.include_armatures = include_armatures != 0;
- export_settings.include_children = include_children != 0;
- export_settings.second_life = second_life != 0;
+ export_settings.deform_bones_only = deform_bones_only != 0;
+
export_settings.use_object_instantiation = use_object_instantiation != 0;
export_settings.sort_by_name = sort_by_name != 0;
- export_settings.filepath = (char *)filepath;
+ export_settings.second_life = second_life != 0;
+
int includeFilter = OB_REL_NONE;
if (export_settings.include_armatures) includeFilter |= OB_REL_MOD_ARMATURE;
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index 8daf2b65fe2..63f791ba80e 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -27,28 +27,39 @@
#ifndef __COLLADA_H__
#define __COLLADA_H__
-struct bContext;
-struct Scene;
-
+#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
- /*
- * both return 1 on success, 0 on error
- */
- int collada_import(bContext *C, const char *filepath);
- int collada_export(
- Scene *sce,
- const char *filepath,
- int selected,
- int apply_modifiers,
-
- int include_armatures,
- int include_children,
-
- int use_object_instantiation,
- int sort_by_name,
- int second_life);
+
+#include "BLI_linklist.h"
+#include "RNA_types.h"
+
+typedef enum BC_export_mesh_type {
+ BC_MESH_TYPE_VIEW,
+ BC_MESH_TYPE_RENDER
+} BC_export_mesh_type;
+
+struct bContext;
+struct Scene;
+
+/*
+ * both return 1 on success, 0 on error
+ */
+int collada_import(bContext *C, const char *filepath);
+int collada_export(Scene *sce,
+ const char *filepath,
+ int apply_modifiers,
+ BC_export_mesh_type export_mesh_type,
+
+ int selected,
+ int include_children,
+ int include_armatures,
+ int deform_bones_only,
+
+ int use_object_instantiation,
+ int sort_by_name,
+ int second_life);
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index aa6f0b3c515..cf7c9e49b63 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -34,11 +34,14 @@
#include "collada_utils.h"
+extern "C" {
+
#include "DNA_modifier_types.h"
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_scene_types.h"
+#include "DNA_armature_types.h"
#include "BLI_math.h"
@@ -49,13 +52,13 @@
#include "BKE_mesh.h"
#include "BKE_scene.h"
-extern "C" {
#include "BKE_DerivedMesh.h"
#include "BLI_linklist.h"
-}
+
#include "WM_api.h" // XXX hrm, see if we can do without this
#include "WM_types.h"
+}
float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index)
{
@@ -135,11 +138,22 @@ Object *bc_add_object(Scene *scene, int type, const char *name)
return ob;
}
-Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob)
+Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type)
{
Mesh *tmpmesh;
CustomDataMask mask = CD_MASK_MESH;
- DerivedMesh *dm = mesh_create_derived_view(scene, ob, mask);
+ DerivedMesh *dm;
+ switch (export_mesh_type) {
+ case BC_MESH_TYPE_VIEW: {
+ dm = mesh_create_derived_view(scene, ob, mask);
+ break;
+ }
+ case BC_MESH_TYPE_RENDER: {
+ dm = mesh_create_derived_render(scene, ob, mask);
+ break;
+ }
+ }
+
tmpmesh = BKE_mesh_add("ColladaMesh"); // name is not important here
DM_to_mesh(dm, tmpmesh, ob);
dm->release(dm);
@@ -181,6 +195,7 @@ Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *o
return ancestor;
}
+
bool bc_is_base_node(LinkNode *export_set, Object *ob)
{
Object *root = bc_get_highest_selected_ancestor_or_self(export_set, ob);
@@ -189,30 +204,19 @@ bool bc_is_base_node(LinkNode *export_set, Object *ob)
bool bc_is_in_Export_set(LinkNode *export_set, Object *ob)
{
- LinkNode *node = export_set;
-
- while (node) {
- Object *element = (Object *)node->link;
-
- if (element == ob)
- return true;
-
- node= node->next;
- }
- return false;
+ return (BLI_linklist_index(export_set, ob) != -1);
}
bool bc_has_object_type(LinkNode *export_set, short obtype)
{
- LinkNode *node = export_set;
+ LinkNode *node;
- while (node) {
+ for (node = export_set; node; node = node->next) {
Object *ob = (Object *)node->link;
-
+ /* XXX - why is this checking for ob->data? - we could be looking for empties */
if (ob->type == obtype && ob->data) {
return true;
}
- node= node->next;
}
return false;
}
@@ -232,19 +236,16 @@ void bc_bubble_sort_by_Object_name(LinkNode *export_set)
{
bool sorted = false;
LinkNode *node;
- for(node=export_set; node->next && !sorted; node=node->next) {
+ for (node = export_set; node->next && !sorted; node = node->next) {
sorted = true;
LinkNode *current;
- for (current=export_set; current->next; current = current->next) {
+ for (current = export_set; current->next; current = current->next) {
Object *a = (Object *)current->link;
Object *b = (Object *)current->next->link;
- std::string str_a (a->id.name);
- std::string str_b (b->id.name);
-
- if (str_a.compare(str_b) > 0) {
+ if (strcmp(a->id.name, b->id.name) > 0) {
current->link = b;
current->next->link = a;
sorted = false;
@@ -253,3 +254,23 @@ void bc_bubble_sort_by_Object_name(LinkNode *export_set)
}
}
}
+
+/* Check if a bone is the top most exportable bone in the bone hierarchy.
+ * When deform_bones_only == false, then only bones with NO parent
+ * can be root bones. Otherwise the top most deform bones in the hierarchy
+ * are root bones.
+ */
+bool bc_is_root_bone(Bone *aBone, bool deform_bones_only) {
+ if (deform_bones_only) {
+ Bone *root = NULL;
+ Bone *bone = aBone;
+ while (bone) {
+ if (!(bone->flag & BONE_NO_DEFORM))
+ root = bone;
+ bone = bone->parent;
+ }
+ return (aBone == root);
+ }
+ else
+ return !(aBone->parent);
+}
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index 139a2cb93bd..ab0b7421aa1 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -51,13 +51,13 @@ extern "C" {
#include "ExportSettings.h"
-typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex*> > TexIndexTextureArrayMap;
+typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex *> > TexIndexTextureArrayMap;
extern float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index);
extern int bc_test_parent_loop(Object *par, Object *ob);
-extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space=true);
+extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space = true);
extern Object *bc_add_object(Scene *scene, int type, const char *name);
-extern Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob);
+extern Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type);
extern Object *bc_get_assigned_armature(Object *ob);
extern Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob);
@@ -72,5 +72,6 @@ extern char *bc_CustomData_get_layer_name(const CustomData *data, int type, int
extern char *bc_CustomData_get_active_layer_name(const CustomData *data, int type);
extern void bc_bubble_sort_by_Object_name(LinkNode *export_set);
+extern bool bc_is_root_bone(Bone *aBone, bool deform_bones_only);
#endif
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index fbe391a554d..d0093c58d23 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -288,6 +288,10 @@ set(SRC
nodes/COM_BokehBlurNode.h
nodes/COM_DirectionalBlurNode.cpp
nodes/COM_DirectionalBlurNode.h
+ operations/COM_GaussianAlphaXBlurOperation.cpp
+ operations/COM_GaussianAlphaXBlurOperation.h
+ operations/COM_GaussianAlphaYBlurOperation.cpp
+ operations/COM_GaussianAlphaYBlurOperation.h
operations/COM_GaussianXBlurOperation.cpp
operations/COM_GaussianXBlurOperation.h
operations/COM_GaussianYBlurOperation.cpp
diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h
index 57b73c836df..e11048b23f3 100644
--- a/source/blender/compositor/COM_defines.h
+++ b/source/blender/compositor/COM_defines.h
@@ -67,7 +67,7 @@ typedef enum CompositorPriority {
// chunk size determination
#define COM_PREVIEW_SIZE 140.0f
-//#define COM_OPENCL_ENABLED
+#define COM_OPENCL_ENABLED
//#define COM_DEBUG
// workscheduler threading models
diff --git a/source/blender/compositor/intern/COM_CPUDevice.cpp b/source/blender/compositor/intern/COM_CPUDevice.cpp
index f151afd75be..95462b3c384 100644
--- a/source/blender/compositor/intern/COM_CPUDevice.cpp
+++ b/source/blender/compositor/intern/COM_CPUDevice.cpp
@@ -25,11 +25,11 @@
void CPUDevice::execute(WorkPackage *work)
{
const unsigned int chunkNumber = work->getChunkNumber();
- ExecutionGroup * executionGroup = work->getExecutionGroup();
+ ExecutionGroup *executionGroup = work->getExecutionGroup();
rcti rect;
executionGroup->determineChunkRect(&rect, chunkNumber);
- MemoryBuffer ** inputBuffers = executionGroup->getInputBuffersCPU();
+ MemoryBuffer **inputBuffers = executionGroup->getInputBuffersCPU();
executionGroup->getOutputNodeOperation()->executeRegion(&rect, chunkNumber, inputBuffers);
diff --git a/source/blender/compositor/intern/COM_ChannelInfo.cpp b/source/blender/compositor/intern/COM_ChannelInfo.cpp
index 7dafee5f955..f2fa62006d5 100644
--- a/source/blender/compositor/intern/COM_ChannelInfo.cpp
+++ b/source/blender/compositor/intern/COM_ChannelInfo.cpp
@@ -25,8 +25,8 @@
#include <stdio.h>
/**
- * @brief create new ChannelInfo instance and sets the defaults.
- */
+ * @brief create new ChannelInfo instance and sets the defaults.
+ */
ChannelInfo::ChannelInfo()
{
this->number = 0;
diff --git a/source/blender/compositor/intern/COM_ChunkOrder.cpp b/source/blender/compositor/intern/COM_ChunkOrder.cpp
index 387e4a6ba70..02c28a1997a 100644
--- a/source/blender/compositor/intern/COM_ChunkOrder.cpp
+++ b/source/blender/compositor/intern/COM_ChunkOrder.cpp
@@ -35,7 +35,7 @@ void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int nu
{
unsigned int index;
double distance = MAXFLOAT;
- for (index = 0 ; index < numberOfHotspots ; index ++) {
+ for (index = 0; index < numberOfHotspots; index++) {
ChunkOrderHotspot *hotspot = hotspots[index];
double ndistance = hotspot->determineDistance(this->x, this->y);
if (ndistance < distance) {
diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
index 0ab08ec5810..96568092b72 100644
--- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
+++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
@@ -32,9 +32,9 @@ ChunkOrderHotspot::ChunkOrderHotspot(int x, int y, float addition)
double ChunkOrderHotspot::determineDistance(int x, int y)
{
- int dx = x-this->x;
- int dy = y-this->y;
- double result = sqrt((double)(dx*dx+dy*dy));
+ int dx = x - this->x;
+ int dy = y - this->y;
+ double result = sqrt((double)(dx * dx + dy * dy));
result += (double)this->addition;
return result;
}
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 9731555039c..0a8862e4017 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -20,104 +20,106 @@
* Monique Dewanchand
*/
-#include "COM_Converter.h"
+#include <string.h>
+
#include "BKE_node.h"
-#include "COM_CompositorNode.h"
-#include "COM_RenderLayersNode.h"
+
+#include "COM_AlphaOverNode.h"
+#include "COM_BilateralBlurNode.h"
+#include "COM_BlurNode.h"
+#include "COM_BokehBlurNode.h"
+#include "COM_BokehImageNode.h"
+#include "COM_BoxMaskNode.h"
+#include "COM_BrightnessNode.h"
+#include "COM_ChannelMatteNode.h"
+#include "COM_ChromaMatteNode.h"
+#include "COM_ColorBalanceNode.h"
+#include "COM_ColorCorrectionNode.h"
+#include "COM_ColorCurveNode.h"
+#include "COM_ColorMatteNode.h"
+#include "COM_ColorNode.h"
+#include "COM_ColorRampNode.h"
+#include "COM_ColorSpillNode.h"
#include "COM_ColorToBWNode.h"
-#include "string.h"
-#include "COM_SocketConnection.h"
+#include "COM_CombineHSVANode.h"
+#include "COM_CombineRGBANode.h"
+#include "COM_CombineYCCANode.h"
+#include "COM_CombineYUVANode.h"
+#include "COM_CompositorNode.h"
+#include "COM_ConvertAlphaNode.h"
+#include "COM_ConvertColorToVectorOperation.h"
#include "COM_ConvertColourToValueProg.h"
#include "COM_ConvertValueToColourProg.h"
-#include "COM_ConvertColorToVectorOperation.h"
#include "COM_ConvertValueToVectorOperation.h"
#include "COM_ConvertVectorToColorOperation.h"
#include "COM_ConvertVectorToValueOperation.h"
+#include "COM_Converter.h"
+#include "COM_CropNode.h"
+#include "COM_DefocusNode.h"
+#include "COM_DifferenceMatteNode.h"
+#include "COM_DilateErodeNode.h"
+#include "COM_DirectionalBlurNode.h"
+#include "COM_DisplaceNode.h"
+#include "COM_DistanceMatteNode.h"
+#include "COM_DoubleEdgeMaskNode.h"
+#include "COM_EllipseMaskNode.h"
#include "COM_ExecutionSystem.h"
+#include "COM_ExecutionSystemHelper.h"
+#include "COM_FilterNode.h"
+#include "COM_FlipNode.h"
+#include "COM_GammaNode.h"
+#include "COM_GlareNode.h"
+#include "COM_GroupNode.h"
+#include "COM_HueSaturationValueCorrectNode.h"
+#include "COM_HueSaturationValueNode.h"
+#include "COM_IDMaskNode.h"
+#include "COM_ImageNode.h"
+#include "COM_InvertNode.h"
+#include "COM_KeyingNode.h"
+#include "COM_KeyingScreenNode.h"
+#include "COM_LensDistortionNode.h"
+#include "COM_LuminanceMatteNode.h"
+#include "COM_MapUVNode.h"
+#include "COM_MapValueNode.h"
+#include "COM_MaskNode.h"
+#include "COM_MathNode.h"
#include "COM_MixNode.h"
+#include "COM_MovieClipNode.h"
+#include "COM_MovieDistortionNode.h"
#include "COM_MuteNode.h"
-#include "COM_TranslateNode.h"
+#include "COM_NormalNode.h"
+#include "COM_NormalizeNode.h"
+#include "COM_OutputFileNode.h"
+#include "COM_RenderLayersNode.h"
#include "COM_RotateNode.h"
#include "COM_ScaleNode.h"
-#include "COM_FlipNode.h"
-#include "COM_IDMaskNode.h"
-#include "COM_FilterNode.h"
-#include "COM_BrightnessNode.h"
-#include "COM_SeparateRGBANode.h"
-#include "COM_CombineRGBANode.h"
+#include "COM_ScaleOperation.h"
#include "COM_SeparateHSVANode.h"
-#include "COM_CombineHSVANode.h"
-#include "COM_SeparateYUVANode.h"
-#include "COM_CombineYUVANode.h"
+#include "COM_SeparateRGBANode.h"
#include "COM_SeparateYCCANode.h"
-#include "COM_CombineYCCANode.h"
-#include "COM_AlphaOverNode.h"
-#include "COM_ColorBalanceNode.h"
-#include "COM_ViewerNode.h"
-#include "COM_SplitViewerNode.h"
-#include "COM_InvertNode.h"
-#include "COM_GroupNode.h"
-#include "COM_NormalNode.h"
-#include "COM_NormalizeNode.h"
-#include "COM_ImageNode.h"
-#include "COM_BokehImageNode.h"
-#include "COM_ColorCurveNode.h"
-#include "COM_VectorCurveNode.h"
+#include "COM_SeparateYUVANode.h"
#include "COM_SetAlphaNode.h"
-#include "COM_ConvertAlphaNode.h"
-#include "COM_MapUVNode.h"
-#include "COM_DisplaceNode.h"
-#include "COM_MathNode.h"
-#include "COM_HueSaturationValueNode.h"
-#include "COM_HueSaturationValueCorrectNode.h"
-#include "COM_ColorCorrectionNode.h"
-#include "COM_BoxMaskNode.h"
-#include "COM_EllipseMaskNode.h"
-#include "COM_GammaNode.h"
-#include "COM_ColorRampNode.h"
-#include "COM_DifferenceMatteNode.h"
-#include "COM_LuminanceMatteNode.h"
-#include "COM_DistanceMatteNode.h"
-#include "COM_ChromaMatteNode.h"
-#include "COM_ColorMatteNode.h"
-#include "COM_ChannelMatteNode.h"
-#include "COM_BlurNode.h"
-#include "COM_BokehBlurNode.h"
-#include "COM_DilateErodeNode.h"
-#include "COM_TranslateOperation.h"
-#include "COM_LensDistortionNode.h"
+#include "COM_SetValueOperation.h"
+#include "COM_SocketConnection.h"
+#include "COM_SplitViewerNode.h"
+#include "COM_Stabilize2dNode.h"
+#include "COM_SwitchNode.h"
#include "COM_TextureNode.h"
-#include "COM_ColorNode.h"
-#include "COM_ValueNode.h"
#include "COM_TimeNode.h"
-#include "COM_DirectionalBlurNode.h"
-#include "COM_ZCombineNode.h"
-#include "COM_SetValueOperation.h"
-#include "COM_ScaleOperation.h"
-#include "COM_ExecutionSystemHelper.h"
#include "COM_TonemapNode.h"
-#include "COM_SwitchNode.h"
-#include "COM_GlareNode.h"
-#include "COM_MovieClipNode.h"
-#include "COM_ColorSpillNode.h"
-#include "COM_OutputFileNode.h"
-#include "COM_MapValueNode.h"
#include "COM_TransformNode.h"
-#include "COM_Stabilize2dNode.h"
-#include "COM_BilateralBlurNode.h"
+#include "COM_TranslateNode.h"
+#include "COM_TranslateOperation.h"
+#include "COM_ValueNode.h"
#include "COM_VectorBlurNode.h"
-#include "COM_MovieDistortionNode.h"
+#include "COM_VectorCurveNode.h"
#include "COM_ViewLevelsNode.h"
-#include "COM_DefocusNode.h"
-#include "COM_DoubleEdgeMaskNode.h"
-#include "COM_CropNode.h"
-#include "COM_MaskNode.h"
-#include "COM_KeyingScreenNode.h"
-#include "COM_KeyingNode.h"
+#include "COM_ViewerNode.h"
+#include "COM_ZCombineNode.h"
Node *Converter::convert(bNode *bNode)
{
- Node * node;
+ Node *node;
if (bNode->flag & NODE_MUTED) {
node = new MuteNode(bNode);
@@ -125,244 +127,244 @@ Node *Converter::convert(bNode *bNode)
}
switch (bNode->type) {
- case CMP_NODE_COMPOSITE:
- node = new CompositorNode(bNode);
- break;
- case CMP_NODE_R_LAYERS:
- node = new RenderLayersNode(bNode);
- break;
- case CMP_NODE_TEXTURE:
- node = new TextureNode(bNode);
- break;
- case CMP_NODE_RGBTOBW:
- node = new ColourToBWNode(bNode);
- break;
- case CMP_NODE_MIX_RGB:
- node = new MixNode(bNode);
- break;
- case CMP_NODE_TRANSLATE:
- node = new TranslateNode(bNode);
- break;
- case CMP_NODE_SCALE:
- node = new ScaleNode(bNode);
- break;
- case CMP_NODE_ROTATE:
- node = new RotateNode(bNode);
- break;
- case CMP_NODE_FLIP:
- node = new FlipNode(bNode);
- break;
- case CMP_NODE_FILTER:
- node = new FilterNode(bNode);
- break;
- case CMP_NODE_ID_MASK:
- node = new IDMaskNode(bNode);
- break;
- case CMP_NODE_BRIGHTCONTRAST:
- node = new BrightnessNode(bNode);
- break;
- case CMP_NODE_SEPRGBA:
- node = new SeparateRGBANode(bNode);
- break;
- case CMP_NODE_COMBRGBA:
- node = new CombineRGBANode(bNode);
- break;
- case CMP_NODE_SEPHSVA:
- node = new SeparateHSVANode(bNode);
- break;
- case CMP_NODE_COMBHSVA:
- node = new CombineHSVANode(bNode);
- break;
- case CMP_NODE_SEPYUVA:
- node = new SeparateYUVANode(bNode);
- break;
- case CMP_NODE_COMBYUVA:
- node = new CombineYUVANode(bNode);
- break;
- case CMP_NODE_SEPYCCA:
- node = new SeparateYCCANode(bNode);
- break;
- case CMP_NODE_COMBYCCA:
- node = new CombineYCCANode(bNode);
- break;
- case CMP_NODE_ALPHAOVER:
- node = new AlphaOverNode(bNode);
- break;
- case CMP_NODE_COLORBALANCE:
- node = new ColorBalanceNode(bNode);
- break;
- case CMP_NODE_VIEWER:
- node = new ViewerNode(bNode);
- break;
- case CMP_NODE_SPLITVIEWER:
- node = new SplitViewerNode(bNode);
- break;
- case CMP_NODE_INVERT:
- node = new InvertNode(bNode);
- break;
- case NODE_GROUP:
- node = new GroupNode(bNode);
- break;
- case CMP_NODE_NORMAL:
- node = new NormalNode(bNode);
- break;
- case CMP_NODE_NORMALIZE:
- node = new NormalizeNode(bNode);
- break;
- case CMP_NODE_IMAGE:
- node = new ImageNode(bNode);
- break;
- case CMP_NODE_SETALPHA:
- node = new SetAlphaNode(bNode);
- break;
- case CMP_NODE_PREMULKEY:
- node = new ConvertAlphaNode(bNode);
- break;
- case CMP_NODE_MATH:
- node = new MathNode(bNode);
- break;
- case CMP_NODE_HUE_SAT:
- node = new HueSaturationValueNode(bNode);
- break;
- case CMP_NODE_COLORCORRECTION:
- node = new ColorCorrectionNode(bNode);
- break;
- case CMP_NODE_MASK_BOX:
- node = new BoxMaskNode(bNode);
- break;
- case CMP_NODE_MASK_ELLIPSE:
- node = new EllipseMaskNode(bNode);
- break;
- case CMP_NODE_GAMMA:
- node = new GammaNode(bNode);
- break;
- case CMP_NODE_CURVE_RGB:
- node = new ColorCurveNode(bNode);
- break;
- case CMP_NODE_CURVE_VEC:
- node = new VectorCurveNode(bNode);
- break;
- case CMP_NODE_HUECORRECT:
- node = new HueSaturationValueCorrectNode(bNode);
- break;
- case CMP_NODE_MAP_UV:
- node = new MapUVNode(bNode);
- break;
- case CMP_NODE_DISPLACE:
- node = new DisplaceNode(bNode);
- break;
- case CMP_NODE_VALTORGB:
- node = new ColorRampNode(bNode);
- break;
- case CMP_NODE_DIFF_MATTE:
- node = new DifferenceMatteNode(bNode);
- break;
- case CMP_NODE_LUMA_MATTE:
- node = new LuminanceMatteNode(bNode);
- break;
- case CMP_NODE_DIST_MATTE:
- node = new DistanceMatteNode(bNode);
- break;
- case CMP_NODE_CHROMA_MATTE:
- node = new ChromaMatteNode(bNode);
- break;
- case CMP_NODE_COLOR_MATTE:
- node = new ColorMatteNode(bNode);
- break;
- case CMP_NODE_CHANNEL_MATTE:
- node = new ChannelMatteNode(bNode);
- break;
- case CMP_NODE_BLUR:
- node = new BlurNode(bNode);
- break;
- case CMP_NODE_BOKEHIMAGE:
- node = new BokehImageNode(bNode);
- break;
- case CMP_NODE_BOKEHBLUR:
- node = new BokehBlurNode(bNode);
- break;
- case CMP_NODE_DILATEERODE:
- node = new DilateErodeNode(bNode);
- break;
- case CMP_NODE_LENSDIST:
- node = new LensDistortionNode(bNode);
- break;
- case CMP_NODE_RGB:
- node = new ColorNode(bNode);
- break;
- case CMP_NODE_VALUE:
- node = new ValueNode(bNode);
- break;
- case CMP_NODE_TIME:
- node = new TimeNode(bNode);
- break;
- case CMP_NODE_DBLUR:
- node = new DirectionalBlurNode(bNode);
- break;
- case CMP_NODE_ZCOMBINE:
- node = new ZCombineNode(bNode);
- break;
- case CMP_NODE_TONEMAP:
- node = new TonemapNode(bNode);
- break;
- case CMP_NODE_SWITCH:
- node = new SwitchNode(bNode);
- break;
- case CMP_NODE_GLARE:
- node = new GlareNode(bNode);
- break;
- case CMP_NODE_MOVIECLIP:
- node = new MovieClipNode(bNode);
- break;
- case CMP_NODE_COLOR_SPILL:
- node = new ColorSpillNode(bNode);
- break;
-case CMP_NODE_OUTPUT_FILE:
- node = new OutputFileNode(bNode);
- break;
- case CMP_NODE_MAP_VALUE:
- node = new MapValueNode(bNode);
- break;
- case CMP_NODE_TRANSFORM:
- node = new TransformNode(bNode);
- break;
- case CMP_NODE_STABILIZE2D:
- node = new Stabilize2dNode(bNode);
- break;
- case CMP_NODE_BILATERALBLUR:
- node = new BilateralBlurNode(bNode);
- break;
- case CMP_NODE_VECBLUR:
- node = new VectorBlurNode(bNode);
- break;
- case CMP_NODE_MOVIEDISTORTION:
- node = new MovieDistortionNode(bNode);
- break;
- case CMP_NODE_VIEW_LEVELS:
- node = new ViewLevelsNode(bNode);
- break;
- case CMP_NODE_DEFOCUS:
- node = new DefocusNode(bNode);
- break;
- case CMP_NODE_DOUBLEEDGEMASK:
- node = new DoubleEdgeMaskNode(bNode);
- break;
- case CMP_NODE_CROP:
- node = new CropNode(bNode);
- break;
- case CMP_NODE_MASK:
- node = new MaskNode(bNode);
- break;
- case CMP_NODE_KEYINGSCREEN:
- node = new KeyingScreenNode(bNode);
- break;
- case CMP_NODE_KEYING:
- node = new KeyingNode(bNode);
- break;
- /* not inplemented yet */
- default:
- node = new MuteNode(bNode);
- break;
+ case CMP_NODE_COMPOSITE:
+ node = new CompositorNode(bNode);
+ break;
+ case CMP_NODE_R_LAYERS:
+ node = new RenderLayersNode(bNode);
+ break;
+ case CMP_NODE_TEXTURE:
+ node = new TextureNode(bNode);
+ break;
+ case CMP_NODE_RGBTOBW:
+ node = new ColourToBWNode(bNode);
+ break;
+ case CMP_NODE_MIX_RGB:
+ node = new MixNode(bNode);
+ break;
+ case CMP_NODE_TRANSLATE:
+ node = new TranslateNode(bNode);
+ break;
+ case CMP_NODE_SCALE:
+ node = new ScaleNode(bNode);
+ break;
+ case CMP_NODE_ROTATE:
+ node = new RotateNode(bNode);
+ break;
+ case CMP_NODE_FLIP:
+ node = new FlipNode(bNode);
+ break;
+ case CMP_NODE_FILTER:
+ node = new FilterNode(bNode);
+ break;
+ case CMP_NODE_ID_MASK:
+ node = new IDMaskNode(bNode);
+ break;
+ case CMP_NODE_BRIGHTCONTRAST:
+ node = new BrightnessNode(bNode);
+ break;
+ case CMP_NODE_SEPRGBA:
+ node = new SeparateRGBANode(bNode);
+ break;
+ case CMP_NODE_COMBRGBA:
+ node = new CombineRGBANode(bNode);
+ break;
+ case CMP_NODE_SEPHSVA:
+ node = new SeparateHSVANode(bNode);
+ break;
+ case CMP_NODE_COMBHSVA:
+ node = new CombineHSVANode(bNode);
+ break;
+ case CMP_NODE_SEPYUVA:
+ node = new SeparateYUVANode(bNode);
+ break;
+ case CMP_NODE_COMBYUVA:
+ node = new CombineYUVANode(bNode);
+ break;
+ case CMP_NODE_SEPYCCA:
+ node = new SeparateYCCANode(bNode);
+ break;
+ case CMP_NODE_COMBYCCA:
+ node = new CombineYCCANode(bNode);
+ break;
+ case CMP_NODE_ALPHAOVER:
+ node = new AlphaOverNode(bNode);
+ break;
+ case CMP_NODE_COLORBALANCE:
+ node = new ColorBalanceNode(bNode);
+ break;
+ case CMP_NODE_VIEWER:
+ node = new ViewerNode(bNode);
+ break;
+ case CMP_NODE_SPLITVIEWER:
+ node = new SplitViewerNode(bNode);
+ break;
+ case CMP_NODE_INVERT:
+ node = new InvertNode(bNode);
+ break;
+ case NODE_GROUP:
+ node = new GroupNode(bNode);
+ break;
+ case CMP_NODE_NORMAL:
+ node = new NormalNode(bNode);
+ break;
+ case CMP_NODE_NORMALIZE:
+ node = new NormalizeNode(bNode);
+ break;
+ case CMP_NODE_IMAGE:
+ node = new ImageNode(bNode);
+ break;
+ case CMP_NODE_SETALPHA:
+ node = new SetAlphaNode(bNode);
+ break;
+ case CMP_NODE_PREMULKEY:
+ node = new ConvertAlphaNode(bNode);
+ break;
+ case CMP_NODE_MATH:
+ node = new MathNode(bNode);
+ break;
+ case CMP_NODE_HUE_SAT:
+ node = new HueSaturationValueNode(bNode);
+ break;
+ case CMP_NODE_COLORCORRECTION:
+ node = new ColorCorrectionNode(bNode);
+ break;
+ case CMP_NODE_MASK_BOX:
+ node = new BoxMaskNode(bNode);
+ break;
+ case CMP_NODE_MASK_ELLIPSE:
+ node = new EllipseMaskNode(bNode);
+ break;
+ case CMP_NODE_GAMMA:
+ node = new GammaNode(bNode);
+ break;
+ case CMP_NODE_CURVE_RGB:
+ node = new ColorCurveNode(bNode);
+ break;
+ case CMP_NODE_CURVE_VEC:
+ node = new VectorCurveNode(bNode);
+ break;
+ case CMP_NODE_HUECORRECT:
+ node = new HueSaturationValueCorrectNode(bNode);
+ break;
+ case CMP_NODE_MAP_UV:
+ node = new MapUVNode(bNode);
+ break;
+ case CMP_NODE_DISPLACE:
+ node = new DisplaceNode(bNode);
+ break;
+ case CMP_NODE_VALTORGB:
+ node = new ColorRampNode(bNode);
+ break;
+ case CMP_NODE_DIFF_MATTE:
+ node = new DifferenceMatteNode(bNode);
+ break;
+ case CMP_NODE_LUMA_MATTE:
+ node = new LuminanceMatteNode(bNode);
+ break;
+ case CMP_NODE_DIST_MATTE:
+ node = new DistanceMatteNode(bNode);
+ break;
+ case CMP_NODE_CHROMA_MATTE:
+ node = new ChromaMatteNode(bNode);
+ break;
+ case CMP_NODE_COLOR_MATTE:
+ node = new ColorMatteNode(bNode);
+ break;
+ case CMP_NODE_CHANNEL_MATTE:
+ node = new ChannelMatteNode(bNode);
+ break;
+ case CMP_NODE_BLUR:
+ node = new BlurNode(bNode);
+ break;
+ case CMP_NODE_BOKEHIMAGE:
+ node = new BokehImageNode(bNode);
+ break;
+ case CMP_NODE_BOKEHBLUR:
+ node = new BokehBlurNode(bNode);
+ break;
+ case CMP_NODE_DILATEERODE:
+ node = new DilateErodeNode(bNode);
+ break;
+ case CMP_NODE_LENSDIST:
+ node = new LensDistortionNode(bNode);
+ break;
+ case CMP_NODE_RGB:
+ node = new ColorNode(bNode);
+ break;
+ case CMP_NODE_VALUE:
+ node = new ValueNode(bNode);
+ break;
+ case CMP_NODE_TIME:
+ node = new TimeNode(bNode);
+ break;
+ case CMP_NODE_DBLUR:
+ node = new DirectionalBlurNode(bNode);
+ break;
+ case CMP_NODE_ZCOMBINE:
+ node = new ZCombineNode(bNode);
+ break;
+ case CMP_NODE_TONEMAP:
+ node = new TonemapNode(bNode);
+ break;
+ case CMP_NODE_SWITCH:
+ node = new SwitchNode(bNode);
+ break;
+ case CMP_NODE_GLARE:
+ node = new GlareNode(bNode);
+ break;
+ case CMP_NODE_MOVIECLIP:
+ node = new MovieClipNode(bNode);
+ break;
+ case CMP_NODE_COLOR_SPILL:
+ node = new ColorSpillNode(bNode);
+ break;
+ case CMP_NODE_OUTPUT_FILE:
+ node = new OutputFileNode(bNode);
+ break;
+ case CMP_NODE_MAP_VALUE:
+ node = new MapValueNode(bNode);
+ break;
+ case CMP_NODE_TRANSFORM:
+ node = new TransformNode(bNode);
+ break;
+ case CMP_NODE_STABILIZE2D:
+ node = new Stabilize2dNode(bNode);
+ break;
+ case CMP_NODE_BILATERALBLUR:
+ node = new BilateralBlurNode(bNode);
+ break;
+ case CMP_NODE_VECBLUR:
+ node = new VectorBlurNode(bNode);
+ break;
+ case CMP_NODE_MOVIEDISTORTION:
+ node = new MovieDistortionNode(bNode);
+ break;
+ case CMP_NODE_VIEW_LEVELS:
+ node = new ViewLevelsNode(bNode);
+ break;
+ case CMP_NODE_DEFOCUS:
+ node = new DefocusNode(bNode);
+ break;
+ case CMP_NODE_DOUBLEEDGEMASK:
+ node = new DoubleEdgeMaskNode(bNode);
+ break;
+ case CMP_NODE_CROP:
+ node = new CropNode(bNode);
+ break;
+ case CMP_NODE_MASK:
+ node = new MaskNode(bNode);
+ break;
+ case CMP_NODE_KEYINGSCREEN:
+ node = new KeyingScreenNode(bNode);
+ break;
+ case CMP_NODE_KEYING:
+ node = new KeyingNode(bNode);
+ break;
+ /* not inplemented yet */
+ default:
+ node = new MuteNode(bNode);
+ break;
}
return node;
}
@@ -372,7 +374,7 @@ void Converter::convertDataType(SocketConnection *connection, ExecutionSystem *s
InputSocket *inputSocket = connection->getToSocket();
DataType fromDatatype = outputSocket->getDataType();
DataType toDatatype = inputSocket->getDataType();
- NodeOperation * converter = NULL;
+ NodeOperation *converter = NULL;
if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_COLOR) {
converter = new ConvertValueToColourProg();
}
@@ -402,68 +404,68 @@ void Converter::convertResolution(SocketConnection *connection, ExecutionSystem
{
InputSocketResizeMode mode = connection->getToSocket()->getResizeMode();
- NodeOperation * toOperation = (NodeOperation*)connection->getToNode();
+ NodeOperation *toOperation = (NodeOperation *)connection->getToNode();
const float toWidth = toOperation->getWidth();
const float toHeight = toOperation->getHeight();
- NodeOperation * fromOperation = (NodeOperation*)connection->getFromNode();
+ NodeOperation *fromOperation = (NodeOperation *)connection->getFromNode();
const float fromWidth = fromOperation->getWidth();
const float fromHeight = fromOperation->getHeight();
bool doCenter = false;
bool doScale = false;
- float addX= (toWidth-fromWidth)/2.0f;
- float addY = (toHeight-fromHeight)/2.0f;
- float scaleX=0;
- float scaleY=0;
+ float addX = (toWidth - fromWidth) / 2.0f;
+ float addY = (toHeight - fromHeight) / 2.0f;
+ float scaleX = 0;
+ float scaleY = 0;
switch (mode) {
- case COM_SC_NO_RESIZE:
- break;
- case COM_SC_CENTER:
- doCenter = true;
- break;
- case COM_SC_FIT_WIDTH:
- doCenter = true;
- doScale = true;
- scaleX = scaleY = toWidth/fromWidth;
- break;
- case COM_SC_FIT_HEIGHT:
- doCenter = true;
- doScale = true;
- scaleX = scaleY = toHeight/fromHeight;
- break;
- case COM_SC_FIT:
- doCenter = true;
- doScale = true;
- scaleX = toWidth/fromWidth;
- scaleY = toHeight/fromHeight;
- if (scaleX < scaleY) {
- scaleX = scaleY;
- }
- else {
- scaleY = scaleX;
- }
- break;
- case COM_SC_STRETCH:
- doCenter = true;
- doScale = true;
- scaleX = toWidth/fromWidth;
- scaleY = toHeight/fromHeight;
- break;
+ case COM_SC_NO_RESIZE:
+ break;
+ case COM_SC_CENTER:
+ doCenter = true;
+ break;
+ case COM_SC_FIT_WIDTH:
+ doCenter = true;
+ doScale = true;
+ scaleX = scaleY = toWidth / fromWidth;
+ break;
+ case COM_SC_FIT_HEIGHT:
+ doCenter = true;
+ doScale = true;
+ scaleX = scaleY = toHeight / fromHeight;
+ break;
+ case COM_SC_FIT:
+ doCenter = true;
+ doScale = true;
+ scaleX = toWidth / fromWidth;
+ scaleY = toHeight / fromHeight;
+ if (scaleX < scaleY) {
+ scaleX = scaleY;
+ }
+ else {
+ scaleY = scaleX;
+ }
+ break;
+ case COM_SC_STRETCH:
+ doCenter = true;
+ doScale = true;
+ scaleX = toWidth / fromWidth;
+ scaleY = toHeight / fromHeight;
+ break;
}
if (doCenter) {
NodeOperation *first = NULL;
SocketConnection *c;
- ScaleOperation * scaleOperation = NULL;
+ ScaleOperation *scaleOperation = NULL;
if (doScale) {
scaleOperation = new ScaleOperation();
first = scaleOperation;
- SetValueOperation * sxop = new SetValueOperation();
+ SetValueOperation *sxop = new SetValueOperation();
sxop->setValue(scaleX);
c = ExecutionSystemHelper::addLink(system->getConnections(), sxop->getOutputSocket(), scaleOperation->getInputSocket(1));
c->setIgnoreResizeCheck(true);
- SetValueOperation * syop = new SetValueOperation();
+ SetValueOperation *syop = new SetValueOperation();
syop->setValue(scaleY);
c = ExecutionSystemHelper::addLink(system->getConnections(), syop->getOutputSocket(), scaleOperation->getInputSocket(2));
c->setIgnoreResizeCheck(true);
@@ -479,13 +481,13 @@ void Converter::convertResolution(SocketConnection *connection, ExecutionSystem
c->setIgnoreResizeCheck(true);
}
- TranslateOperation * translateOperation = new TranslateOperation();
+ TranslateOperation *translateOperation = new TranslateOperation();
if (!first) first = translateOperation;
- SetValueOperation * xop = new SetValueOperation();
+ SetValueOperation *xop = new SetValueOperation();
xop->setValue(addX);
c = ExecutionSystemHelper::addLink(system->getConnections(), xop->getOutputSocket(), translateOperation->getInputSocket(1));
c->setIgnoreResizeCheck(true);
- SetValueOperation * yop = new SetValueOperation();
+ SetValueOperation *yop = new SetValueOperation();
yop->setValue(addY);
c = ExecutionSystemHelper::addLink(system->getConnections(), yop->getOutputSocket(), translateOperation->getInputSocket(2));
c->setIgnoreResizeCheck(true);
@@ -503,7 +505,7 @@ void Converter::convertResolution(SocketConnection *connection, ExecutionSystem
c->setIgnoreResizeCheck(true);
}
- InputSocket * inputSocket = connection->getToSocket();
+ InputSocket *inputSocket = connection->getToSocket();
inputSocket->relinkConnections(first->getInputSocket(0));
c = ExecutionSystemHelper::addLink(system->getConnections(), translateOperation->getOutputSocket(), inputSocket);
c->setIgnoreResizeCheck(true);
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index aaca97d8479..4dfb9c7d26c 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -20,24 +20,25 @@
* Monique Dewanchand
*/
+#include <algorithm>
+#include <math.h>
+#include <sstream>
+#include <stdlib.h>
+
+#include "BLI_math.h"
+#include "PIL_time.h"
+
#include "COM_ExecutionGroup.h"
#include "COM_InputSocket.h"
#include "COM_SocketConnection.h"
#include "COM_defines.h"
-#include "math.h"
#include "COM_ExecutionSystem.h"
-#include <sstream>
#include "COM_ReadBufferOperation.h"
#include "COM_WriteBufferOperation.h"
#include "COM_ReadBufferOperation.h"
#include "COM_WorkScheduler.h"
#include "COM_ViewerOperation.h"
-#include <stdlib.h>
-#include "BLI_math.h"
-#include "PIL_time.h"
#include "COM_ChunkOrder.h"
-#include <algorithm>
-#include "BLI_math.h"
#include "COM_ExecutionSystemHelper.h"
ExecutionGroup::ExecutionGroup()
@@ -65,7 +66,7 @@ CompositorPriority ExecutionGroup::getRenderPriotrity()
bool ExecutionGroup::containsOperation(NodeOperation *operation)
{
- for (vector<NodeOperation*>::const_iterator iterator = this->operations.begin() ; iterator != this->operations.end() ; ++iterator) {
+ for (vector<NodeOperation *>::const_iterator iterator = this->operations.begin(); iterator != this->operations.end(); ++iterator) {
NodeOperation *inListOperation = *iterator;
if (inListOperation == operation) {
return true;
@@ -81,10 +82,10 @@ const bool ExecutionGroup::isComplex() const
bool ExecutionGroup::canContainOperation(NodeOperation *operation)
{
- if (!this->initialized) {return true;}
- if (operation->isReadBufferOperation()) {return true;}
- if (operation->isWriteBufferOperation()) {return false;}
- if (operation->isSetOperation()) {return true;}
+ if (!this->initialized) { return true; }
+ if (operation->isReadBufferOperation()) { return true; }
+ if (operation->isWriteBufferOperation()) { return false; }
+ if (operation->isSetOperation()) { return true; }
if (!this->isComplex()) {
return (!operation->isComplex());
@@ -106,16 +107,16 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
}
this->operations.push_back(operation);
if (operation->isReadBufferOperation()) {
- ReadBufferOperation *readOperation = (ReadBufferOperation*)operation;
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
WriteBufferOperation *writeOperation = readOperation->getMemoryProxy()->getWriteBufferOperation();
this->addOperation(system, writeOperation);
}
else {
unsigned int index;
- for (index = 0 ; index < operation->getNumberOfInputSockets(); index ++) {
- InputSocket * inputSocket = operation->getInputSocket(index);
+ for (index = 0; index < operation->getNumberOfInputSockets(); index++) {
+ InputSocket *inputSocket = operation->getInputSocket(index);
if (inputSocket->isConnected()) {
- NodeOperation *node = (NodeOperation*)inputSocket->getConnection()->getFromNode();
+ NodeOperation *node = (NodeOperation *)inputSocket->getConnection()->getFromNode();
this->addOperation(system, node);
}
}
@@ -123,7 +124,7 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
}
else {
if (operation->isWriteBufferOperation()) {
- WriteBufferOperation * writeoperation = (WriteBufferOperation*)operation;
+ WriteBufferOperation *writeoperation = (WriteBufferOperation *)operation;
if (writeoperation->getMemoryProxy()->getExecutor() == NULL) {
ExecutionGroup *newGroup = new ExecutionGroup();
writeoperation->getMemoryProxy()->setExecutor(newGroup);
@@ -150,7 +151,7 @@ void ExecutionGroup::initExecution()
this->chunkExecutionStates = NULL;
if (this->numberOfChunks != 0) {
this->chunkExecutionStates = new ChunkExecutionState[numberOfChunks];
- for (index = 0 ; index < numberOfChunks ; index ++) {
+ for (index = 0; index < numberOfChunks; index++) {
this->chunkExecutionStates[index] = COM_ES_NOT_SCHEDULED;
}
}
@@ -158,10 +159,10 @@ void ExecutionGroup::initExecution()
unsigned int maxNumber = 0;
- for (index = 0 ; index < this->operations.size(); index ++) {
+ for (index = 0; index < this->operations.size(); index++) {
NodeOperation *operation = this->operations[index];
if (operation->isReadBufferOperation()) {
- ReadBufferOperation *readOperation = (ReadBufferOperation*)operation;
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
this->cachedReadOperations.push_back(readOperation);
maxNumber = max(maxNumber, readOperation->getOffset());
}
@@ -207,15 +208,15 @@ void ExecutionGroup::determineNumberOfChunks()
}
/**
- * this method is called for the top execution groups. containing the compositor node or the preview node or the viewer node)
- */
+ * this method is called for the top execution groups. containing the compositor node or the preview node or the viewer node)
+ */
void ExecutionGroup::execute(ExecutionSystem *graph)
{
CompositorContext& context = graph->getContext();
const bNodeTree *bTree = context.getbNodeTree();
- if (this->width == 0 || this->height == 0) {return;} /// @note: break out... no pixels to calculate.
- if (bTree->test_break && bTree->test_break(bTree->tbh)) {return;} /// @note: early break out for blur and preview nodes
- if (this->numberOfChunks == 0) {return;} /// @note: early break out
+ if (this->width == 0 || this->height == 0) {return; } /// @note: break out... no pixels to calculate.
+ if (bTree->test_break && bTree->test_break(bTree->tbh)) {return; } /// @note: early break out for blur and preview nodes
+ if (this->numberOfChunks == 0) {return; } /// @note: early break out
unsigned int chunkNumber;
this->chunksFinished = 0;
@@ -223,7 +224,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
unsigned int index;
unsigned int *chunkOrder = new unsigned int[this->numberOfChunks];
- for (chunkNumber = 0 ; chunkNumber<this->numberOfChunks ; chunkNumber++) {
+ for (chunkNumber = 0; chunkNumber < this->numberOfChunks; chunkNumber++) {
chunkOrder[chunkNumber] = chunkNumber;
}
NodeOperation *operation = this->getOutputNodeOperation();
@@ -232,29 +233,29 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
OrderOfChunks chunkorder = COM_ORDER_OF_CHUNKS_DEFAULT;
if (operation->isViewerOperation()) {
- ViewerBaseOperation *viewer = (ViewerBaseOperation*)operation;
+ ViewerBaseOperation *viewer = (ViewerBaseOperation *)operation;
centerX = viewer->getCenterX();
centerY = viewer->getCenterY();
chunkorder = viewer->getChunkOrder();
}
switch (chunkorder) {
- case COM_TO_RANDOM:
- for (index = 0 ; index < 2 * numberOfChunks ; index ++) {
- int index1 = rand()%numberOfChunks;
- int index2 = rand()%numberOfChunks;
- int s = chunkOrder[index1];
- chunkOrder[index1] = chunkOrder[index2];
- chunkOrder[index2] = s;
- }
- break;
- case COM_TO_CENTER_OUT:
+ case COM_TO_RANDOM:
+ for (index = 0; index < 2 * numberOfChunks; index++) {
+ int index1 = rand() % numberOfChunks;
+ int index2 = rand() % numberOfChunks;
+ int s = chunkOrder[index1];
+ chunkOrder[index1] = chunkOrder[index2];
+ chunkOrder[index2] = s;
+ }
+ break;
+ case COM_TO_CENTER_OUT:
{
- ChunkOrderHotspot **hotspots = new ChunkOrderHotspot*[1];
- hotspots[0] = new ChunkOrderHotspot(this->width*centerX, this->height*centerY, 0.0f);
+ ChunkOrderHotspot **hotspots = new ChunkOrderHotspot *[1];
+ hotspots[0] = new ChunkOrderHotspot(this->width * centerX, this->height * centerY, 0.0f);
rcti rect;
ChunkOrder *chunkOrders = new ChunkOrder[this->numberOfChunks];
- for (index = 0 ; index < this->numberOfChunks; index ++) {
+ for (index = 0; index < this->numberOfChunks; index++) {
determineChunkRect(&rect, index);
chunkOrders[index].setChunkNumber(index);
chunkOrders[index].setX(rect.xmin);
@@ -262,8 +263,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
chunkOrders[index].determineDistance(hotspots, 1);
}
- sort(&chunkOrders[0], &chunkOrders[numberOfChunks-1]);
- for (index = 0 ; index < numberOfChunks; index ++) {
+ sort(&chunkOrders[0], &chunkOrders[numberOfChunks - 1]);
+ for (index = 0; index < numberOfChunks; index++) {
chunkOrder[index] = chunkOrders[index].getChunkNumber();
}
@@ -272,29 +273,29 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
delete[] chunkOrders;
}
break;
- case COM_TO_RULE_OF_THIRDS:
+ case COM_TO_RULE_OF_THIRDS:
{
- ChunkOrderHotspot **hotspots = new ChunkOrderHotspot*[9];
- unsigned int tx = this->width/6;
- unsigned int ty = this->height/6;
- unsigned int mx = this->width/2;
- unsigned int my = this->height/2;
- unsigned int bx = mx+2*tx;
- unsigned int by = my+2*ty;
-
- float addition = numberOfChunks/COM_RULE_OF_THIRDS_DIVIDER;
- hotspots[0] = new ChunkOrderHotspot(mx, my, addition*0);
- hotspots[1] = new ChunkOrderHotspot(tx, my, addition*1);
- hotspots[2] = new ChunkOrderHotspot(bx, my, addition*2);
- hotspots[3] = new ChunkOrderHotspot(bx, by, addition*3);
- hotspots[4] = new ChunkOrderHotspot(tx, ty, addition*4);
- hotspots[5] = new ChunkOrderHotspot(bx, ty, addition*5);
- hotspots[6] = new ChunkOrderHotspot(tx, by, addition*6);
- hotspots[7] = new ChunkOrderHotspot(mx, ty, addition*7);
- hotspots[8] = new ChunkOrderHotspot(mx, by, addition*8);
+ ChunkOrderHotspot **hotspots = new ChunkOrderHotspot *[9];
+ unsigned int tx = this->width / 6;
+ unsigned int ty = this->height / 6;
+ unsigned int mx = this->width / 2;
+ unsigned int my = this->height / 2;
+ unsigned int bx = mx + 2 * tx;
+ unsigned int by = my + 2 * ty;
+
+ float addition = numberOfChunks / COM_RULE_OF_THIRDS_DIVIDER;
+ hotspots[0] = new ChunkOrderHotspot(mx, my, addition * 0);
+ hotspots[1] = new ChunkOrderHotspot(tx, my, addition * 1);
+ hotspots[2] = new ChunkOrderHotspot(bx, my, addition * 2);
+ hotspots[3] = new ChunkOrderHotspot(bx, by, addition * 3);
+ hotspots[4] = new ChunkOrderHotspot(tx, ty, addition * 4);
+ hotspots[5] = new ChunkOrderHotspot(bx, ty, addition * 5);
+ hotspots[6] = new ChunkOrderHotspot(tx, by, addition * 6);
+ hotspots[7] = new ChunkOrderHotspot(mx, ty, addition * 7);
+ hotspots[8] = new ChunkOrderHotspot(mx, by, addition * 8);
rcti rect;
ChunkOrder *chunkOrders = new ChunkOrder[this->numberOfChunks];
- for (index = 0 ; index < this->numberOfChunks; index ++) {
+ for (index = 0; index < this->numberOfChunks; index++) {
determineChunkRect(&rect, index);
chunkOrders[index].setChunkNumber(index);
chunkOrders[index].setX(rect.xmin);
@@ -304,7 +305,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
sort(&chunkOrders[0], &chunkOrders[numberOfChunks]);
- for (index = 0 ; index < numberOfChunks; index ++) {
+ for (index = 0; index < numberOfChunks; index++) {
chunkOrder[index] = chunkOrders[index].getChunkNumber();
}
@@ -321,40 +322,40 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
delete[] chunkOrders;
}
break;
- case COM_TO_TOP_DOWN:
- default:
- break;
+ case COM_TO_TOP_DOWN:
+ default:
+ break;
}
bool breaked = false;
bool finished = false;
unsigned int startIndex = 0;
- const int maxNumberEvaluated = BLI_system_thread_count()*2;
+ const int maxNumberEvaluated = BLI_system_thread_count() * 2;
while (!finished && !breaked) {
- unsigned int index;
+ unsigned int index;
bool startEvaluated = false;
finished = true;
int numberEvaluated = 0;
- for (index = startIndex ; index < numberOfChunks && numberEvaluated < maxNumberEvaluated; index ++) {
+ for (index = startIndex; index < numberOfChunks && numberEvaluated < maxNumberEvaluated; index++) {
int chunkNumber = chunkOrder[index];
- int yChunk = chunkNumber/this->numberOfXChunks;
- int xChunk = chunkNumber - (yChunk*this->numberOfXChunks);
+ int yChunk = chunkNumber / this->numberOfXChunks;
+ int xChunk = chunkNumber - (yChunk * this->numberOfXChunks);
const ChunkExecutionState state = this->chunkExecutionStates[chunkNumber];
if (state == COM_ES_NOT_SCHEDULED) {
scheduleChunkWhenPossible(graph, xChunk, yChunk);
- finished=false;
+ finished = false;
startEvaluated = true;
numberEvaluated++;
}
else if (state == COM_ES_SCHEDULED) {
- finished=false;
+ finished = false;
startEvaluated = true;
numberEvaluated++;
}
else if (state == COM_ES_EXECUTED && !startEvaluated) {
- startIndex = index+1;
+ startIndex = index + 1;
}
}
@@ -368,39 +369,39 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
delete[] chunkOrder;
}
-MemoryBuffer** ExecutionGroup::getInputBuffersCPU()
+MemoryBuffer **ExecutionGroup::getInputBuffersCPU()
{
- vector<MemoryProxy*> memoryproxies;
+ vector<MemoryProxy *> memoryproxies;
unsigned int index;
this->determineDependingMemoryProxies(&memoryproxies);
- MemoryBuffer **memoryBuffers = new MemoryBuffer*[this->cachedMaxReadBufferOffset];
- for (index = 0 ; index < this->cachedMaxReadBufferOffset ; index ++) {
+ MemoryBuffer **memoryBuffers = new MemoryBuffer *[this->cachedMaxReadBufferOffset];
+ for (index = 0; index < this->cachedMaxReadBufferOffset; index++) {
memoryBuffers[index] = NULL;
}
- for (index = 0 ; index < this->cachedReadOperations.size(); index ++) {
- ReadBufferOperation *readOperation = (ReadBufferOperation*)this->cachedReadOperations[index];
+ for (index = 0; index < this->cachedReadOperations.size(); index++) {
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)this->cachedReadOperations[index];
memoryBuffers[readOperation->getOffset()] = readOperation->getMemoryProxy()->getBuffer();
}
return memoryBuffers;
}
-MemoryBuffer** ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
+MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
{
rcti rect;
- vector<MemoryProxy*> memoryproxies;
+ vector<MemoryProxy *> memoryproxies;
unsigned int index;
determineChunkRect(&rect, chunkNumber);
this->determineDependingMemoryProxies(&memoryproxies);
- MemoryBuffer **memoryBuffers = new MemoryBuffer*[this->cachedMaxReadBufferOffset];
- for (index = 0 ; index < this->cachedMaxReadBufferOffset ; index ++) {
+ MemoryBuffer **memoryBuffers = new MemoryBuffer *[this->cachedMaxReadBufferOffset];
+ for (index = 0; index < this->cachedMaxReadBufferOffset; index++) {
memoryBuffers[index] = NULL;
}
rcti output;
- for (index = 0 ; index < this->cachedReadOperations.size(); index ++) {
- ReadBufferOperation *readOperation = (ReadBufferOperation*)this->cachedReadOperations[index];
- MemoryProxy * memoryProxy = readOperation->getMemoryProxy();
+ for (index = 0; index < this->cachedReadOperations.size(); index++) {
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)this->cachedReadOperations[index];
+ MemoryProxy *memoryProxy = readOperation->getMemoryProxy();
this->determineDependingAreaOfInterest(&rect, readOperation, &output);
MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer(memoryProxy, &output);
memoryBuffers[readOperation->getOffset()] = memoryBuffer;
@@ -410,21 +411,21 @@ MemoryBuffer** ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
{
- MemoryBuffer* imageBuffer = memoryProxy->getBuffer();
- MemoryBuffer* result = new MemoryBuffer(memoryProxy, rect);
+ MemoryBuffer *imageBuffer = memoryProxy->getBuffer();
+ MemoryBuffer *result = new MemoryBuffer(memoryProxy, rect);
result->copyContentFrom(imageBuffer);
return result;
}
-void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memoryBuffers)
+void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers)
{
if (this->chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
this->chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;
this->chunksFinished++;
if (memoryBuffers) {
- for (unsigned int index = 0 ; index < this->cachedMaxReadBufferOffset; index ++) {
- MemoryBuffer * buffer = memoryBuffers[index];
+ for (unsigned int index = 0; index < this->cachedMaxReadBufferOffset; index++) {
+ MemoryBuffer *buffer = memoryBuffers[index];
if (buffer) {
if (buffer->isTemporarily()) {
memoryBuffers[index] = NULL;
@@ -437,12 +438,12 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memo
if (bTree) {
// status report is only performed for top level Execution Groups.
float progress = chunksFinished;
- progress/=numberOfChunks;
+ progress /= numberOfChunks;
bTree->progress(bTree->prh, progress);
}
}
-inline void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk ) const
+inline void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const
{
if (singleThreaded) {
BLI_init_rcti(rect, 0, this->width, 0, this->height);
@@ -464,9 +465,9 @@ void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int chunkNumb
MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti *rect)
{
// we asume that this method is only called from complex execution groups.
- NodeOperation * operation = this->getOutputNodeOperation();
+ NodeOperation *operation = this->getOutputNodeOperation();
if (operation->isWriteBufferOperation()) {
- WriteBufferOperation *writeOperation = (WriteBufferOperation*)operation;
+ WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation;
MemoryBuffer *buffer = new MemoryBuffer(writeOperation->getMemoryProxy(), rect);
return buffer;
}
@@ -474,7 +475,7 @@ MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti *rect)
}
-bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *area)
+bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area)
{
if (singleThreaded) {
return scheduleChunkWhenPossible(graph, 0, 0);
@@ -485,14 +486,14 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *are
float chunkSizef = this->chunkSize;
int indexx, indexy;
- const int minxchunk = floor(area->xmin/chunkSizef);
- const int maxxchunk = ceil((area->xmax-1)/chunkSizef);
- const int minychunk = floor(area->ymin/chunkSizef);
- const int maxychunk = ceil((area->ymax-1)/chunkSizef);
+ const int minxchunk = floor(area->xmin / chunkSizef);
+ const int maxxchunk = ceil((area->xmax - 1) / chunkSizef);
+ const int minychunk = floor(area->ymin / chunkSizef);
+ const int maxychunk = ceil((area->ymax - 1) / chunkSizef);
bool result = true;
- for (indexx = max(minxchunk, 0); indexx<maxxchunk ; indexx++) {
- for (indexy = max(minychunk, 0); indexy<maxychunk ; indexy++) {
+ for (indexx = max(minxchunk, 0); indexx < maxxchunk; indexx++) {
+ for (indexy = max(minychunk, 0); indexy < maxychunk; indexy++) {
if (!scheduleChunkWhenPossible(graph, indexx, indexy)) {
result = false;
}
@@ -512,7 +513,7 @@ bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber)
return false;
}
-bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChunk, int yChunk)
+bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChunk, int yChunk)
{
if (xChunk < 0 || xChunk >= (int)this->numberOfXChunks) {
return true;
@@ -520,7 +521,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
if (yChunk < 0 || yChunk >= (int)this->numberOfYChunks) {
return true;
}
- int chunkNumber = yChunk*this->numberOfXChunks + xChunk;
+ int chunkNumber = yChunk * this->numberOfXChunks + xChunk;
// chunk is already executed
if (this->chunkExecutionStates[chunkNumber] == COM_ES_EXECUTED) {
return true;
@@ -532,7 +533,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
}
// chunk is nor executed nor scheduled.
- vector<MemoryProxy*> memoryProxies;
+ vector<MemoryProxy *> memoryProxies;
this->determineDependingMemoryProxies(&memoryProxies);
rcti rect;
@@ -541,10 +542,10 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
bool canBeExecuted = true;
rcti area;
- for (index = 0 ; index < cachedReadOperations.size() ; index ++) {
- ReadBufferOperation * readOperation = (ReadBufferOperation*)cachedReadOperations[index];
+ for (index = 0; index < cachedReadOperations.size(); index++) {
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)cachedReadOperations[index];
BLI_init_rcti(&area, 0, 0, 0, 0);
- MemoryProxy * memoryProxy = memoryProxies[index];
+ MemoryProxy *memoryProxy = memoryProxies[index];
determineDependingAreaOfInterest(&rect, readOperation, &area);
ExecutionGroup *group = memoryProxy->getExecutor();
@@ -565,16 +566,16 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
return false;
}
-void ExecutionGroup::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
+void ExecutionGroup::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
this->getOutputNodeOperation()->determineDependingAreaOfInterest(input, readOperation, output);
}
-void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy*> *memoryProxies)
+void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy *> *memoryProxies)
{
unsigned int index;
- for (index = 0 ; index < this->cachedReadOperations.size() ; index ++) {
- ReadBufferOperation * readOperation = (ReadBufferOperation*) this->cachedReadOperations[index];
+ for (index = 0; index < this->cachedReadOperations.size(); index++) {
+ ReadBufferOperation *readOperation = (ReadBufferOperation *) this->cachedReadOperations[index];
memoryProxies->push_back(readOperation->getMemoryProxy());
}
}
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 7ea97b3fa39..b644f405f00 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -22,16 +22,18 @@
#include "COM_ExecutionSystem.h"
+#include <sstream>
+#include <stdio.h>
+
#include "PIL_time.h"
#include "BKE_node.h"
+
#include "COM_Converter.h"
-#include <sstream>
#include "COM_NodeOperation.h"
#include "COM_ExecutionGroup.h"
#include "COM_NodeBase.h"
#include "COM_WorkScheduler.h"
#include "COM_ReadBufferOperation.h"
-#include "stdio.h"
#include "COM_GroupNode.h"
#include "COM_WriteBufferOperation.h"
#include "COM_ReadBufferOperation.h"
@@ -42,8 +44,8 @@
ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
{
context.setbNodeTree(editingtree);
- bNode* gnode;
- for (gnode = (bNode*)editingtree->nodes.first ; gnode ; gnode = (bNode*)gnode->next) {
+ bNode *gnode;
+ for (gnode = (bNode *)editingtree->nodes.first; gnode; gnode = (bNode *)gnode->next) {
if (gnode->type == NODE_GROUP && gnode->typeinfo->group_edit_get(gnode)) {
context.setActivegNode(gnode);
break;
@@ -60,19 +62,19 @@ ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
context.setRendering(rendering);
context.setHasActiveOpenCLDevices(WorkScheduler::hasGPUDevices() && (editingtree->flag & NTREE_COM_OPENCL));
- Node *mainOutputNode=NULL;
+ Node *mainOutputNode = NULL;
mainOutputNode = ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree, NULL);
if (mainOutputNode) {
- context.setScene((Scene*)mainOutputNode->getbNode()->id);
+ context.setScene((Scene *)mainOutputNode->getbNode()->id);
this->convertToOperations();
this->groupOperations(); /* group operations in ExecutionGroups */
unsigned int index;
unsigned int resolution[2];
- for (index = 0 ; index < this->groups.size(); index ++) {
- resolution[0]=0;
- resolution[1]=0;
+ for (index = 0; index < this->groups.size(); index++) {
+ resolution[0] = 0;
+ resolution[1] = 0;
ExecutionGroup *executionGroup = groups[index];
executionGroup->determineResolution(resolution);
}
@@ -111,24 +113,24 @@ ExecutionSystem::~ExecutionSystem()
void ExecutionSystem::execute()
{
unsigned int order = 0;
- for (vector<NodeOperation*>::iterator iter = this->operations.begin(); iter != operations.end(); ++iter) {
+ for (vector<NodeOperation *>::iterator iter = this->operations.begin(); iter != operations.end(); ++iter) {
NodeBase *node = *iter;
- NodeOperation *operation = (NodeOperation*) node;
+ NodeOperation *operation = (NodeOperation *) node;
if (operation->isReadBufferOperation()) {
- ReadBufferOperation * readOperation = (ReadBufferOperation*)operation;
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
readOperation->setOffset(order);
- order ++;
+ order++;
}
}
unsigned int index;
- for (index = 0 ; index < this->operations.size() ; index ++) {
- NodeOperation * operation = this->operations[index];
+ for (index = 0; index < this->operations.size(); index++) {
+ NodeOperation *operation = this->operations[index];
operation->setbNodeTree(this->context.getbNodeTree());
operation->initExecution();
}
- for (index = 0 ; index < this->groups.size() ; index ++) {
- ExecutionGroup * executionGroup = this->groups[index];
+ for (index = 0; index < this->groups.size(); index++) {
+ ExecutionGroup *executionGroup = this->groups[index];
executionGroup->setChunksize(context.getChunksize());
executionGroup->initExecution();
}
@@ -142,12 +144,12 @@ void ExecutionSystem::execute()
WorkScheduler::finish();
WorkScheduler::stop();
- for (index = 0 ; index < this->operations.size() ; index ++) {
- NodeOperation * operation = this->operations[index];
+ for (index = 0; index < this->operations.size(); index++) {
+ NodeOperation *operation = this->operations[index];
operation->deinitExecution();
}
- for (index = 0 ; index < this->groups.size() ; index ++) {
- ExecutionGroup * executionGroup = this->groups[index];
+ for (index = 0; index < this->groups.size(); index++) {
+ ExecutionGroup *executionGroup = this->groups[index];
executionGroup->deinitExecution();
}
}
@@ -155,10 +157,10 @@ void ExecutionSystem::execute()
void ExecutionSystem::executeGroups(CompositorPriority priority)
{
unsigned int index;
- vector<ExecutionGroup*> executionGroups;
+ vector<ExecutionGroup *> executionGroups;
this->findOutputExecutionGroup(&executionGroups, priority);
- for (index = 0 ; index < executionGroups.size(); index ++) {
+ for (index = 0; index < executionGroups.size(); index++) {
ExecutionGroup *group = executionGroups[index];
group->execute(this);
}
@@ -175,15 +177,15 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
// for every input add write and read operation if input is not a read operation
// only add read operation to other links when they are attached to buffered operations.
unsigned int index;
- for (index = 0 ; index < operation->getNumberOfInputSockets();index++) {
+ for (index = 0; index < operation->getNumberOfInputSockets(); index++) {
InputSocket *inputsocket = operation->getInputSocket(index);
if (inputsocket->isConnected()) {
SocketConnection *connection = inputsocket->getConnection();
- NodeOperation *otherEnd = (NodeOperation*)connection->getFromNode();
+ NodeOperation *otherEnd = (NodeOperation *)connection->getFromNode();
if (!otherEnd->isReadBufferOperation()) {
// check of other end already has write operation
OutputSocket *fromsocket = connection->getFromSocket();
- WriteBufferOperation * writeoperation = fromsocket->findAttachedWriteBufferOperation();
+ WriteBufferOperation *writeoperation = fromsocket->findAttachedWriteBufferOperation();
if (writeoperation == NULL) {
writeoperation = new WriteBufferOperation();
writeoperation->setbNodeTree(this->getContext().getbNodeTree());
@@ -201,11 +203,11 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
}
}
/*
- link the outputsocket to a write operation
- link the writeoperation to a read operation
- link the read operation to the next node.
- */
- OutputSocket * outputsocket = operation->getOutputSocket();
+ * link the outputsocket to a write operation
+ * link the writeoperation to a read operation
+ * link the read operation to the next node.
+ */
+ OutputSocket *outputsocket = operation->getOutputSocket();
if (outputsocket->isConnected()) {
int index;
WriteBufferOperation *writeOperation;
@@ -214,8 +216,8 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
this->addOperation(writeOperation);
ExecutionSystemHelper::addLink(this->getConnections(), outputsocket, writeOperation->getInputSocket(0));
writeOperation->readResolutionFromInputSocket();
- for (index = 0 ; index < outputsocket->getNumberOfConnections()-1;index ++) {
- SocketConnection * connection = outputsocket->getConnection(index);
+ for (index = 0; index < outputsocket->getNumberOfConnections() - 1; index++) {
+ SocketConnection *connection = outputsocket->getConnection(index);
ReadBufferOperation *readoperation = new ReadBufferOperation();
readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
connection->setFromSocket(readoperation->getOutputSocket());
@@ -230,11 +232,11 @@ void ExecutionSystem::convertToOperations()
{
unsigned int index;
for (index = 0; index < this->nodes.size(); index++) {
- Node *node = (Node*)this->nodes[index];
+ Node *node = (Node *)this->nodes[index];
node->convertToOperations(this, &this->context);
}
- for (index = 0 ; index < this->connections.size(); index ++) {
+ for (index = 0; index < this->connections.size(); index++) {
SocketConnection *connection = this->connections[index];
if (connection->isValid()) {
if (connection->getFromSocket()->getDataType() != connection->getToSocket()->getDataType()) {
@@ -244,27 +246,27 @@ void ExecutionSystem::convertToOperations()
}
// determine all resolutions of the operations (Width/Height)
- for (index = 0 ; index < this->operations.size(); index ++) {
+ for (index = 0; index < this->operations.size(); index++) {
NodeOperation *operation = this->operations[index];
if (operation->isOutputOperation(context.isRendering()) && !operation->isPreviewOperation()) {
- unsigned int resolution[2] = {0,0};
- unsigned int preferredResolution[2] = {0,0};
+ unsigned int resolution[2] = {0, 0};
+ unsigned int preferredResolution[2] = {0, 0};
operation->determineResolution(resolution, preferredResolution);
operation->setResolution(resolution);
}
}
- for (index = 0 ; index < this->operations.size(); index ++) {
+ for (index = 0; index < this->operations.size(); index++) {
NodeOperation *operation = this->operations[index];
if (operation->isOutputOperation(context.isRendering()) && operation->isPreviewOperation()) {
- unsigned int resolution[2] = {0,0};
- unsigned int preferredResolution[2] = {0,0};
+ unsigned int resolution[2] = {0, 0};
+ unsigned int preferredResolution[2] = {0, 0};
operation->determineResolution(resolution, preferredResolution);
operation->setResolution(resolution);
}
}
// add convert resolution operations when needed.
- for (index = 0 ; index < this->connections.size(); index ++) {
+ for (index = 0; index < this->connections.size(); index++) {
SocketConnection *connection = this->connections[index];
if (connection->isValid()) {
if (connection->needsResolutionConversion()) {
@@ -272,13 +274,12 @@ void ExecutionSystem::convertToOperations()
}
}
}
-
}
void ExecutionSystem::groupOperations()
{
- vector<NodeOperation*> outputOperations;
- NodeOperation * operation;
+ vector<NodeOperation *> outputOperations;
+ NodeOperation *operation;
unsigned int index;
// surround complex operations with ReadBufferOperation and WriteBufferOperation
for (index = 0; index < this->operations.size(); index++) {
@@ -288,7 +289,7 @@ void ExecutionSystem::groupOperations()
}
}
ExecutionSystemHelper::findOutputNodeOperations(&outputOperations, this->getOperations(), this->context.isRendering());
- for (vector<NodeOperation*>::iterator iter = outputOperations.begin(); iter != outputOperations.end(); ++iter) {
+ for (vector<NodeOperation *>::iterator iter = outputOperations.begin(); iter != outputOperations.end(); ++iter) {
operation = *iter;
ExecutionGroup *group = new ExecutionGroup();
group->addOperation(this, operation);
@@ -303,10 +304,10 @@ void ExecutionSystem::addSocketConnection(SocketConnection *connection)
}
-void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result, CompositorPriority priority) const
+void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup *> *result, CompositorPriority priority) const
{
unsigned int index;
- for (index = 0 ; index < this->groups.size() ; index ++) {
+ for (index = 0; index < this->groups.size(); index++) {
ExecutionGroup *group = this->groups[index];
if (group->isOutputExecutionGroup() && group->getRenderPriotrity() == priority) {
result->push_back(group);
@@ -314,10 +315,10 @@ void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result,
}
}
-void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result) const
+void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup *> *result) const
{
unsigned int index;
- for (index = 0 ; index < this->groups.size() ; index ++) {
+ for (index = 0; index < this->groups.size(); index++) {
ExecutionGroup *group = this->groups[index];
if (group->isOutputExecutionGroup()) {
result->push_back(group);
diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
index 2d889e269e0..b7d75732a84 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
@@ -22,53 +22,55 @@
#include "COM_ExecutionSystemHelper.h"
+#include <sstream>
+#include <stdio.h>
+
#include "PIL_time.h"
#include "BKE_node.h"
+
#include "COM_Converter.h"
-#include <sstream>
#include "COM_NodeOperation.h"
#include "COM_ExecutionGroup.h"
#include "COM_NodeBase.h"
#include "COM_WorkScheduler.h"
#include "COM_ReadBufferOperation.h"
-#include "stdio.h"
#include "COM_GroupNode.h"
#include "COM_WriteBufferOperation.h"
#include "COM_ReadBufferOperation.h"
#include "COM_ViewerBaseOperation.h"
-Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree * tree, bNode *groupnode)
+Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode)
{
- vector<Node*>& nodes = system.getNodes();
- vector<SocketConnection*>& links = system.getConnections();
+ vector<Node *>& nodes = system.getNodes();
+ vector<SocketConnection *>& links = system.getConnections();
Node *mainnode = NULL;
- const bNode * activeGroupNode = system.getContext().getActivegNode();
+ const bNode *activeGroupNode = system.getContext().getActivegNode();
bool isActiveGroup = activeGroupNode == groupnode;
/* add all nodes of the tree to the node list */
- bNode *node = (bNode*)tree->nodes.first;
+ bNode *node = (bNode *)tree->nodes.first;
while (node != NULL) {
Node *execnode = addNode(nodes, node, isActiveGroup);
if (node->type == CMP_NODE_COMPOSITE) {
mainnode = execnode;
}
- node = (bNode*)node->next;
+ node = (bNode *)node->next;
}
- NodeRange node_range(nodes.begin()+nodes_start, nodes.end());
+ NodeRange node_range(nodes.begin() + nodes_start, nodes.end());
/* add all nodelinks of the tree to the link list */
- bNodeLink *nodelink = (bNodeLink*)tree->links.first;
+ bNodeLink *nodelink = (bNodeLink *)tree->links.first;
while (nodelink != NULL) {
addNodeLink(node_range, links, nodelink);
- nodelink = (bNodeLink*)nodelink->next;
+ nodelink = (bNodeLink *)nodelink->next;
}
/* Expand group nodes */
- for (unsigned int i=nodes_start; i < nodes.size(); ++i) {
+ for (unsigned int i = nodes_start; i < nodes.size(); ++i) {
Node *execnode = nodes[i];
if (execnode->isGroupNode()) {
- GroupNode * groupNode = (GroupNode*)execnode;
+ GroupNode *groupNode = (GroupNode *)execnode;
groupNode->ungroup(system);
}
}
@@ -76,15 +78,15 @@ Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_sta
return mainnode;
}
-void ExecutionSystemHelper::addNode(vector<Node*>& nodes, Node *node)
+void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node)
{
nodes.push_back(node);
}
-Node *ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode, bool inActiveGroup)
+Node *ExecutionSystemHelper::addNode(vector<Node *>& nodes, bNode *bNode, bool inActiveGroup)
{
Converter converter;
- Node * node;
+ Node *node;
node = converter.convert(bNode);
node->setIsInActiveGroup(inActiveGroup);
if (node != NULL) {
@@ -93,21 +95,21 @@ Node *ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode, bool in
}
return NULL;
}
-void ExecutionSystemHelper::addOperation(vector<NodeOperation*>& operations, NodeOperation *operation)
+void ExecutionSystemHelper::addOperation(vector<NodeOperation *>& operations, NodeOperation *operation)
{
operations.push_back(operation);
}
-void ExecutionSystemHelper::addExecutionGroup(vector<ExecutionGroup*>& executionGroups, ExecutionGroup *executionGroup)
+void ExecutionSystemHelper::addExecutionGroup(vector<ExecutionGroup *>& executionGroups, ExecutionGroup *executionGroup)
{
executionGroups.push_back(executionGroup);
}
-void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation*>* result, vector<NodeOperation*>& operations, bool rendering)
+void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation *> *result, vector<NodeOperation *>& operations, bool rendering)
{
unsigned int index;
- for (index = 0 ; index < operations.size() ; index ++) {
+ for (index = 0; index < operations.size(); index++) {
NodeOperation *operation = operations[index];
if (operation->isOutputOperation(rendering)) {
result->push_back(operation);
@@ -118,18 +120,18 @@ void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation*>* res
static InputSocket *find_input(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
{
if (bnode != NULL) {
- for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
Node *node = *it;
if (node->getbNode() == bnode)
return node->findInputSocketBybNodeSocket(bsocket);
}
}
else {
- for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
Node *node = *it;
if (node->isProxyNode()) {
InputSocket *proxySocket = node->getInputSocket(0);
- if (proxySocket->getbNodeSocket()==bsocket)
+ if (proxySocket->getbNodeSocket() == bsocket)
return proxySocket;
}
}
@@ -139,29 +141,29 @@ static InputSocket *find_input(NodeRange &node_range, bNode *bnode, bNodeSocket
static OutputSocket *find_output(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
{
if (bnode != NULL) {
- for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
Node *node = *it;
if (node->getbNode() == bnode)
return node->findOutputSocketBybNodeSocket(bsocket);
}
}
else {
- for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
Node *node = *it;
if (node->isProxyNode()) {
OutputSocket *proxySocket = node->getOutputSocket(0);
- if (proxySocket->getbNodeSocket()==bsocket)
+ if (proxySocket->getbNodeSocket() == bsocket)
return proxySocket;
}
}
}
return NULL;
}
-SocketConnection *ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink)
+SocketConnection *ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector<SocketConnection *>& links, bNodeLink *bNodeLink)
{
/// @note: cyclic lines will be ignored. This has been copied from node.c
if (bNodeLink->tonode != 0 && bNodeLink->fromnode != 0) {
- if (!(bNodeLink->fromnode->level >= bNodeLink->tonode->level && bNodeLink->tonode->level!=0xFFF)) { // only add non cyclic lines! so execution will procede
+ if (!(bNodeLink->fromnode->level >= bNodeLink->tonode->level && bNodeLink->tonode->level != 0xFFF)) { // only add non cyclic lines! so execution will procede
return NULL;
}
}
@@ -178,9 +180,9 @@ SocketConnection *ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vect
return connection;
}
-SocketConnection *ExecutionSystemHelper::addLink(vector<SocketConnection*>& links, OutputSocket *fromSocket, InputSocket *toSocket)
+SocketConnection *ExecutionSystemHelper::addLink(vector<SocketConnection *>& links, OutputSocket *fromSocket, InputSocket *toSocket)
{
- SocketConnection * newconnection = new SocketConnection();
+ SocketConnection *newconnection = new SocketConnection();
newconnection->setFromSocket(fromSocket);
newconnection->setToSocket(toSocket);
fromSocket->addConnection(newconnection);
@@ -199,12 +201,12 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
printf("-- BEGIN COMPOSITOR DUMP --\r\n");
printf("digraph compositorexecution {\r\n");
tot = system->getNodes().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
node = system->getNodes()[i];
printf("// NODE: %s\r\n", node->getbNode()->typeinfo->name);
}
tot = system->getOperations().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
operation = system->getOperations()[i];
printf("// OPERATION: %p\r\n", operation);
printf("\t\"O_%p\"", operation);
@@ -212,32 +214,33 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
tot2 = operation->getNumberOfInputSockets();
if (tot2 != 0) {
printf("{");
- for (int j = 0 ; j < tot2 ; j ++) {
+ for (int j = 0; j < tot2; j++) {
InputSocket *socket = operation->getInputSocket(j);
if (j != 0) {
printf("|");
}
printf("<IN_%p>", socket);
switch (socket->getDataType()) {
- case COM_DT_VALUE:
- printf("Value");
- break;
- case COM_DT_VECTOR:
- printf("Vector");
- break;
- case COM_DT_COLOR:
- printf("Color");
- break;
+ case COM_DT_VALUE:
+ printf("Value");
+ break;
+ case COM_DT_VECTOR:
+ printf("Vector");
+ break;
+ case COM_DT_COLOR:
+ printf("Color");
+ break;
}
}
printf("}");
printf("|");
}
if (operation->isViewerOperation()) {
- ViewerBaseOperation * viewer = (ViewerBaseOperation*)operation;
+ ViewerBaseOperation *viewer = (ViewerBaseOperation *)operation;
if (viewer->isActiveViewerOutput()) {
printf("Active viewer");
- } else {
+ }
+ else {
printf("Viewer");
}
}
@@ -261,22 +264,22 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
if (tot2 != 0) {
printf("|");
printf("{");
- for (int j = 0 ; j < tot2 ; j ++) {
+ for (int j = 0; j < tot2; j++) {
OutputSocket *socket = operation->getOutputSocket(j);
if (j != 0) {
printf("|");
}
printf("<OUT_%p>", socket);
switch (socket->getDataType()) {
- case COM_DT_VALUE:
- printf("Value");
- break;
- case COM_DT_VECTOR:
- printf("Vector");
- break;
- case COM_DT_COLOR:
- printf("Color");
- break;
+ case COM_DT_VALUE:
+ printf("Value");
+ break;
+ case COM_DT_VECTOR:
+ printf("Vector");
+ break;
+ case COM_DT_COLOR:
+ printf("Color");
+ break;
}
}
printf("}");
@@ -285,7 +288,7 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
printf("\r\n");
}
tot = system->getExecutionGroups().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
group = system->getExecutionGroups()[i];
printf("// GROUP: %d\r\n", i);
printf("subgraph {\r\n");
@@ -294,16 +297,16 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
printf("}\r\n");
}
tot = system->getOperations().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
operation = system->getOperations()[i];
if (operation->isReadBufferOperation()) {
- ReadBufferOperation * read = (ReadBufferOperation*)operation;
- WriteBufferOperation * write = read->getMemoryProxy()->getWriteBufferOperation();
+ ReadBufferOperation *read = (ReadBufferOperation *)operation;
+ WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation();
printf("\t\"O_%p\" -> \"O_%p\" [style=dotted]\r\n", write, read);
}
}
tot = system->getConnections().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
connection = system->getConnections()[i];
printf("// CONNECTION: %p.%p -> %p.%p\r\n", connection->getFromNode(), connection->getFromSocket(), connection->getToNode(), connection->getToSocket());
printf("\t\"O_%p\":\"OUT_%p\" -> \"O_%p\":\"IN_%p\"", connection->getFromNode(), connection->getFromSocket(), connection->getToNode(), connection->getToSocket());
@@ -312,15 +315,15 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
}
else {
switch (connection->getFromSocket()->getDataType()) {
- case COM_DT_VALUE:
- printf(" [color=grey]");
- break;
- case COM_DT_VECTOR:
- printf(" [color=blue]");
- break;
- case COM_DT_COLOR:
- printf(" [color=orange]");
- break;
+ case COM_DT_VALUE:
+ printf(" [color=grey]");
+ break;
+ case COM_DT_VECTOR:
+ printf(" [color=blue]");
+ break;
+ case COM_DT_COLOR:
+ printf(" [color=orange]");
+ break;
}
}
printf("\r\n");
diff --git a/source/blender/compositor/intern/COM_InputSocket.cpp b/source/blender/compositor/intern/COM_InputSocket.cpp
index c9705ad69fb..3ca74f157b4 100644
--- a/source/blender/compositor/intern/COM_InputSocket.cpp
+++ b/source/blender/compositor/intern/COM_InputSocket.cpp
@@ -25,18 +25,18 @@
#include "COM_SocketConnection.h"
#include "COM_ExecutionSystem.h"
-InputSocket::InputSocket(DataType datatype) :Socket(datatype)
+InputSocket::InputSocket(DataType datatype) : Socket(datatype)
{
this->connection = NULL;
this->resizeMode = COM_SC_CENTER;
}
-InputSocket::InputSocket(DataType datatype, InputSocketResizeMode resizeMode) :Socket(datatype)
+InputSocket::InputSocket(DataType datatype, InputSocketResizeMode resizeMode) : Socket(datatype)
{
this->connection = NULL;
this->resizeMode = resizeMode;
}
-InputSocket::InputSocket(InputSocket *from) :Socket(from->getDataType())
+InputSocket::InputSocket(InputSocket *from) : Socket(from->getDataType())
{
this->connection = NULL;
this->resizeMode = from->getResizeMode();
@@ -54,7 +54,7 @@ SocketConnection *InputSocket::getConnection()
return this->connection;
}
-void InputSocket::determineResolution(unsigned int resolution[],unsigned int preferredResolution[])
+void InputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
if (this->isConnected()) {
this->connection->getFromSocket()->determineResolution(resolution, preferredResolution);
@@ -78,22 +78,22 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket)
void InputSocket::relinkConnectionsDuplicate(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *graph)
{
if (!this->isConnected()) {
- Node *node = (Node*)this->getNode();
+ Node *node = (Node *)this->getNode();
switch (this->getDataType()) {
- case COM_DT_COLOR:
- node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VECTOR:
- node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VALUE:
- node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
+ case COM_DT_COLOR:
+ node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
+ case COM_DT_VECTOR:
+ node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
+ case COM_DT_VALUE:
+ node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
}
return;
}
- SocketConnection * newConnection = new SocketConnection();
- OutputSocket * fromSocket = this->getConnection()->getFromSocket();
+ SocketConnection *newConnection = new SocketConnection();
+ OutputSocket *fromSocket = this->getConnection()->getFromSocket();
newConnection->setToSocket(relinkToSocket);
newConnection->setFromSocket(fromSocket);
relinkToSocket->setConnection(newConnection);
@@ -107,17 +107,17 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket, int editorNode
relinkConnections(relinkToSocket);
}
else {
- Node *node = (Node*)this->getNode();
+ Node *node = (Node *)this->getNode();
switch (this->getDataType()) {
- case COM_DT_COLOR:
- node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VECTOR:
- node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VALUE:
- node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
+ case COM_DT_COLOR:
+ node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
+ case COM_DT_VECTOR:
+ node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
+ case COM_DT_VALUE:
+ node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
}
}
}
@@ -140,7 +140,7 @@ SocketReader *InputSocket::getReader()
NodeOperation *InputSocket::getOperation() const
{
if (isConnected()) {
- return (NodeOperation*)this->connection->getFromSocket()->getNode();
+ return (NodeOperation *)this->connection->getFromSocket()->getNode();
}
else {
return NULL;
@@ -156,14 +156,14 @@ float *InputSocket::getStaticValues()
static float default_null = 0.0f;
switch (this->getDataType()) {
- case COM_DT_VALUE:
- return &((bNodeSocketValueFloat*)b_socket->default_value)->value;
- case COM_DT_COLOR:
- return ((bNodeSocketValueRGBA*)b_socket->default_value)->value;
- case COM_DT_VECTOR:
- return ((bNodeSocketValueVector*)b_socket->default_value)->value;
- default:
- /* XXX this should never happen, just added to please the compiler */
- return &default_null;
+ case COM_DT_VALUE:
+ return &((bNodeSocketValueFloat *)b_socket->default_value)->value;
+ case COM_DT_COLOR:
+ return ((bNodeSocketValueRGBA *)b_socket->default_value)->value;
+ case COM_DT_VECTOR:
+ return ((bNodeSocketValueVector *)b_socket->default_value)->value;
+ default:
+ /* XXX this should never happen, just added to please the compiler */
+ return &default_null;
}
}
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index 90f6d4a738d..ceed53c4c0d 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -32,30 +32,30 @@ unsigned int MemoryBuffer::determineBufferSize()
int MemoryBuffer::getWidth() const
{
- return this->rect.xmax-this->rect.xmin;
+ return this->rect.xmax - this->rect.xmin;
}
int MemoryBuffer::getHeight() const
{
- return this->rect.ymax-this->rect.ymin;
+ return this->rect.ymax - this->rect.ymin;
}
-MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, unsigned int chunkNumber, rcti *rect)
+MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect)
{
BLI_init_rcti(&this->rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
this->memoryProxy = memoryProxy;
this->chunkNumber = chunkNumber;
- this->buffer = (float*)MEM_mallocN(sizeof(float)*determineBufferSize()*COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
+ this->buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
this->state = COM_MB_ALLOCATED;
this->datatype = COM_DT_COLOR;
this->chunkWidth = this->rect.xmax - this->rect.xmin;
}
-MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti *rect)
+MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
{
BLI_init_rcti(&this->rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
this->memoryProxy = memoryProxy;
this->chunkNumber = -1;
- this->buffer = (float*)MEM_mallocN(sizeof(float)*determineBufferSize()*COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
+ this->buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
this->state = COM_MB_TEMPORARILY;
this->datatype = COM_DT_COLOR;
this->chunkWidth = this->rect.xmax - this->rect.xmin;
@@ -63,12 +63,12 @@ MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti *rect)
MemoryBuffer *MemoryBuffer::duplicate()
{
MemoryBuffer *result = new MemoryBuffer(this->memoryProxy, &this->rect);
- memcpy(result->buffer, this->buffer, this->determineBufferSize()*COM_NUMBER_OF_CHANNELS*sizeof(float));
+ memcpy(result->buffer, this->buffer, this->determineBufferSize() * COM_NUMBER_OF_CHANNELS * sizeof(float));
return result;
}
void MemoryBuffer::clear()
{
- memset(this->buffer, 0, this->determineBufferSize()*COM_NUMBER_OF_CHANNELS*sizeof(float));
+ memset(this->buffer, 0, this->determineBufferSize() * COM_NUMBER_OF_CHANNELS * sizeof(float));
}
float *MemoryBuffer::convertToValueBuffer()
@@ -81,7 +81,7 @@ float *MemoryBuffer::convertToValueBuffer()
const float *fp_src = this->buffer;
float *fp_dst = result;
- for (i = 0; i < size ; i++, fp_dst++, fp_src += COM_NUMBER_OF_CHANNELS) {
+ for (i = 0; i < size; i++, fp_dst++, fp_src += COM_NUMBER_OF_CHANNELS) {
*fp_dst = *fp_src;
}
@@ -110,17 +110,17 @@ void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer)
int otherOffset;
- for (otherY = minY ; otherY<maxY ; otherY ++) {
- otherOffset = ((otherY-otherBuffer->rect.ymin) * otherBuffer->chunkWidth + minX-otherBuffer->rect.xmin)*COM_NUMBER_OF_CHANNELS;
- offset = ((otherY - this->rect.ymin) * this->chunkWidth + minX-this->rect.xmin)*COM_NUMBER_OF_CHANNELS;
- memcpy(&this->buffer[offset], &otherBuffer->buffer[otherOffset], (maxX-minX) * COM_NUMBER_OF_CHANNELS*sizeof(float));
+ for (otherY = minY; otherY < maxY; otherY++) {
+ otherOffset = ((otherY - otherBuffer->rect.ymin) * otherBuffer->chunkWidth + minX - otherBuffer->rect.xmin) * COM_NUMBER_OF_CHANNELS;
+ offset = ((otherY - this->rect.ymin) * this->chunkWidth + minX - this->rect.xmin) * COM_NUMBER_OF_CHANNELS;
+ memcpy(&this->buffer[offset], &otherBuffer->buffer[otherOffset], (maxX - minX) * COM_NUMBER_OF_CHANNELS * sizeof(float));
}
}
void MemoryBuffer::read(float result[4], int x, int y)
{
- if (x>=this->rect.xmin && x < this->rect.xmax &&
- y>=this->rect.ymin && y < this->rect.ymax)
+ if (x >= this->rect.xmin && x < this->rect.xmax &&
+ y >= this->rect.ymin && y < this->rect.ymax)
{
const int dx = x - this->rect.xmin;
const int dy = y - this->rect.ymin;
@@ -173,84 +173,84 @@ void MemoryBuffer::readCubic(float result[4], float x, float y)
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;
+ 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
#define EWA_MAXIDX 255
-static float EWA_WTS[EWA_MAXIDX + 1] =
-{ 1.f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, 0.938216f, 0.929664f,
- 0.921178f, 0.912759f, 0.904405f, 0.896117f, 0.887893f, 0.879734f, 0.871638f, 0.863605f,
- 0.855636f, 0.847728f, 0.839883f, 0.832098f, 0.824375f, 0.816712f, 0.809108f, 0.801564f,
- 0.794079f, 0.786653f, 0.779284f, 0.771974f, 0.76472f, 0.757523f, 0.750382f, 0.743297f,
- 0.736267f, 0.729292f, 0.722372f, 0.715505f, 0.708693f, 0.701933f, 0.695227f, 0.688572f,
- 0.68197f, 0.67542f, 0.66892f, 0.662471f, 0.656073f, 0.649725f, 0.643426f, 0.637176f,
- 0.630976f, 0.624824f, 0.618719f, 0.612663f, 0.606654f, 0.600691f, 0.594776f, 0.588906f,
- 0.583083f, 0.577305f, 0.571572f, 0.565883f, 0.56024f, 0.55464f, 0.549084f, 0.543572f,
- 0.538102f, 0.532676f, 0.527291f, 0.521949f, 0.516649f, 0.511389f, 0.506171f, 0.500994f,
- 0.495857f, 0.490761f, 0.485704f, 0.480687f, 0.475709f, 0.470769f, 0.465869f, 0.461006f,
- 0.456182f, 0.451395f, 0.446646f, 0.441934f, 0.437258f, 0.432619f, 0.428017f, 0.42345f,
- 0.418919f, 0.414424f, 0.409963f, 0.405538f, 0.401147f, 0.39679f, 0.392467f, 0.388178f,
- 0.383923f, 0.379701f, 0.375511f, 0.371355f, 0.367231f, 0.363139f, 0.359079f, 0.355051f,
- 0.351055f, 0.347089f, 0.343155f, 0.339251f, 0.335378f, 0.331535f, 0.327722f, 0.323939f,
- 0.320186f, 0.316461f, 0.312766f, 0.3091f, 0.305462f, 0.301853f, 0.298272f, 0.294719f,
- 0.291194f, 0.287696f, 0.284226f, 0.280782f, 0.277366f, 0.273976f, 0.270613f, 0.267276f,
- 0.263965f, 0.26068f, 0.257421f, 0.254187f, 0.250979f, 0.247795f, 0.244636f, 0.241502f,
- 0.238393f, 0.235308f, 0.232246f, 0.229209f, 0.226196f, 0.223206f, 0.220239f, 0.217296f,
- 0.214375f, 0.211478f, 0.208603f, 0.20575f, 0.20292f, 0.200112f, 0.197326f, 0.194562f,
- 0.191819f, 0.189097f, 0.186397f, 0.183718f, 0.18106f, 0.178423f, 0.175806f, 0.17321f,
- 0.170634f, 0.168078f, 0.165542f, 0.163026f, 0.16053f, 0.158053f, 0.155595f, 0.153157f,
- 0.150738f, 0.148337f, 0.145955f, 0.143592f, 0.141248f, 0.138921f, 0.136613f, 0.134323f,
- 0.132051f, 0.129797f, 0.12756f, 0.125341f, 0.123139f, 0.120954f, 0.118786f, 0.116635f,
- 0.114501f, 0.112384f, 0.110283f, 0.108199f, 0.106131f, 0.104079f, 0.102043f, 0.100023f,
- 0.0980186f, 0.09603f, 0.094057f, 0.0920994f, 0.0901571f, 0.08823f, 0.0863179f, 0.0844208f,
- 0.0825384f, 0.0806708f, 0.0788178f, 0.0769792f, 0.0751551f, 0.0733451f, 0.0715493f, 0.0697676f,
- 0.0679997f, 0.0662457f, 0.0645054f, 0.0627786f, 0.0610654f, 0.0593655f, 0.0576789f, 0.0560055f,
- 0.0543452f, 0.0526979f, 0.0510634f, 0.0494416f, 0.0478326f, 0.0462361f, 0.0446521f, 0.0430805f,
- 0.0415211f, 0.039974f, 0.0384389f, 0.0369158f, 0.0354046f, 0.0339052f, 0.0324175f, 0.0309415f,
- 0.029477f, 0.0280239f, 0.0265822f, 0.0251517f, 0.0237324f, 0.0223242f, 0.020927f, 0.0195408f,
- 0.0181653f, 0.0168006f, 0.0154466f, 0.0141031f, 0.0127701f, 0.0114476f, 0.0101354f, 0.00883339f,
- 0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f
+static float EWA_WTS[EWA_MAXIDX + 1] = {
+ 1.f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, 0.938216f, 0.929664f,
+ 0.921178f, 0.912759f, 0.904405f, 0.896117f, 0.887893f, 0.879734f, 0.871638f, 0.863605f,
+ 0.855636f, 0.847728f, 0.839883f, 0.832098f, 0.824375f, 0.816712f, 0.809108f, 0.801564f,
+ 0.794079f, 0.786653f, 0.779284f, 0.771974f, 0.76472f, 0.757523f, 0.750382f, 0.743297f,
+ 0.736267f, 0.729292f, 0.722372f, 0.715505f, 0.708693f, 0.701933f, 0.695227f, 0.688572f,
+ 0.68197f, 0.67542f, 0.66892f, 0.662471f, 0.656073f, 0.649725f, 0.643426f, 0.637176f,
+ 0.630976f, 0.624824f, 0.618719f, 0.612663f, 0.606654f, 0.600691f, 0.594776f, 0.588906f,
+ 0.583083f, 0.577305f, 0.571572f, 0.565883f, 0.56024f, 0.55464f, 0.549084f, 0.543572f,
+ 0.538102f, 0.532676f, 0.527291f, 0.521949f, 0.516649f, 0.511389f, 0.506171f, 0.500994f,
+ 0.495857f, 0.490761f, 0.485704f, 0.480687f, 0.475709f, 0.470769f, 0.465869f, 0.461006f,
+ 0.456182f, 0.451395f, 0.446646f, 0.441934f, 0.437258f, 0.432619f, 0.428017f, 0.42345f,
+ 0.418919f, 0.414424f, 0.409963f, 0.405538f, 0.401147f, 0.39679f, 0.392467f, 0.388178f,
+ 0.383923f, 0.379701f, 0.375511f, 0.371355f, 0.367231f, 0.363139f, 0.359079f, 0.355051f,
+ 0.351055f, 0.347089f, 0.343155f, 0.339251f, 0.335378f, 0.331535f, 0.327722f, 0.323939f,
+ 0.320186f, 0.316461f, 0.312766f, 0.3091f, 0.305462f, 0.301853f, 0.298272f, 0.294719f,
+ 0.291194f, 0.287696f, 0.284226f, 0.280782f, 0.277366f, 0.273976f, 0.270613f, 0.267276f,
+ 0.263965f, 0.26068f, 0.257421f, 0.254187f, 0.250979f, 0.247795f, 0.244636f, 0.241502f,
+ 0.238393f, 0.235308f, 0.232246f, 0.229209f, 0.226196f, 0.223206f, 0.220239f, 0.217296f,
+ 0.214375f, 0.211478f, 0.208603f, 0.20575f, 0.20292f, 0.200112f, 0.197326f, 0.194562f,
+ 0.191819f, 0.189097f, 0.186397f, 0.183718f, 0.18106f, 0.178423f, 0.175806f, 0.17321f,
+ 0.170634f, 0.168078f, 0.165542f, 0.163026f, 0.16053f, 0.158053f, 0.155595f, 0.153157f,
+ 0.150738f, 0.148337f, 0.145955f, 0.143592f, 0.141248f, 0.138921f, 0.136613f, 0.134323f,
+ 0.132051f, 0.129797f, 0.12756f, 0.125341f, 0.123139f, 0.120954f, 0.118786f, 0.116635f,
+ 0.114501f, 0.112384f, 0.110283f, 0.108199f, 0.106131f, 0.104079f, 0.102043f, 0.100023f,
+ 0.0980186f, 0.09603f, 0.094057f, 0.0920994f, 0.0901571f, 0.08823f, 0.0863179f, 0.0844208f,
+ 0.0825384f, 0.0806708f, 0.0788178f, 0.0769792f, 0.0751551f, 0.0733451f, 0.0715493f, 0.0697676f,
+ 0.0679997f, 0.0662457f, 0.0645054f, 0.0627786f, 0.0610654f, 0.0593655f, 0.0576789f, 0.0560055f,
+ 0.0543452f, 0.0526979f, 0.0510634f, 0.0494416f, 0.0478326f, 0.0462361f, 0.0446521f, 0.0430805f,
+ 0.0415211f, 0.039974f, 0.0384389f, 0.0369158f, 0.0354046f, 0.0339052f, 0.0324175f, 0.0309415f,
+ 0.029477f, 0.0280239f, 0.0265822f, 0.0251517f, 0.0237324f, 0.0223242f, 0.020927f, 0.0195408f,
+ 0.0181653f, 0.0168006f, 0.0154466f, 0.0141031f, 0.0127701f, 0.0114476f, 0.0101354f, 0.00883339f,
+ 0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f
};
static void radangle2imp(float a2, float b2, float th, float *A, float *B, float *C, float *F)
{
float ct2 = cosf(th);
- const float st2 = 1.f - ct2*ct2; // <- sin(th)^2
+ const float st2 = 1.f - ct2 * ct2; // <- sin(th)^2
ct2 *= ct2;
- *A = a2*st2 + b2*ct2;
- *B = (b2 - a2)*sinf(2.f*th);
- *C = a2*ct2 + b2*st2;
- *F = a2*b2;
+ *A = a2 * st2 + b2 * ct2;
+ *B = (b2 - a2) * sinf(2.f * th);
+ *C = a2 * ct2 + b2 * st2;
+ *F = a2 * b2;
}
// all tests here are done to make sure possible overflows are hopefully minimized
static void imp2radangle(float A, float B, float C, float F, float *a, float *b, float *th, float *ecc)
{
- if (F <= 1e-5f) { // use arbitrary major radius, zero minor, infinite eccentricity
+ if (F <= 1e-5f) { // use arbitrary major radius, zero minor, infinite eccentricity
*a = sqrtf(A > C ? A : C);
*b = 0.f;
*ecc = 1e10f;
- *th = 0.5f*(atan2f(B, A - C) + (float)M_PI);
+ *th = 0.5f * (atan2f(B, A - C) + (float)M_PI);
}
else {
- const float AmC = A - C, ApC = A + C, F2 = F*2.f;
- const float r = sqrtf(AmC*AmC + B*B);
+ const float AmC = A - C, ApC = A + C, F2 = F * 2.f;
+ const float r = sqrtf(AmC * AmC + B * B);
float d = ApC - r;
*a = (d <= 0.f) ? sqrtf(A > C ? A : C) : sqrtf(F2 / d);
d = ApC + r;
@@ -263,7 +263,7 @@ static void imp2radangle(float A, float B, float C, float F, float *a, float *b,
*ecc = *a / *b;
}
// incr theta by 0.5*pi (angle of major axis)
- *th = 0.5f*(atan2f(B, AmC) + (float)M_PI);
+ *th = 0.5f * (atan2f(B, AmC) + (float)M_PI);
}
}
@@ -280,11 +280,11 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
// scaling dxt/dyt by full resolution can cause overflow because of huge A/B/C and esp. F values,
// scaling by aspect ratio alone does the opposite, so try something in between instead...
const float ff2 = width, ff = sqrtf(ff2), q = height / ff;
- const float Ux = dx*ff, Vx = dx*q, Uy = dy*ff, Vy = dy*q;
- float A = Vx*Vx + Vy*Vy;
- float B = -2.f*(Ux*Vx + Uy*Vy);
- float C = Ux*Ux + Uy*Uy;
- float F = A*C - B*B*0.25f;
+ const float Ux = dx * ff, Vx = dx * q, Uy = dy * ff, Vy = dy * q;
+ float A = Vx * Vx + Vy * Vy;
+ float B = -2.f * (Ux * Vx + Uy * Vy);
+ float C = Ux * Ux + Uy * Uy;
+ float F = A * C - B * B * 0.25f;
float a, b, th, ecc, a2, b2, ue, ve, U0, V0, DDQ, U, ac1, ac2, BU, d;
int u, v, u1, u2, v1, v2;
// The so-called 'high' quality ewa method simply adds a constant of 1 to both A & C,
@@ -294,13 +294,13 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
// Use a different radius based on interpolation switch, just enough to anti-alias when interpolation is off,
// and slightly larger to make result a bit smoother than bilinear interpolation when interpolation is on
// (minimum values: const float rmin = intpol ? 1.f : 0.5f;)
- const float rmin = 1.5625f/ff2;
+ const float rmin = 1.5625f / ff2;
imp2radangle(A, B, C, F, &a, &b, &th, &ecc);
- if ((b2 = b*b) < rmin) {
- if ((a2 = a*a) < rmin) {
+ if ((b2 = b * b) < rmin) {
+ if ((a2 = a * a) < rmin) {
B = 0.f;
A = C = rmin;
- F = A*C;
+ F = A * C;
}
else {
b2 = rmin;
@@ -308,9 +308,9 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
}
}
- ue = ff*sqrtf(C);
- ve = ff*sqrtf(A);
- d = (float)(EWA_MAXIDX + 1) / (F*ff2);
+ ue = ff * sqrtf(C);
+ ve = ff * sqrtf(A);
+ d = (float)(EWA_MAXIDX + 1) / (F * ff2);
A *= d;
B *= d;
C *= d;
@@ -323,24 +323,24 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
v2 = (int)(ceilf(V0 + ve));
U0 -= 0.5f;
V0 -= 0.5f;
- DDQ = 2.f*A;
+ DDQ = 2.f * A;
U = u1 - U0;
- ac1 = A*(2.f*U + 1.f);
- ac2 = A*U*U;
- BU = B*U;
+ ac1 = A * (2.f * U + 1.f);
+ ac2 = A * U * U;
+ BU = B * U;
d = result[0] = result[1] = result[2] = result[3] = 0.f;
- for (v=v1; v<=v2; ++v) {
+ for (v = v1; v <= v2; ++v) {
const float V = v - V0;
- float DQ = ac1 + B*V;
- float Q = (C*V + BU)*V + ac2;
- for (u=u1; u<=u2; ++u) {
+ float DQ = ac1 + B * V;
+ float Q = (C * V + BU) * V + ac2;
+ for (u = u1; u <= u2; ++u) {
if (Q < (float)(EWA_MAXIDX + 1)) {
float tc[4];
const float wt = EWA_WTS[(Q < 0.f) ? 0 : (unsigned int)Q];
read(tc, clipuv(u, width), clipuv(v, height));
madd_v3_v3fl(result, tc, wt);
- result[3] += result[3] ? tc[3]*wt : 0.f;
+ result[3] += result[3] ? tc[3] * wt : 0.f;
d += wt;
}
Q += DQ;
@@ -349,10 +349,10 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
}
// d should hopefully never be zero anymore
- d = 1.f/d;
+ d = 1.f / d;
result[0] *= d;
result[1] *= d;
result[2] *= d;
// clipping can be ignored if alpha used, texr->ta already includes filtered edge
- result[3] = result[3] ? result[3] *d : 1.f;
+ result[3] = result[3] ? result[3] * d : 1.f;
}
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index 2324eacd26c..a65849901ed 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -20,11 +20,12 @@
* Monique Dewanchand
*/
-#include "COM_Node.h"
-#include "string.h"
+#include <string.h>
-#include "COM_NodeOperation.h"
#include "BKE_node.h"
+
+#include "COM_Node.h"
+#include "COM_NodeOperation.h"
#include "COM_SetValueOperation.h"
#include "COM_SetVectorOperation.h"
#include "COM_SetColorOperation.h"
@@ -35,7 +36,7 @@
#include "COM_SocketProxyNode.h"
-//#include "stdio.h"
+//#include <stdio.h>
#include "COM_defines.h"
Node::Node(bNode *editorNode, bool create_sockets)
@@ -43,23 +44,23 @@ Node::Node(bNode *editorNode, bool create_sockets)
this->editorNode = editorNode;
if (create_sockets) {
- bNodeSocket * input = (bNodeSocket*)editorNode->inputs.first;
+ bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first;
while (input != NULL) {
DataType dt = COM_DT_VALUE;
if (input->type == SOCK_RGBA) dt = COM_DT_COLOR;
if (input->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
this->addInputSocket(dt, (InputSocketResizeMode)input->resizemode, input);
- input = (bNodeSocket*)input->next;
+ input = (bNodeSocket *)input->next;
}
- bNodeSocket *output = (bNodeSocket*)editorNode->outputs.first;
+ bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first;
while (output != NULL) {
DataType dt = COM_DT_VALUE;
if (output->type == SOCK_RGBA) dt = COM_DT_COLOR;
if (output->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
this->addOutputSocket(dt, output);
- output = (bNodeSocket*)output->next;
+ output = (bNodeSocket *)output->next;
}
}
}
@@ -75,9 +76,9 @@ bNode *Node::getbNode()
void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
+ bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
SetValueOperation *operation = new SetValueOperation();
- bNodeSocketValueFloat *val = (bNodeSocketValueFloat*)bSock->default_value;
+ bNodeSocketValueFloat *val = (bNodeSocketValueFloat *)bSock->default_value;
operation->setValue(val->value);
this->addLink(graph, operation->getOutputSocket(), inputsocket);
graph->addOperation(operation);
@@ -118,9 +119,9 @@ SocketConnection *Node::addLink(ExecutionSystem *graph, OutputSocket *outputSock
void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
+ bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
SetColorOperation *operation = new SetColorOperation();
- bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA*)bSock->default_value;
+ bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA *)bSock->default_value;
operation->setChannel1(val->value[0]);
operation->setChannel2(val->value[1]);
operation->setChannel3(val->value[2]);
@@ -131,8 +132,8 @@ void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket
void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
- bNodeSocketValueVector *val = (bNodeSocketValueVector*)bSock->default_value;
+ bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
+ bNodeSocketValueVector *val = (bNodeSocketValueVector *)bSock->default_value;
SetVectorOperation *operation = new SetVectorOperation();
operation->setX(val->value[0]);
operation->setY(val->value[1]);
@@ -143,7 +144,7 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocke
bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->inputs.first;
+ bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first;
int index = 0;
while (bSock != NULL) {
if (index == editorNodeInputSocketIndex) {
@@ -156,7 +157,7 @@ bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
}
bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->outputs.first;
+ bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->outputs.first;
int index = 0;
while (bSock != NULL) {
if (index == editorNodeInputSocketIndex) {
@@ -170,9 +171,9 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex)
InputSocket *Node::findInputSocketBybNodeSocket(bNodeSocket *socket)
{
- vector<InputSocket*> &inputsockets = this->getInputSockets();
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
unsigned int index;
- for (index = 0 ; index < inputsockets.size(); index ++) {
+ for (index = 0; index < inputsockets.size(); index++) {
InputSocket *input = inputsockets[index];
if (input->getbNodeSocket() == socket) {
return input;
@@ -183,9 +184,9 @@ InputSocket *Node::findInputSocketBybNodeSocket(bNodeSocket *socket)
OutputSocket *Node::findOutputSocketBybNodeSocket(bNodeSocket *socket)
{
- vector<OutputSocket*> &outputsockets = this->getOutputSockets();
+ vector<OutputSocket *> &outputsockets = this->getOutputSockets();
unsigned int index;
- for (index = 0 ; index < outputsockets.size(); index ++) {
+ for (index = 0; index < outputsockets.size(); index++) {
OutputSocket *output = outputsockets[index];
if (output->getbNodeSocket() == socket) {
return output;
diff --git a/source/blender/compositor/intern/COM_NodeBase.cpp b/source/blender/compositor/intern/COM_NodeBase.cpp
index 5ffe9bdd26a..1a895cf93b1 100644
--- a/source/blender/compositor/intern/COM_NodeBase.cpp
+++ b/source/blender/compositor/intern/COM_NodeBase.cpp
@@ -20,10 +20,12 @@
* Monique Dewanchand
*/
+#include <string.h>
+
+#include "BKE_node.h"
+
#include "COM_NodeBase.h"
-#include "string.h"
#include "COM_NodeOperation.h"
-#include "BKE_node.h"
#include "COM_SetValueOperation.h"
#include "COM_SetColorOperation.h"
#include "COM_SocketConnection.h"
@@ -31,6 +33,7 @@
NodeBase::NodeBase()
{
+ /* pass */
}
@@ -80,12 +83,14 @@ const bool NodeBase::isInputNode() const
return this->inputsockets.size() == 0;
}
-OutputSocket *NodeBase::getOutputSocket(int index)
+OutputSocket *NodeBase::getOutputSocket(unsigned int index)
{
+ BLI_assert(index < this->outputsockets.size());
return this->outputsockets[index];
}
-InputSocket *NodeBase::getInputSocket(int index)
+InputSocket *NodeBase::getInputSocket(unsigned int index)
{
+ BLI_assert(index < this->inputsockets.size());
return this->inputsockets[index];
}
diff --git a/source/blender/compositor/intern/COM_NodeBase.h b/source/blender/compositor/intern/COM_NodeBase.h
index 5e3a4fa5531..54f80926b84 100644
--- a/source/blender/compositor/intern/COM_NodeBase.h
+++ b/source/blender/compositor/intern/COM_NodeBase.h
@@ -103,7 +103,7 @@ public:
* @param index
* the index of the needed outputsocket
*/
- OutputSocket *getOutputSocket(const int index);
+ OutputSocket *getOutputSocket(const unsigned int index);
/**
* get the reference to the first outputsocket
@@ -117,7 +117,7 @@ public:
* @param index
* the index of the needed inputsocket
*/
- InputSocket *getInputSocket(const int index);
+ InputSocket *getInputSocket(const unsigned int index);
virtual bool isStatic() const { return false; }
diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp
index 148ad48ba3a..ac0f206846c 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperation.cpp
@@ -20,12 +20,13 @@
* Monique Dewanchand
*/
-#include "COM_NodeOperation.h"
#include <typeinfo>
+#include <stdio.h>
+
+#include "COM_NodeOperation.h"
#include "COM_InputSocket.h"
#include "COM_SocketConnection.h"
#include "COM_defines.h"
-#include "stdio.h"
NodeOperation::NodeOperation()
{
@@ -41,9 +42,9 @@ void NodeOperation::determineResolution(unsigned int resolution[], unsigned int
{
unsigned int temp[2];
unsigned int temp2[2];
- vector<InputSocket*> &inputsockets = this->getInputSockets();
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
- for (unsigned int index = 0 ; index < inputsockets.size();index++) {
+ for (unsigned int index = 0; index < inputsockets.size(); index++) {
InputSocket *inputSocket = inputsockets[index];
if (inputSocket->isConnected()) {
if (index == this->resolutionInputSocketIndex) {
@@ -54,7 +55,7 @@ void NodeOperation::determineResolution(unsigned int resolution[], unsigned int
}
}
}
- for (unsigned int index = 0 ; index < inputsockets.size();index++) {
+ for (unsigned int index = 0; index < inputsockets.size(); index++) {
InputSocket *inputSocket = inputsockets[index];
if (inputSocket->isConnected()) {
if (index != resolutionInputSocketIndex) {
@@ -69,6 +70,7 @@ void NodeOperation::setResolutionInputSocketIndex(unsigned int index)
}
void NodeOperation::initExecution()
{
+ /* pass */
}
void NodeOperation::initMutex()
@@ -93,6 +95,7 @@ void NodeOperation::deinitMutex()
void NodeOperation::deinitExecution()
{
+ /* pass */
}
SocketReader *NodeOperation::getInputSocketReader(unsigned int inputSocketIndex)
{
@@ -103,10 +106,10 @@ NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex)
return this->getInputSocket(inputSocketIndex)->getOperation();
}
-void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets)
+void NodeOperation::getConnectedInputSockets(vector<InputSocket *> *sockets)
{
- vector<InputSocket*> &inputsockets = this->getInputSockets();
- for (vector<InputSocket*>::iterator iterator = inputsockets.begin() ; iterator!= inputsockets.end() ; iterator++) {
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
+ for (vector<InputSocket *>::iterator iterator = inputsockets.begin(); iterator != inputsockets.end(); iterator++) {
InputSocket *socket = *iterator;
if (socket->isConnected()) {
sockets->push_back(socket);
@@ -114,7 +117,7 @@ void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets)
}
}
-bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
+bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
if (this->isInputNode()) {
BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
@@ -122,12 +125,12 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOpe
}
else {
unsigned int index;
- vector<InputSocket*> &inputsockets = this->getInputSockets();
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
- for (index = 0 ; index < inputsockets.size() ; index++) {
+ for (index = 0; index < inputsockets.size(); index++) {
InputSocket *inputsocket = inputsockets[index];
if (inputsocket->isConnected()) {
- NodeOperation *inputoperation = (NodeOperation*)inputsocket->getConnection()->getFromNode();
+ NodeOperation *inputoperation = (NodeOperation *)inputsocket->getConnection()->getFromNode();
bool result = inputoperation->determineDependingAreaOfInterest(input, readOperation, output);
if (result) {
return true;
@@ -138,24 +141,24 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOpe
}
}
-cl_mem NodeOperation::COM_clAttachMemoryBufferToKernelParameter(cl_context context, cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader* reader)
+cl_mem NodeOperation::COM_clAttachMemoryBufferToKernelParameter(cl_context context, cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader)
{
cl_int error;
- MemoryBuffer* result = (MemoryBuffer*)reader->initializeTileData(NULL, inputMemoryBuffers);
+ MemoryBuffer *result = (MemoryBuffer *)reader->initializeTileData(NULL, inputMemoryBuffers);
const cl_image_format imageFormat = {
CL_RGBA,
CL_FLOAT
};
- cl_mem clBuffer = clCreateImage2D(context, CL_MEM_READ_ONLY|CL_MEM_USE_HOST_PTR, &imageFormat, result->getWidth(),
+ cl_mem clBuffer = clCreateImage2D(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, &imageFormat, result->getWidth(),
result->getHeight(), 0, result->getBuffer(), &error);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
if (error == CL_SUCCESS) cleanup->push_back(clBuffer);
error = clSetKernelArg(kernel, parameterIndex, sizeof(cl_mem), &clBuffer);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
COM_clAttachMemoryBufferOffsetToKernelParameter(kernel, offsetIndex, result);
return clBuffer;
@@ -165,11 +168,11 @@ void NodeOperation::COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel ke
{
if (offsetIndex != -1) {
cl_int error;
- rcti* rect = memoryBuffer->getRect();
+ rcti *rect = memoryBuffer->getRect();
cl_int2 offset = {rect->xmin, rect->ymin};
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
}
}
@@ -180,7 +183,7 @@ void NodeOperation::COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offs
cl_int2 offset = {this->getWidth(), this->getHeight()};
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
}
}
@@ -193,10 +196,10 @@ void NodeOperation::COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel ke
void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel, MemoryBuffer *outputMemoryBuffer) {
cl_int error;
- const size_t size[] = {outputMemoryBuffer->getWidth(),outputMemoryBuffer->getHeight()};
+ const size_t size[] = {outputMemoryBuffer->getWidth(), outputMemoryBuffer->getHeight()};
error = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, size, 0, 0, 0, NULL);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
}
void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel, MemoryBuffer *outputMemoryBuffer, int offsetIndex) {
@@ -210,17 +213,19 @@ void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel,
cl_int2 offset;
bool breaked = false;
- for (offsety = 0 ; offsety < height && (!breaked); offsety+=localSize) {
+ for (offsety = 0; offsety < height && (!breaked); offsety += localSize) {
offset[1] = offsety;
- if (offsety+localSize < height) {
+ if (offsety + localSize < height) {
size[1] = localSize;
- } else {
+ }
+ else {
size[1] = height - offsety;
}
- for (offsetx = 0 ; offsetx < width && (!breaked) ; offsetx+=localSize) {
- if (offsetx+localSize < width) {
+ for (offsetx = 0; offsetx < width && (!breaked); offsetx += localSize) {
+ if (offsetx + localSize < width) {
size[0] = localSize;
- } else {
+ }
+ else {
size[0] = width - offsetx;
}
offset[0] = offsetx;
@@ -228,7 +233,7 @@ void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel,
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
error = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, size, 0, 0, 0, NULL);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
clFlush(queue);
if (isBreaked()) {
breaked = false;
@@ -240,9 +245,8 @@ void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel,
cl_kernel NodeOperation::COM_clCreateKernel(cl_program program, const char *kernelname, list<cl_kernel> *clKernelsToCleanUp)
{
cl_int error;
- cl_kernel kernel = clCreateKernel(program, kernelname, &error) ;
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
- }
+ cl_kernel kernel = clCreateKernel(program, kernelname, &error);
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
else {
if (clKernelsToCleanUp) clKernelsToCleanUp->push_back(kernel);
}
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
index e6d3789b06d..9d005804098 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
@@ -49,12 +49,12 @@ void OpenCLDevice::deinitialize()
void OpenCLDevice::execute(WorkPackage *work)
{
const unsigned int chunkNumber = work->getChunkNumber();
- ExecutionGroup * executionGroup = work->getExecutionGroup();
+ ExecutionGroup *executionGroup = work->getExecutionGroup();
rcti rect;
executionGroup->determineChunkRect(&rect, chunkNumber);
- MemoryBuffer ** inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber);
- MemoryBuffer * outputBuffer = executionGroup->allocateOutputBuffer(chunkNumber, &rect);
+ MemoryBuffer **inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber);
+ MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(chunkNumber, &rect);
executionGroup->getOutputNodeOperation()->executeOpenCLRegion(this->context, this->program, this->queue, &rect,
chunkNumber, inputBuffers, outputBuffer);
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h
index 75c326eda23..83ce8cec811 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.h
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.h
@@ -37,29 +37,29 @@ class OpenCLDevice;
class OpenCLDevice : public Device {
private:
/**
- *@brief opencl context
+ * @brief opencl context
*/
cl_context context;
/**
- *@brief opencl device
+ * @brief opencl device
*/
cl_device_id device;
/**
- *@brief opencl program
+ * @brief opencl program
*/
cl_program program;
/**
- *@brief opencl command queue
+ * @brief opencl command queue
*/
cl_command_queue queue;
public:
/**
- *@brief constructor with opencl device
- *@param context
- *@param device
+ * @brief constructor with opencl device
+ * @param context
+ * @param device
*/
OpenCLDevice(cl_context context, cl_device_id device, cl_program program);
diff --git a/source/blender/compositor/intern/COM_OutputSocket.cpp b/source/blender/compositor/intern/COM_OutputSocket.cpp
index 77bad3c006f..484254fe6de 100644
--- a/source/blender/compositor/intern/COM_OutputSocket.cpp
+++ b/source/blender/compositor/intern/COM_OutputSocket.cpp
@@ -25,22 +25,24 @@
#include "COM_SocketConnection.h"
#include "COM_NodeOperation.h"
-OutputSocket::OutputSocket(DataType datatype) :Socket(datatype)
+OutputSocket::OutputSocket(DataType datatype) : Socket(datatype)
{
+ /* pass */
}
int OutputSocket::isOutputSocket() const { return true; }
-const int OutputSocket::isConnected() const { return this->connections.size()!=0; }
+const int OutputSocket::isConnected() const { return this->connections.size() != 0; }
void OutputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
NodeBase *node = this->getNode();
if (node->isOperation()) {
- NodeOperation *operation = (NodeOperation*)node;
+ NodeOperation *operation = (NodeOperation *)node;
if (operation->isResolutionSet()) {
resolution[0] = operation->getWidth();
resolution[1] = operation->getHeight();
- } else {
+ }
+ else {
operation->determineResolution(resolution, preferredResolution);
operation->setResolution(resolution);
}
@@ -63,7 +65,7 @@ void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single)
}
else {
unsigned int index;
- for (index = 0 ; index < this->connections.size();index ++) {
+ for (index = 0; index < this->connections.size(); index++) {
SocketConnection *connection = this->connections[index];
connection->setFromSocket(relinkToSocket);
relinkToSocket->addConnection(connection);
@@ -92,13 +94,13 @@ void OutputSocket::clearConnections()
WriteBufferOperation *OutputSocket::findAttachedWriteBufferOperation() const
{
unsigned int index;
- for (index = 0 ; index < this->connections.size();index++) {
+ for (index = 0; index < this->connections.size(); index++) {
SocketConnection *connection = this->connections[index];
NodeBase *node = connection->getToNode();
if (node->isOperation()) {
- NodeOperation *operation = (NodeOperation*)node;
+ NodeOperation *operation = (NodeOperation *)node;
if (operation->isWriteBufferOperation()) {
- return (WriteBufferOperation*)operation;
+ return (WriteBufferOperation *)operation;
}
}
}
diff --git a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
index 9ea90809de4..01043664412 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_SingleThreadedNodeOperation.h"
-SingleThreadedNodeOperation::SingleThreadedNodeOperation(): NodeOperation()
+SingleThreadedNodeOperation::SingleThreadedNodeOperation() : NodeOperation()
{
this->cachedInstance = NULL;
setComplex(true);
diff --git a/source/blender/compositor/intern/COM_Socket.cpp b/source/blender/compositor/intern/COM_Socket.cpp
index af9ad1967a5..11739a4e9c5 100644
--- a/source/blender/compositor/intern/COM_Socket.cpp
+++ b/source/blender/compositor/intern/COM_Socket.cpp
@@ -38,6 +38,6 @@ DataType Socket::getDataType() const
int Socket::isInputSocket() const { return false; }
int Socket::isOutputSocket() const { return false; }
-const int Socket::isConnected() const {return false;}
-void Socket::setNode(NodeBase *node) {this->node = node;}
-NodeBase *Socket::getNode() const {return this->node;}
+const int Socket::isConnected() const { return false; }
+void Socket::setNode(NodeBase *node) { this->node = node; }
+NodeBase *Socket::getNode() const { return this->node; }
diff --git a/source/blender/compositor/intern/COM_SocketConnection.cpp b/source/blender/compositor/intern/COM_SocketConnection.cpp
index 9f0c736392a..1edeb6158b9 100644
--- a/source/blender/compositor/intern/COM_SocketConnection.cpp
+++ b/source/blender/compositor/intern/COM_SocketConnection.cpp
@@ -38,7 +38,7 @@ void SocketConnection::setFromSocket(OutputSocket *fromsocket)
this->fromSocket = fromsocket;
}
-OutputSocket *SocketConnection::getFromSocket() const {return this->fromSocket;}
+OutputSocket *SocketConnection::getFromSocket() const { return this->fromSocket; }
void SocketConnection::setToSocket(InputSocket *tosocket)
{
if (tosocket == NULL) {
@@ -47,7 +47,7 @@ void SocketConnection::setToSocket(InputSocket *tosocket)
this->toSocket = tosocket;
}
-InputSocket *SocketConnection::getToSocket() const {return this->toSocket;}
+InputSocket *SocketConnection::getToSocket() const { return this->toSocket; }
NodeBase *SocketConnection::getFromNode() const
{
@@ -79,10 +79,10 @@ bool SocketConnection::isValid() const
bool SocketConnection::needsResolutionConversion() const
{
- if (this->ignoreResizeCheck) {return false;}
- NodeOperation *fromOperation = (NodeOperation*)this->getFromNode();
- NodeOperation *toOperation = (NodeOperation*)this->getToNode();
- if (this->toSocket->getResizeMode() == COM_SC_NO_RESIZE) {return false;}
+ if (this->ignoreResizeCheck) { return false; }
+ NodeOperation *fromOperation = (NodeOperation *)this->getFromNode();
+ NodeOperation *toOperation = (NodeOperation *)this->getToNode();
+ if (this->toSocket->getResizeMode() == COM_SC_NO_RESIZE) { return false; }
const unsigned int fromWidth = fromOperation->getWidth();
const unsigned int fromHeight = fromOperation->getHeight();
const unsigned int toWidth = toOperation->getWidth();
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index ba8bfe55310..a410c28f47d 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -21,15 +21,18 @@
*/
#include <list>
+#include <stdio.h>
+
+#include "BKE_global.h"
+
#include "COM_WorkScheduler.h"
-#include "PIL_time.h"
-#include "BLI_threads.h"
#include "COM_CPUDevice.h"
#include "COM_OpenCLDevice.h"
-#include "OCL_opencl.h"
-#include "stdio.h"
#include "COM_OpenCLKernels.cl.h"
-#include "BKE_global.h"
+#include "OCL_opencl.h"
+
+#include "PIL_time.h"
+#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.
@@ -40,19 +43,19 @@
/// @brief list of all CPUDevices. for every hardware thread an instance of CPUDevice is created
-static vector<CPUDevice*> cpudevices;
+static vector<CPUDevice *> cpudevices;
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
/// @brief list of all thread for every CPUDevice in cpudevices a thread exists
static ListBase cputhreads;
/// @brief all scheduled work for the cpu
-static ThreadQueue * cpuqueue;
-static ThreadQueue * gpuqueue;
+static ThreadQueue *cpuqueue;
+static ThreadQueue *gpuqueue;
#ifdef COM_OPENCL_ENABLED
static cl_context context;
static cl_program program;
/// @brief list of all OpenCLDevices. for every OpenCL GPU device an instance of OpenCLDevice is created
-static vector<OpenCLDevice*> gpudevices;
+static vector<OpenCLDevice *> gpudevices;
/// @brief list of all thread for every GPUDevice in cpudevices a thread exists
static ListBase gputhreads;
/// @brief all scheduled work for the gpu
@@ -66,10 +69,10 @@ static bool openclActive = false;
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
void *WorkScheduler::thread_execute_cpu(void *data)
{
- Device *device = (Device*)data;
+ Device *device = (Device *)data;
WorkPackage *work;
- while ((work = (WorkPackage*)BLI_thread_queue_pop(cpuqueue))) {
+ while ((work = (WorkPackage *)BLI_thread_queue_pop(cpuqueue))) {
device->execute(work);
delete work;
}
@@ -79,10 +82,10 @@ void *WorkScheduler::thread_execute_cpu(void *data)
void *WorkScheduler::thread_execute_gpu(void *data)
{
- Device *device = (Device*)data;
+ Device *device = (Device *)data;
WorkPackage *work;
- while ((work = (WorkPackage*)BLI_thread_queue_pop(gpuqueue))) {
+ while ((work = (WorkPackage *)BLI_thread_queue_pop(gpuqueue))) {
device->execute(work);
delete work;
}
@@ -120,7 +123,7 @@ void WorkScheduler::start(CompositorContext &context)
unsigned int index;
cpuqueue = BLI_thread_queue_init();
BLI_init_threads(&cputhreads, thread_execute_cpu, cpudevices.size());
- for (index = 0 ; index < cpudevices.size() ; index ++) {
+ for (index = 0; index < cpudevices.size(); index++) {
Device *device = cpudevices[index];
BLI_insert_thread(&cputhreads, device);
}
@@ -128,7 +131,7 @@ void WorkScheduler::start(CompositorContext &context)
if (context.getHasActiveOpenCLDevices()) {
gpuqueue = BLI_thread_queue_init();
BLI_init_threads(&gputhreads, thread_execute_gpu, gpudevices.size());
- for (index = 0 ; index < gpudevices.size() ; index ++) {
+ for (index = 0; index < gpudevices.size(); index++) {
Device *device = gpudevices[index];
BLI_insert_thread(&gputhreads, device);
}
@@ -178,7 +181,7 @@ bool WorkScheduler::hasGPUDevices()
{
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
#ifdef COM_OPENCL_ENABLED
- return gpudevices.size()>0;
+ return gpudevices.size() > 0;
#else
return 0;
#endif
@@ -197,7 +200,7 @@ void WorkScheduler::initialize()
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
int numberOfCPUThreads = BLI_system_thread_count();
- for (int index = 0 ; index < numberOfCPUThreads ; index ++) {
+ for (int index = 0; index < numberOfCPUThreads; index++) {
CPUDevice *device = new CPUDevice();
device->initialize();
cpudevices.push_back(device);
@@ -209,13 +212,13 @@ void WorkScheduler::initialize()
cl_uint numberOfPlatforms = 0;
cl_int error;
error = clGetPlatformIDs(0, 0, &numberOfPlatforms);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
if (G.f & G_DEBUG) printf("%d number of platforms\n", numberOfPlatforms);
cl_platform_id *platforms = new cl_platform_id[numberOfPlatforms];
error = clGetPlatformIDs(numberOfPlatforms, platforms, 0);
unsigned int indexPlatform;
cl_uint totalNumberOfDevices = 0;
- for (indexPlatform = 0 ; indexPlatform < numberOfPlatforms ; indexPlatform ++) {
+ for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) {
cl_platform_id platform = platforms[indexPlatform];
cl_uint numberOfDevices;
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices);
@@ -224,16 +227,16 @@ void WorkScheduler::initialize()
cl_device_id *cldevices = new cl_device_id[totalNumberOfDevices];
unsigned int numberOfDevicesReceived = 0;
- for (indexPlatform = 0 ; indexPlatform < numberOfPlatforms ; indexPlatform ++) {
+ for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) {
cl_platform_id platform = platforms[indexPlatform];
cl_uint numberOfDevices;
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices);
- clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices+numberOfDevicesReceived*sizeof (cl_device_id), 0);
+ clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices + numberOfDevicesReceived * sizeof(cl_device_id), 0);
numberOfDevicesReceived += numberOfDevices;
}
if (totalNumberOfDevices > 0) {
context = clCreateContext(NULL, totalNumberOfDevices, cldevices, clContextError, NULL, &error);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
program = clCreateProgramWithSource(context, 1, &clkernelstoh_COM_OpenCLKernels_cl, 0, &error);
error = clBuildProgram(program, totalNumberOfDevices, cldevices, 0, 0, 0);
if (error != CL_SUCCESS) {
@@ -241,10 +244,10 @@ void WorkScheduler::initialize()
size_t ret_val_size = 0;
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size);
- if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
- char *build_log = new char[ret_val_size+1];
+ if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ char *build_log = new char[ret_val_size + 1];
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL);
- if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
build_log[ret_val_size] = '\0';
printf("%s", build_log);
delete build_log;
@@ -252,11 +255,11 @@ void WorkScheduler::initialize()
}
else {
unsigned int indexDevices;
- for (indexDevices = 0 ; indexDevices < totalNumberOfDevices ; indexDevices ++) {
+ for (indexDevices = 0; indexDevices < totalNumberOfDevices; indexDevices++) {
cl_device_id device = cldevices[indexDevices];
OpenCLDevice *clDevice = new OpenCLDevice(context, device, program);
clDevice->initialize(),
- gpudevices.push_back(clDevice);
+ gpudevices.push_back(clDevice);
if (G.f & G_DEBUG) {
char resultString[32];
error = clGetDeviceInfo(device, CL_DEVICE_NAME, 32, resultString, 0);
@@ -267,8 +270,8 @@ void WorkScheduler::initialize()
}
}
}
- delete [] cldevices;
- delete [] platforms;
+ delete[] cldevices;
+ delete[] platforms;
}
#endif
#endif
@@ -278,14 +281,14 @@ void WorkScheduler::deinitialize()
{
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
Device *device;
- while (cpudevices.size()>0) {
+ while (cpudevices.size() > 0) {
device = cpudevices.back();
cpudevices.pop_back();
device->deinitialize();
delete device;
}
#ifdef COM_OPENCL_ENABLED
- while (gpudevices.size()>0) {
+ while (gpudevices.size() > 0) {
device = gpudevices.back();
gpudevices.pop_back();
device->deinitialize();
diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
index eb3cd821172..4f3ed36aadb 100644
--- a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
+++ b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
@@ -31,7 +31,7 @@
#include "COM_SetValueOperation.h"
#include "DNA_material_types.h" // the ramp types
-void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *valueSocket = this->getInputSocket(0);
InputSocket *color1Socket = this->getInputSocket(1);
@@ -40,8 +40,8 @@ void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContex
bNode *editorNode = this->getbNode();
MixBaseOperation *convertProg;
- NodeTwoFloats *ntf = (NodeTwoFloats*)editorNode->storage;
- if (ntf->x!= 0.0f) {
+ NodeTwoFloats *ntf = (NodeTwoFloats *)editorNode->storage;
+ if (ntf->x != 0.0f) {
AlphaOverMixedOperation *mixOperation = new AlphaOverMixedOperation();
mixOperation->setX(ntf->x);
convertProg = mixOperation;
diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
index 6baa04ff7c2..f96a92068f4 100644
--- a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
@@ -28,6 +28,7 @@
BilateralBlurNode::BilateralBlurNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
void BilateralBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp
index fe93768161c..1b541d81c33 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BlurNode.cpp
@@ -31,6 +31,7 @@
BlurNode::BlurNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
index ee0119230f4..296056b6c48 100644
--- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
@@ -32,6 +32,7 @@
BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.cpp b/source/blender/compositor/nodes/COM_BokehImageNode.cpp
index f498fa11e30..75f5e07d552 100644
--- a/source/blender/compositor/nodes/COM_BokehImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehImageNode.cpp
@@ -25,15 +25,16 @@
#include "COM_BokehImageOperation.h"
#include "COM_ExecutionSystem.h"
-BokehImageNode::BokehImageNode(bNode *editorNode): Node(editorNode)
+BokehImageNode::BokehImageNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void BokehImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void BokehImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
BokehImageOperation *operation = new BokehImageOperation();
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
- operation->setData((NodeBokehImage*)this->getbNode()->storage);
+ operation->setData((NodeBokehImage *)this->getbNode()->storage);
addPreviewOperation(graph, operation->getOutputSocket(0));
}
diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp
index e99252663d0..789ff265a5c 100644
--- a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp
@@ -25,15 +25,16 @@
#include "COM_BoxMaskOperation.h"
#include "COM_ExecutionSystem.h"
-BoxMaskNode::BoxMaskNode(bNode *editorNode): Node(editorNode)
+BoxMaskNode::BoxMaskNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void BoxMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void BoxMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
BoxMaskOperation *operation;
operation = new BoxMaskOperation();
- operation->setData((NodeBoxMask*)this->getbNode()->storage);
+ operation->setData((NodeBoxMask *)this->getbNode()->storage);
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.cpp b/source/blender/compositor/nodes/COM_BrightnessNode.cpp
index 9ccb58a45de..1e1fbdbc301 100644
--- a/source/blender/compositor/nodes/COM_BrightnessNode.cpp
+++ b/source/blender/compositor/nodes/COM_BrightnessNode.cpp
@@ -25,11 +25,12 @@
#include "COM_BrightnessOperation.h"
#include "COM_ExecutionSystem.h"
-BrightnessNode::BrightnessNode(bNode *editorNode): Node(editorNode)
+BrightnessNode::BrightnessNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void BrightnessNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void BrightnessNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
BrightnessOperation *operation = new BrightnessOperation();
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
index f1d5b8d39cc..69f39639660 100644
--- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
@@ -27,8 +27,10 @@
#include "COM_ConvertRGBToYUVOperation.h"
#include "COM_SetAlphaOperation.h"
-ChannelMatteNode::ChannelMatteNode(bNode *editorNode): Node(editorNode)
-{}
+ChannelMatteNode::ChannelMatteNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
@@ -36,30 +38,30 @@ void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCon
OutputSocket *outputSocketImage = this->getOutputSocket(0);
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
- NodeOperation *convert=NULL;
+ NodeOperation *convert = NULL;
bNode *node = this->getbNode();
/* colorspace */
switch (node->custom1) {
- case CMP_NODE_CHANNEL_MATTE_CS_RGB:
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
- convert = new ConvertRGBToHSVOperation();
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/
- convert = new ConvertRGBToYUVOperation();
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/
- convert = new ConvertRGBToYCCOperation();
- ((ConvertRGBToYCCOperation *)convert)->setMode(0); /* BLI_YCC_ITU_BT601 */
- break;
- default:
- break;
+ case CMP_NODE_CHANNEL_MATTE_CS_RGB:
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
+ convert = new ConvertRGBToHSVOperation();
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/
+ convert = new ConvertRGBToYUVOperation();
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/
+ convert = new ConvertRGBToYCCOperation();
+ ((ConvertRGBToYCCOperation *)convert)->setMode(0); /* BLI_YCC_ITU_BT601 */
+ break;
+ default:
+ break;
}
ChannelMatteOperation *operation = new ChannelMatteOperation();
/* pass the ui properties to the operation */
- operation->setSettings((NodeChroma*)node->storage, node->custom2);
+ operation->setSettings((NodeChroma *)node->storage, node->custom2);
SetAlphaOperation *operationAlpha = new SetAlphaOperation();
diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
index 82059ed8493..0fb09157351 100644
--- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
@@ -25,8 +25,10 @@
#include "COM_ConvertRGBToYCCOperation.h"
#include "COM_SetAlphaOperation.h"
-ChromaMatteNode::ChromaMatteNode(bNode *editorNode): Node(editorNode)
-{}
+ChromaMatteNode::ChromaMatteNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
@@ -42,7 +44,7 @@ void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCont
ChromaMatteOperation *operation = new ChromaMatteOperation();
bNode *editorsnode = getbNode();
- operation->setSettings((NodeChroma*)editorsnode->storage);
+ operation->setSettings((NodeChroma *)editorsnode->storage);
inputSocketImage->relinkConnections(operationRGBToYCC_Image->getInputSocket(0), 0, graph);
inputSocketKey->relinkConnections(operationRGBToYCC_Key->getInputSocket(0), 0, graph);
diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
index 7b852678191..d85b1ec1de1 100644
--- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
@@ -27,10 +27,12 @@
#include "BKE_node.h"
#include "COM_MixBlendOperation.h"
-ColorBalanceNode::ColorBalanceNode(bNode *editorNode): Node(editorNode)
+ColorBalanceNode::ColorBalanceNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+
+void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
InputSocket *inputImageSocket = this->getInputSocket(1);
@@ -38,16 +40,16 @@ void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorCon
bNode *node = this->getbNode();
NodeColorBalance *n = (NodeColorBalance *)node->storage;
- NodeOperation*operation;
+ NodeOperation *operation;
if (node->custom1 == 0) {
ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();
{
- int c;
+ int c;
- for (c = 0; c < 3; c++) {
- n->lift_lgg[c] = 2.0f - n->lift[c];
- n->gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f/n->gamma[c] : 1000000.0f;
- }
+ for (c = 0; c < 3; c++) {
+ n->lift_lgg[c] = 2.0f - n->lift[c];
+ n->gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
+ }
}
operationLGG->setGain(n->gain);
diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
index 4909f1b9895..41b3bebbd7b 100644
--- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
@@ -25,20 +25,21 @@
#include "COM_ColorCorrectionOperation.h"
#include "COM_ExecutionSystem.h"
-ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode): Node(editorNode)
+ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void ColorCorrectionNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void ColorCorrectionNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
ColorCorrectionOperation *operation = new ColorCorrectionOperation();
bNode *editorNode = getbNode();
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
- operation->setData((NodeColorCorrection*)editorNode->storage);
- operation->setRedChannelEnabled((editorNode->custom1&1)>0);
- operation->setGreenChannelEnabled((editorNode->custom1&2)>0);
- operation->setBlueChannelEnabled((editorNode->custom1&4)>0);
+ operation->setData((NodeColorCorrection *)editorNode->storage);
+ operation->setRedChannelEnabled((editorNode->custom1 & 1) > 0);
+ operation->setGreenChannelEnabled((editorNode->custom1 & 2) > 0);
+ operation->setBlueChannelEnabled((editorNode->custom1 & 4) > 0);
graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.cpp b/source/blender/compositor/nodes/COM_ColorCurveNode.cpp
index 0d331ed9b05..9ae11c22b6a 100644
--- a/source/blender/compositor/nodes/COM_ColorCurveNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorCurveNode.cpp
@@ -25,11 +25,12 @@
#include "COM_ColorCurveOperation.h"
#include "COM_ExecutionSystem.h"
-ColorCurveNode::ColorCurveNode(bNode *editorNode): Node(editorNode)
+ColorCurveNode::ColorCurveNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void ColorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void ColorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
if (this->getInputSocket(2)->isConnected() || this->getInputSocket(3)->isConnected()) {
ColorCurveOperation *operation = new ColorCurveOperation();
@@ -41,21 +42,22 @@ void ColorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorConte
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- operation->setCurveMapping((CurveMapping*)this->getbNode()->storage);
+ operation->setCurveMapping((CurveMapping *)this->getbNode()->storage);
graph->addOperation(operation);
- } else {
+ }
+ else {
ConstantLevelColorCurveOperation *operation = new ConstantLevelColorCurveOperation();
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
- bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA*)this->getInputSocket(2)->getbNodeSocket()->default_value;
+ bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA *)this->getInputSocket(2)->getbNodeSocket()->default_value;
operation->setBlackLevel(val->value);
- val = (bNodeSocketValueRGBA*)this->getInputSocket(3)->getbNodeSocket()->default_value;
+ val = (bNodeSocketValueRGBA *)this->getInputSocket(3)->getbNodeSocket()->default_value;
operation->setWhiteLevel(val->value);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- operation->setCurveMapping((CurveMapping*)this->getbNode()->storage);
+ operation->setCurveMapping((CurveMapping *)this->getbNode()->storage);
graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
index ad117e1ca2c..38ab6ba8da2 100644
--- a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
@@ -25,8 +25,10 @@
#include "COM_ConvertRGBToHSVOperation.h"
#include "COM_SetAlphaOperation.h"
-ColorMatteNode::ColorMatteNode(bNode *editorNode): Node(editorNode)
-{}
+ColorMatteNode::ColorMatteNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
@@ -40,7 +42,7 @@ void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorConte
ColorMatteOperation *operation = new ColorMatteOperation();
bNode *editorsnode = getbNode();
- operation->setSettings((NodeChroma*)editorsnode->storage);
+ operation->setSettings((NodeChroma *)editorsnode->storage);
inputSocketImage->relinkConnections(operationRGBToHSV_Image->getInputSocket(0), 0, graph);
inputSocketKey->relinkConnections(operationRGBToHSV_Key->getInputSocket(0), 1, graph);
diff --git a/source/blender/compositor/nodes/COM_ColorNode.cpp b/source/blender/compositor/nodes/COM_ColorNode.cpp
index f5fcb0177f7..65480c7aeb2 100644
--- a/source/blender/compositor/nodes/COM_ColorNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorNode.cpp
@@ -25,15 +25,16 @@
#include "COM_SetColorOperation.h"
#include "COM_ExecutionSystem.h"
-ColorNode::ColorNode(bNode *editorNode): Node(editorNode)
+ColorNode::ColorNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void ColorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void ColorNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
SetColorOperation *operation = new SetColorOperation();
bNodeSocket *socket = this->getEditorOutputSocket(0);
- bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA*)socket->default_value;
+ bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA *)socket->default_value;
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
operation->setChannels(dval->value);
graph->addOperation(operation);
diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.cpp b/source/blender/compositor/nodes/COM_ColorRampNode.cpp
index c6090120467..a79c7885ae4 100644
--- a/source/blender/compositor/nodes/COM_ColorRampNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorRampNode.cpp
@@ -27,10 +27,12 @@
#include "COM_SeparateChannelOperation.h"
#include "DNA_texture_types.h"
-ColorRampNode::ColorRampNode(bNode *editorNode): Node(editorNode)
-{}
+ColorRampNode::ColorRampNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
-void ColorRampNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void ColorRampNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
OutputSocket *outputSocket = this->getOutputSocket(0);
@@ -46,7 +48,7 @@ void ColorRampNode::convertToOperations(ExecutionSystem *graph, CompositorContex
operation2->setChannel(3);
graph->addOperation(operation2);
}
- operation->setColorBand((ColorBand*)editorNode->storage);
+ operation->setColorBand((ColorBand *)editorNode->storage);
inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
index 503ca3c8bd3..0e586955ff8 100644
--- a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
@@ -24,8 +24,10 @@
#include "BKE_node.h"
#include "COM_ColorSpillOperation.h"
-ColorSpillNode::ColorSpillNode(bNode *editorNode): Node(editorNode)
-{}
+ColorSpillNode::ColorSpillNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
void ColorSpillNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
@@ -45,8 +47,8 @@ void ColorSpillNode::convertToOperations(ExecutionSystem *graph, CompositorConte
// Average color spill
operation = new ColorSpillAverageOperation();
}
- operation->setSettings((NodeColorspill*)editorsnode->storage);
- operation->setSpillChannel(editorsnode->custom1-1); // Channel for spilling
+ operation->setSettings((NodeColorspill *)editorsnode->storage);
+ operation->setSpillChannel(editorsnode->custom1 - 1); // Channel for spilling
inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
index ed2869d35f2..430f317eae2 100644
--- a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
@@ -25,11 +25,12 @@
#include "COM_ConvertColorToBWOperation.h"
#include "COM_ExecutionSystem.h"
-ColourToBWNode::ColourToBWNode(bNode *editorNode): Node(editorNode)
+ColourToBWNode::ColourToBWNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void ColourToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void ColourToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *colourSocket = this->getInputSocket(0);
OutputSocket *valueSocket = this->getOutputSocket(0);
diff --git a/source/blender/compositor/nodes/COM_CombineHSVANode.cpp b/source/blender/compositor/nodes/COM_CombineHSVANode.cpp
index a0f46ad6b6c..beba41fade9 100644
--- a/source/blender/compositor/nodes/COM_CombineHSVANode.cpp
+++ b/source/blender/compositor/nodes/COM_CombineHSVANode.cpp
@@ -28,11 +28,12 @@
#include "COM_SetValueOperation.h"
#include "COM_ConvertHSVToRGBOperation.h"
-CombineHSVANode::CombineHSVANode(bNode *editorNode): CombineRGBANode(editorNode)
+CombineHSVANode::CombineHSVANode(bNode *editorNode) : CombineRGBANode(editorNode)
{
+ /* pass */
}
-void CombineHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void CombineHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
ConvertHSVToRGBOperation *operation = new ConvertHSVToRGBOperation();
OutputSocket *outputSocket = this->getOutputSocket(0);
diff --git a/source/blender/compositor/nodes/COM_CombineRGBANode.cpp b/source/blender/compositor/nodes/COM_CombineRGBANode.cpp
index e6fcc48ac5b..a8cdd8c2950 100644
--- a/source/blender/compositor/nodes/COM_CombineRGBANode.cpp
+++ b/source/blender/compositor/nodes/COM_CombineRGBANode.cpp
@@ -29,12 +29,12 @@
#include "DNA_material_types.h" // the ramp types
-CombineRGBANode::CombineRGBANode(bNode *editorNode): Node(editorNode)
+CombineRGBANode::CombineRGBANode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-
-void CombineRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void CombineRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputRSocket = this->getInputSocket(0);
InputSocket *inputGSocket = this->getInputSocket(1);
diff --git a/source/blender/compositor/nodes/COM_CombineYCCANode.cpp b/source/blender/compositor/nodes/COM_CombineYCCANode.cpp
index ad6203ea85a..5319eb84184 100644
--- a/source/blender/compositor/nodes/COM_CombineYCCANode.cpp
+++ b/source/blender/compositor/nodes/COM_CombineYCCANode.cpp
@@ -22,8 +22,9 @@
#include "COM_CombineYCCANode.h"
#include "COM_ConvertYCCToRGBOperation.h"
-CombineYCCANode::CombineYCCANode(bNode *editorNode): CombineRGBANode(editorNode)
+CombineYCCANode::CombineYCCANode(bNode *editorNode) : CombineRGBANode(editorNode)
{
+ /* pass */
}
void CombineYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_CombineYUVANode.cpp b/source/blender/compositor/nodes/COM_CombineYUVANode.cpp
index ea92a40f803..48c2c6ca649 100644
--- a/source/blender/compositor/nodes/COM_CombineYUVANode.cpp
+++ b/source/blender/compositor/nodes/COM_CombineYUVANode.cpp
@@ -22,8 +22,9 @@
#include "COM_CombineYUVANode.h"
#include "COM_ConvertYUVToRGBOperation.h"
-CombineYUVANode::CombineYUVANode(bNode *editorNode): CombineRGBANode(editorNode)
+CombineYUVANode::CombineYUVANode(bNode *editorNode) : CombineRGBANode(editorNode)
{
+ /* pass */
}
void CombineYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp
index e2cc34bb6ce..fccb92ddd8b 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.cpp
+++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp
@@ -24,11 +24,12 @@
#include "COM_CompositorOperation.h"
#include "COM_ExecutionSystem.h"
-CompositorNode::CompositorNode(bNode *editorNode): Node(editorNode)
+CompositorNode::CompositorNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *imageSocket = this->getInputSocket(0);
InputSocket *alphaSocket = this->getInputSocket(1);
diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
index 0b4326a17ca..70aeee8fc27 100644
--- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
+++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
@@ -24,7 +24,7 @@
#include "COM_ConvertKeyToPremulOperation.h"
#include "COM_ExecutionSystem.h"
-void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
NodeOperation *operation = NULL;
bNode *node = this->getbNode();
diff --git a/source/blender/compositor/nodes/COM_CropNode.cpp b/source/blender/compositor/nodes/COM_CropNode.cpp
index c58fcc874cb..b80a3e088f2 100644
--- a/source/blender/compositor/nodes/COM_CropNode.cpp
+++ b/source/blender/compositor/nodes/COM_CropNode.cpp
@@ -26,12 +26,13 @@
CropNode::CropNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
bNode *node = getbNode();
- NodeTwoXYs *cropSettings = (NodeTwoXYs*)node->storage;
+ NodeTwoXYs *cropSettings = (NodeTwoXYs *)node->storage;
bool relative = (bool)node->custom2;
bool cropImage = (bool)node->custom1;
CropBaseOperation *operation;
diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cpp b/source/blender/compositor/nodes/COM_DefocusNode.cpp
index e4e19fdbe27..d1f90b490ad 100644
--- a/source/blender/compositor/nodes/COM_DefocusNode.cpp
+++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp
@@ -33,16 +33,17 @@
#include "COM_SetValueOperation.h"
#include "COM_GammaCorrectOperation.h"
-DefocusNode::DefocusNode(bNode *editorNode): Node(editorNode)
+DefocusNode::DefocusNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
bNode *node = this->getbNode();
- Scene *scene = (Scene*)node->id;
- Object *camob = (scene)? scene->camera: NULL;
- NodeDefocus *data = (NodeDefocus*)node->storage;
+ Scene *scene = (Scene *)node->id;
+ Object *camob = (scene) ? scene->camera : NULL;
+ NodeDefocus *data = (NodeDefocus *)node->storage;
NodeOperation *radiusOperation;
if (data->no_zbuf) {
@@ -74,11 +75,11 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
}
BokehImageOperation *bokeh = new BokehImageOperation();
- NodeBokehImage * bokehdata = new NodeBokehImage();
+ NodeBokehImage *bokehdata = new NodeBokehImage();
bokehdata->angle = data->rotation;
bokehdata->rounding = 0.0f;
bokehdata->flaps = data->bktype;
- if (data->bktype<3) {
+ if (data->bktype < 3) {
bokehdata->flaps = 5;
bokehdata->rounding = 1.0f;
}
@@ -96,8 +97,8 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
addLink(graph, bokeh->getOutputSocket(), operation->getInputSocket(1));
addLink(graph, radiusOperation->getOutputSocket(), operation->getInputSocket(2));
if (data->gamco) {
- GammaCorrectOperation * correct = new GammaCorrectOperation();
- GammaUncorrectOperation * inverse = new GammaUncorrectOperation();
+ GammaCorrectOperation *correct = new GammaCorrectOperation();
+ GammaUncorrectOperation *inverse = new GammaUncorrectOperation();
this->getInputSocket(0)->relinkConnections(correct->getInputSocket(0), 0, graph);
addLink(graph, correct->getOutputSocket(), operation->getInputSocket(0));
addLink(graph, operation->getOutputSocket(), inverse->getInputSocket(0));
diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
index 596fefff77c..6dca049a6ae 100644
--- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
@@ -25,10 +25,12 @@
#include "COM_DifferenceMatteOperation.h"
#include "COM_SetAlphaOperation.h"
-DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode): Node(editorNode)
-{}
+DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
-void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
InputSocket *inputSocket2 = this->getInputSocket(1);
@@ -36,15 +38,15 @@ void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, Compositor
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
bNode *editorNode = this->getbNode();
- DifferenceMatteOperation * operationSet = new DifferenceMatteOperation();
- operationSet->setSettings((NodeChroma*)editorNode->storage);
+ DifferenceMatteOperation *operationSet = new DifferenceMatteOperation();
+ operationSet->setSettings((NodeChroma *)editorNode->storage);
inputSocket->relinkConnections(operationSet->getInputSocket(0), 0, graph);
inputSocket2->relinkConnections(operationSet->getInputSocket(1), 1, graph);
outputSocketMatte->relinkConnections(operationSet->getOutputSocket(0));
graph->addOperation(operationSet);
- SetAlphaOperation * operation = new SetAlphaOperation();
+ SetAlphaOperation *operation = new SetAlphaOperation();
addLink(graph, operationSet->getInputSocket(0)->getConnection()->getFromSocket(), operation->getInputSocket(0));
addLink(graph, operationSet->getOutputSocket(), operation->getInputSocket(1));
outputSocketImage->relinkConnections(operation->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
index 0619bb5133e..fbec1522e27 100644
--- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
+++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
@@ -25,13 +25,16 @@
#include "COM_ExecutionSystem.h"
#include "COM_DilateErodeOperation.h"
#include "COM_AntiAliasOperation.h"
+#include "COM_GaussianAlphaXBlurOperation.h"
+#include "COM_GaussianAlphaYBlurOperation.h"
#include "BLI_math.h"
-DilateErodeNode::DilateErodeNode(bNode *editorNode): Node(editorNode)
+DilateErodeNode::DilateErodeNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
bNode *editorNode = this->getbNode();
@@ -43,7 +46,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
if (editorNode->custom3 < 2.0f) {
- AntiAliasOperation * antiAlias = new AntiAliasOperation();
+ AntiAliasOperation *antiAlias = new AntiAliasOperation();
addLink(graph, operation->getOutputSocket(), antiAlias->getInputSocket(0));
this->getOutputSocket(0)->relinkConnections(antiAlias->getOutputSocket(0));
graph->addOperation(antiAlias);
@@ -55,30 +58,76 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
}
else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) {
if (editorNode->custom2 > 0) {
- DilateDistanceOperation * operation = new DilateDistanceOperation();
+ DilateDistanceOperation *operation = new DilateDistanceOperation();
operation->setDistance(editorNode->custom2);
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
}
else {
- ErodeDistanceOperation * operation = new ErodeDistanceOperation();
+ ErodeDistanceOperation *operation = new ErodeDistanceOperation();
operation->setDistance(-editorNode->custom2);
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
}
}
+ else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_FEATHER) {
+ /* this uses a modified gaussian blur function otherwise its far too slow */
+ CompositorQuality quality = context->getQuality();
+
+ /* initialize node data */
+ NodeBlurData *data = (NodeBlurData *)&this->alpha_blur;
+ memset(data, 0, sizeof(*data));
+ data->filtertype = R_FILTER_GAUSS;
+
+ if (editorNode->custom2 > 0) {
+ data->sizex = data->sizey = editorNode->custom2;
+ }
+ else {
+ data->sizex = data->sizey = -editorNode->custom2;
+
+ }
+
+ GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation();
+ operationx->setData(data);
+ operationx->setQuality(quality);
+ this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), 0, graph);
+ // this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph); // no size input yet
+ graph->addOperation(operationx);
+ GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation();
+ operationy->setData(data);
+ operationy->setQuality(quality);
+ this->getOutputSocket(0)->relinkConnections(operationy->getOutputSocket());
+ graph->addOperation(operationy);
+ addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
+ // addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1)); // no size input yet
+ addPreviewOperation(graph, operationy->getOutputSocket());
+
+ /* TODO? */
+ /* see gaussian blue node for original usage */
+#if 0
+ if (!connectedSizeSocket) {
+ operationx->setSize(size);
+ operationy->setSize(size);
+ }
+#else
+ operationx->setSize(1.0f);
+ operationy->setSize(1.0f);
+#endif
+ operationx->setSubtract(editorNode->custom2 < 0);
+ operationy->setSubtract(editorNode->custom2 < 0);
+ }
else {
if (editorNode->custom2 > 0) {
- DilateStepOperation * operation = new DilateStepOperation();
+ DilateStepOperation *operation = new DilateStepOperation();
operation->setIterations(editorNode->custom2);
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
}
else {
- ErodeStepOperation * operation = new ErodeStepOperation();
+ ErodeStepOperation *operation = new ErodeStepOperation();
operation->setIterations(-editorNode->custom2);
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.h b/source/blender/compositor/nodes/COM_DilateErodeNode.h
index fa4e368e00d..ac374d7375b 100644
--- a/source/blender/compositor/nodes/COM_DilateErodeNode.h
+++ b/source/blender/compositor/nodes/COM_DilateErodeNode.h
@@ -30,6 +30,7 @@
* @ingroup Node
*/
class DilateErodeNode : public Node {
+ NodeBlurData alpha_blur; /* only used for blurring alpha, since the dilate/erode node doesnt have this */
public:
DilateErodeNode(bNode *editorNode);
void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
index d096ef977f8..dee0e6a88da 100644
--- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
@@ -28,6 +28,7 @@
DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.cpp b/source/blender/compositor/nodes/COM_DisplaceNode.cpp
index 9604db378bc..41fbfd61981 100644
--- a/source/blender/compositor/nodes/COM_DisplaceNode.cpp
+++ b/source/blender/compositor/nodes/COM_DisplaceNode.cpp
@@ -24,11 +24,12 @@
#include "COM_DisplaceSimpleOperation.h"
#include "COM_ExecutionSystem.h"
-DisplaceNode::DisplaceNode(bNode *editorNode): Node(editorNode)
+DisplaceNode::DisplaceNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void DisplaceNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void DisplaceNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
NodeOperation *operation;
if (context->getQuality() == COM_QUALITY_LOW)
diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
index 20a55ae195c..d6730ef6a00 100644
--- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
@@ -24,8 +24,10 @@
#include "COM_DistanceMatteOperation.h"
#include "COM_SetAlphaOperation.h"
-DistanceMatteNode::DistanceMatteNode(bNode *editorNode): Node(editorNode)
-{}
+DistanceMatteNode::DistanceMatteNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
@@ -36,7 +38,7 @@ void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCo
DistanceMatteOperation *operation = new DistanceMatteOperation();
bNode *editorsnode = getbNode();
- operation->setSettings((NodeChroma*)editorsnode->storage);
+ operation->setSettings((NodeChroma *)editorsnode->storage);
inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);
diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
index ab9e101dad8..57c319e7630 100644
--- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
@@ -25,11 +25,12 @@
#include "DNA_scene_types.h"
#include "COM_ExecutionSystem.h"
-DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode): Node(editorNode)
+DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void DoubleEdgeMaskNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
+void DoubleEdgeMaskNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
{
DoubleEdgeMaskOperation *operation;
bNode *bnode = this->getbNode();
diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp
index f5003c4be94..23410c6a115 100644
--- a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp
@@ -25,15 +25,16 @@
#include "COM_EllipseMaskOperation.h"
#include "COM_ExecutionSystem.h"
-EllipseMaskNode::EllipseMaskNode(bNode *editorNode): Node(editorNode)
+EllipseMaskNode::EllipseMaskNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void EllipseMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void EllipseMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
EllipseMaskOperation *operation;
operation = new EllipseMaskOperation();
- operation->setData((NodeEllipseMask*)this->getbNode()->storage);
+ operation->setData((NodeEllipseMask *)this->getbNode()->storage);
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
diff --git a/source/blender/compositor/nodes/COM_FilterNode.cpp b/source/blender/compositor/nodes/COM_FilterNode.cpp
index 7700bceb4ab..23f87805821 100644
--- a/source/blender/compositor/nodes/COM_FilterNode.cpp
+++ b/source/blender/compositor/nodes/COM_FilterNode.cpp
@@ -27,11 +27,12 @@
#include "BKE_node.h"
#include "COM_MixBlendOperation.h"
-FilterNode::FilterNode(bNode *editorNode): Node(editorNode)
+FilterNode::FilterNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
InputSocket *inputImageSocket = this->getInputSocket(1);
@@ -39,38 +40,38 @@ void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
ConvolutionFilterOperation *operation = NULL;
switch (this->getbNode()->custom1) {
- case CMP_FILT_SOFT:
- operation = new ConvolutionFilterOperation();
- operation->set3x3Filter(1/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 4/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 1/16.0f);
- break;
- case CMP_FILT_SHARP:
- operation = new ConvolutionFilterOperation();
- operation->set3x3Filter(-1,-1,-1,-1,9,-1,-1,-1,-1);
- break;
- case CMP_FILT_LAPLACE:
- operation = new ConvolutionFilterOperation();
- operation->set3x3Filter(-1/8.0f, -1/8.0f, -1/8.0f, -1/8.0f, 1.0f, -1/8.0f, -1/8.0f, -1/8.0f, -1/8.0f);
- break;
- case CMP_FILT_SOBEL:
- operation = new ConvolutionEdgeFilterOperation();
- operation->set3x3Filter(1,2,1,0,0,0,-1,-2,-1);
- break;
- case CMP_FILT_PREWITT:
- operation = new ConvolutionEdgeFilterOperation();
- operation->set3x3Filter(1,1,1,0,0,0,-1,-1,-1);
- break;
- case CMP_FILT_KIRSCH:
- operation = new ConvolutionEdgeFilterOperation();
- operation->set3x3Filter(5,5,5,-3,-3,-3,-2,-2,-2);
- break;
- case CMP_FILT_SHADOW:
- operation = new ConvolutionFilterOperation();
- operation->set3x3Filter(1,2,1,0,1,0,-1,-2,-1);
- break;
- default:
- operation = new ConvolutionFilterOperation();
- operation->set3x3Filter(0,0,0,0,1,0,0,0,0);
- break;
+ case CMP_FILT_SOFT:
+ operation = new ConvolutionFilterOperation();
+ operation->set3x3Filter(1 / 16.0f, 2 / 16.0f, 1 / 16.0f, 2 / 16.0f, 4 / 16.0f, 2 / 16.0f, 1 / 16.0f, 2 / 16.0f, 1 / 16.0f);
+ break;
+ case CMP_FILT_SHARP:
+ operation = new ConvolutionFilterOperation();
+ operation->set3x3Filter(-1, -1, -1, -1, 9, -1, -1, -1, -1);
+ break;
+ case CMP_FILT_LAPLACE:
+ operation = new ConvolutionFilterOperation();
+ operation->set3x3Filter(-1 / 8.0f, -1 / 8.0f, -1 / 8.0f, -1 / 8.0f, 1.0f, -1 / 8.0f, -1 / 8.0f, -1 / 8.0f, -1 / 8.0f);
+ break;
+ case CMP_FILT_SOBEL:
+ operation = new ConvolutionEdgeFilterOperation();
+ operation->set3x3Filter(1, 2, 1, 0, 0, 0, -1, -2, -1);
+ break;
+ case CMP_FILT_PREWITT:
+ operation = new ConvolutionEdgeFilterOperation();
+ operation->set3x3Filter(1, 1, 1, 0, 0, 0, -1, -1, -1);
+ break;
+ case CMP_FILT_KIRSCH:
+ operation = new ConvolutionEdgeFilterOperation();
+ operation->set3x3Filter(5, 5, 5, -3, -3, -3, -2, -2, -2);
+ break;
+ case CMP_FILT_SHADOW:
+ operation = new ConvolutionFilterOperation();
+ operation->set3x3Filter(1, 2, 1, 0, 1, 0, -1, -2, -1);
+ break;
+ default:
+ operation = new ConvolutionFilterOperation();
+ operation->set3x3Filter(0, 0, 0, 0, 1, 0, 0, 0, 0);
+ break;
}
inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
diff --git a/source/blender/compositor/nodes/COM_FlipNode.cpp b/source/blender/compositor/nodes/COM_FlipNode.cpp
index 0830c757833..a50297aae1a 100644
--- a/source/blender/compositor/nodes/COM_FlipNode.cpp
+++ b/source/blender/compositor/nodes/COM_FlipNode.cpp
@@ -27,26 +27,27 @@
FlipNode::FlipNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void FlipNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void FlipNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
OutputSocket *outputSocket = this->getOutputSocket(0);
FlipOperation *operation = new FlipOperation();
switch (this->getbNode()->custom1) {
- case 0: /// @TODO: I didn't find any constants in the old implementation, should I introduce them.
- operation->setFlipX(true);
- operation->setFlipY(false);
- break;
- case 1:
- operation->setFlipX(false);
- operation->setFlipY(true);
- break;
- case 2:
- operation->setFlipX(true);
- operation->setFlipY(true);
- break;
+ case 0: /// @TODO: I didn't find any constants in the old implementation, should I introduce them.
+ operation->setFlipX(true);
+ operation->setFlipY(false);
+ break;
+ case 1:
+ operation->setFlipX(false);
+ operation->setFlipY(true);
+ break;
+ case 2:
+ operation->setFlipX(true);
+ operation->setFlipY(true);
+ break;
}
inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
diff --git a/source/blender/compositor/nodes/COM_GammaNode.cpp b/source/blender/compositor/nodes/COM_GammaNode.cpp
index 58b05607618..52699c83bf9 100644
--- a/source/blender/compositor/nodes/COM_GammaNode.cpp
+++ b/source/blender/compositor/nodes/COM_GammaNode.cpp
@@ -25,11 +25,12 @@
#include "COM_GammaOperation.h"
#include "COM_ExecutionSystem.h"
-GammaNode::GammaNode(bNode *editorNode): Node(editorNode)
+GammaNode::GammaNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void GammaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void GammaNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
GammaOperation *operation = new GammaOperation();
diff --git a/source/blender/compositor/nodes/COM_GlareNode.cpp b/source/blender/compositor/nodes/COM_GlareNode.cpp
index dcb8f3a3a4c..7b34fa4d286 100644
--- a/source/blender/compositor/nodes/COM_GlareNode.cpp
+++ b/source/blender/compositor/nodes/COM_GlareNode.cpp
@@ -31,36 +31,37 @@
#include "COM_GlareGhostOperation.h"
#include "COM_GlareFogGlowOperation.h"
-GlareNode::GlareNode(bNode *editorNode): Node(editorNode)
+GlareNode::GlareNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)\
-{
+void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext *context) \
+ {
bNode *node = this->getbNode();
- NodeGlare *glare = (NodeGlare*)node->storage;
+ NodeGlare *glare = (NodeGlare *)node->storage;
- GlareBaseOperation * glareoperation = NULL;
+ GlareBaseOperation *glareoperation = NULL;
switch (glare->type) {
- default:
- case 3:
- glareoperation = new GlareGhostOperation();
- break;
- case 2: // streaks
- glareoperation = new GlareStreaksOperation();
- break;
- case 1: // fog glow
- glareoperation = new GlareFogGlowOperation();
- break;
- case 0: // simple star
- glareoperation = new GlareSimpleStarOperation();
- break;
+ default:
+ case 3:
+ glareoperation = new GlareGhostOperation();
+ break;
+ case 2: // streaks
+ glareoperation = new GlareStreaksOperation();
+ break;
+ case 1: // fog glow
+ glareoperation = new GlareFogGlowOperation();
+ break;
+ case 0: // simple star
+ glareoperation = new GlareSimpleStarOperation();
+ break;
}
GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation();
- SetValueOperation * mixvalueoperation = new SetValueOperation();
- MixGlareOperation * mixoperation = new MixGlareOperation();
+ SetValueOperation *mixvalueoperation = new SetValueOperation();
+ MixGlareOperation *mixoperation = new MixGlareOperation();
mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT);
this->getInputSocket(0)->relinkConnections(thresholdOperation->getInputSocket(0), 0, system);
@@ -72,7 +73,7 @@ void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext *
thresholdOperation->setGlareSettings(glare);
glareoperation->setGlareSettings(glare);
- mixvalueoperation->setValue(0.5f+glare->mix*0.5f);
+ mixvalueoperation->setValue(0.5f + glare->mix * 0.5f);
mixoperation->setResolutionInputSocketIndex(1);
system->addOperation(glareoperation);
@@ -80,4 +81,4 @@ void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext *
system->addOperation(mixvalueoperation);
system->addOperation(mixoperation);
-}
+ }
diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp
index 8a8c1db86b4..e5255b6bb87 100644
--- a/source/blender/compositor/nodes/COM_GroupNode.cpp
+++ b/source/blender/compositor/nodes/COM_GroupNode.cpp
@@ -24,44 +24,46 @@
#include "COM_SocketProxyNode.h"
#include "COM_ExecutionSystemHelper.h"
-GroupNode::GroupNode(bNode *editorNode): Node(editorNode)
+GroupNode::GroupNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
+ /* pass */
}
void GroupNode::ungroup(ExecutionSystem &system)
{
- bNode * bnode = this->getbNode();
- vector<InputSocket*> &inputsockets = this->getInputSockets();
- vector<OutputSocket*> &outputsockets = this->getOutputSockets();
+ bNode *bnode = this->getbNode();
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
+ vector<OutputSocket *> &outputsockets = this->getOutputSockets();
unsigned int index;
/* get the node list size _before_ adding proxy nodes, so they are available for linking */
int nodes_start = system.getNodes().size();
- for (index = 0 ; index < inputsockets.size();index ++) {
- InputSocket * inputSocket = inputsockets[index];
+ for (index = 0; index < inputsockets.size(); index++) {
+ InputSocket *inputSocket = inputsockets[index];
bNodeSocket *editorInput = inputSocket->getbNodeSocket();
if (editorInput->groupsock) {
- SocketProxyNode * proxy = new SocketProxyNode(bnode, editorInput, editorInput->groupsock);
+ SocketProxyNode *proxy = new SocketProxyNode(bnode, editorInput, editorInput->groupsock);
inputSocket->relinkConnections(proxy->getInputSocket(0), index, &system);
ExecutionSystemHelper::addNode(system.getNodes(), proxy);
}
}
- for (index = 0 ; index < outputsockets.size();index ++) {
- OutputSocket * outputSocket = outputsockets[index];
+ for (index = 0; index < outputsockets.size(); index++) {
+ OutputSocket *outputSocket = outputsockets[index];
bNodeSocket *editorOutput = outputSocket->getbNodeSocket();
if (editorOutput->groupsock) {
- SocketProxyNode * proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput);
+ SocketProxyNode *proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput);
outputSocket->relinkConnections(proxy->getOutputSocket(0));
ExecutionSystemHelper::addNode(system.getNodes(), proxy);
}
}
- bNodeTree *subtree = (bNodeTree*)bnode->id;
+ bNodeTree *subtree = (bNodeTree *)bnode->id;
ExecutionSystemHelper::addbNodeTree(system, nodes_start, subtree, bnode);
}
diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
index ae96a8c9fb8..6057a7f0e6c 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
@@ -33,23 +33,24 @@
#include "DNA_node_types.h"
#include "COM_HueSaturationValueCorrectOperation.h"
-HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editorNode): Node(editorNode)
+HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void HueSaturationValueCorrectNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void HueSaturationValueCorrectNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *valueSocket = this->getInputSocket(0);
InputSocket *colourSocket = this->getInputSocket(1);
OutputSocket *outputSocket = this->getOutputSocket(0);
bNode *editorsnode = getbNode();
- CurveMapping *storage = (CurveMapping*)editorsnode->storage;
+ CurveMapping *storage = (CurveMapping *)editorsnode->storage;
if (colourSocket->isConnected() && outputSocket->isConnected()) {
- ConvertRGBToHSVOperation * rgbToHSV = new ConvertRGBToHSVOperation();
- ConvertHSVToRGBOperation * hsvToRGB = new ConvertHSVToRGBOperation();
+ ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation();
+ ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation();
HueSaturationValueCorrectOperation *changeHSV = new HueSaturationValueCorrectOperation();
- MixBlendOperation * blend = new MixBlendOperation();
+ MixBlendOperation *blend = new MixBlendOperation();
colourSocket->relinkConnections(rgbToHSV->getInputSocket(0), 1, graph);
addLink(graph, rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0));
diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
index 32c7d4719a4..ef501317e48 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
@@ -32,22 +32,23 @@
#include "COM_ChangeHSVOperation.h"
#include "DNA_node_types.h"
-HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode): Node(editorNode)
+HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void HueSaturationValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void HueSaturationValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *valueSocket = this->getInputSocket(0);
InputSocket *colourSocket = this->getInputSocket(1);
OutputSocket *outputSocket = this->getOutputSocket(0);
bNode *editorsnode = getbNode();
- NodeHueSat *storage = (NodeHueSat*)editorsnode->storage;
+ NodeHueSat *storage = (NodeHueSat *)editorsnode->storage;
- ConvertRGBToHSVOperation * rgbToHSV = new ConvertRGBToHSVOperation();
- ConvertHSVToRGBOperation * hsvToRGB = new ConvertHSVToRGBOperation();
+ ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation();
+ ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation();
ChangeHSVOperation *changeHSV = new ChangeHSVOperation();
- MixBlendOperation * blend = new MixBlendOperation();
+ MixBlendOperation *blend = new MixBlendOperation();
colourSocket->relinkConnections(rgbToHSV->getInputSocket(0), 0, graph);
addLink(graph, rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0));
diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.cpp b/source/blender/compositor/nodes/COM_IDMaskNode.cpp
index 82d3ae8ca29..4005e5d2900 100644
--- a/source/blender/compositor/nodes/COM_IDMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_IDMaskNode.cpp
@@ -26,10 +26,11 @@
#include "COM_ExecutionSystem.h"
#include "COM_AntiAliasOperation.h"
-IDMaskNode::IDMaskNode(bNode *editorNode): Node(editorNode)
+IDMaskNode::IDMaskNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void IDMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void IDMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
bNode *bnode = this->getbNode();
IDMaskOperation *operation;
@@ -37,11 +38,11 @@ void IDMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
operation->setObjectIndex(bnode->custom1);
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
- if (bnode->custom2==0 || context->getScene()->r.scemode & R_FULL_SAMPLE) {
+ if (bnode->custom2 == 0 || context->getScene()->r.scemode & R_FULL_SAMPLE) {
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
}
else {
- AntiAliasOperation * antiAliasOperation = new AntiAliasOperation();
+ AntiAliasOperation *antiAliasOperation = new AntiAliasOperation();
addLink(graph, operation->getOutputSocket(), antiAliasOperation->getInputSocket(0));
this->getOutputSocket(0)->relinkConnections(antiAliasOperation->getOutputSocket(0));
graph->addOperation(antiAliasOperation);
diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp
index cfd530173a9..addde140b9f 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -28,25 +28,27 @@
#include "BKE_node.h"
#include "BLI_utildefines.h"
-ImageNode::ImageNode(bNode *editorNode): Node(editorNode)
+ImageNode::ImageNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
+
}
NodeOperation *ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int pass, DataType datatype)
{
OutputSocket *outputSocket = this->getOutputSocket(outputsocketIndex);
- MultilayerBaseOperation * operation = NULL;
+ MultilayerBaseOperation *operation = NULL;
switch (datatype) {
- case COM_DT_VALUE:
- operation = new MultilayerValueOperation(pass);
- break;
- case COM_DT_VECTOR:
- operation = new MultilayerVectorOperation(pass);
- break;
- case COM_DT_COLOR:
- operation = new MultilayerColorOperation(pass);
- break;
- default:
- break;
+ case COM_DT_VALUE:
+ operation = new MultilayerValueOperation(pass);
+ break;
+ case COM_DT_VECTOR:
+ operation = new MultilayerVectorOperation(pass);
+ break;
+ case COM_DT_COLOR:
+ operation = new MultilayerColorOperation(pass);
+ break;
+ default:
+ break;
}
operation->setImage(image);
operation->setRenderLayer(rl);
@@ -57,52 +59,52 @@ NodeOperation *ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer
return operation;
}
-void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
/// Image output
OutputSocket *outputImage = this->getOutputSocket(0);
bNode *editorNode = this->getbNode();
- Image *image = (Image*)editorNode->id;
- ImageUser *imageuser = (ImageUser*)editorNode->storage;
+ Image *image = (Image *)editorNode->id;
+ ImageUser *imageuser = (ImageUser *)editorNode->storage;
int framenumber = context->getFramenumber();
int numberOfOutputs = this->getNumberOfOutputSockets();
BKE_image_user_frame_calc(imageuser, context->getFramenumber(), 0);
/* force a load, we assume iuser index will be set OK anyway */
- if (image && image->type==IMA_TYPE_MULTILAYER) {
+ if (image && image->type == IMA_TYPE_MULTILAYER) {
BKE_image_get_ibuf(image, imageuser);
if (image->rr) {
- RenderLayer *rl = (RenderLayer*)BLI_findlink(&image->rr->layers, imageuser->layer);
+ RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
if (rl) {
- OutputSocket * socket;
+ OutputSocket *socket;
int index;
- for (index = 0 ; index < numberOfOutputs ; index ++) {
+ for (index = 0; index < numberOfOutputs; index++) {
socket = this->getOutputSocket(index);
if (socket->isConnected() || index == 0) {
bNodeSocket *bnodeSocket = socket->getbNodeSocket();
- NodeImageLayer *storage = (NodeImageLayer*)bnodeSocket->storage;
+ NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;
int passindex = storage->pass_index;
RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
if (rpass) {
- NodeOperation * operation = NULL;
+ NodeOperation *operation = NULL;
imageuser->pass = passindex;
switch (rpass->channels) {
- case 1:
- operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VALUE);
- break;
- /* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
- /* XXX any way to detect actual vector images? */
- case 3:
- operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VECTOR);
- break;
- case 4:
- operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
- break;
-
- default:
- /* XXX add a dummy operation? */
- break;
+ case 1:
+ operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VALUE);
+ break;
+ /* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
+ /* XXX any way to detect actual vector images? */
+ case 3:
+ operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VECTOR);
+ break;
+ case 4:
+ operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
+ break;
+
+ default:
+ /* XXX add a dummy operation? */
+ break;
}
if (index == 0 && operation) {
addPreviewOperation(graph, operation->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_InvertNode.cpp b/source/blender/compositor/nodes/COM_InvertNode.cpp
index 5d039239fbe..c468bda1b67 100644
--- a/source/blender/compositor/nodes/COM_InvertNode.cpp
+++ b/source/blender/compositor/nodes/COM_InvertNode.cpp
@@ -26,11 +26,12 @@
#include "COM_ExecutionSystem.h"
#include "BKE_node.h"
-InvertNode::InvertNode(bNode *editorNode): Node(editorNode)
+InvertNode::InvertNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void InvertNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void InvertNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InvertOperation *operation = new InvertOperation();
bNode *node = this->getbNode();
diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp
index 75a2fe96646..50c1903982e 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.cpp
+++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp
@@ -41,8 +41,9 @@
#include "COM_SetAlphaOperation.h"
-KeyingNode::KeyingNode(bNode *editorNode): Node(editorNode)
+KeyingNode::KeyingNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
OutputSocket *KeyingNode::setupPreBlur(ExecutionSystem *graph, InputSocket *inputImage, int size, OutputSocket **originalImage)
@@ -189,7 +190,7 @@ void KeyingNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
postprocessedMatte = keyingOperation->getOutputSocket();
- if (keying_data->clip_black > 0.0f || keying_data->clip_white< 1.0f) {
+ if (keying_data->clip_black > 0.0f || keying_data->clip_white < 1.0f) {
postprocessedMatte = setupClip(graph, postprocessedMatte,
keying_data->edge_kernel_radius, keying_data->edge_kernel_tolerance,
keying_data->clip_black, keying_data->clip_white, false);
diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp
index ad58adae48b..0fb8d45d066 100644
--- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp
+++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp
@@ -29,11 +29,12 @@ extern "C" {
#include "DNA_movieclip_types.h"
}
-KeyingScreenNode::KeyingScreenNode(bNode *editorNode): Node(editorNode)
+KeyingScreenNode::KeyingScreenNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void KeyingScreenNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void KeyingScreenNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
OutputSocket *outputScreen = this->getOutputSocket(0);
diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp
index e55dd5e64d8..03034e34eb7 100644
--- a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp
+++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp
@@ -26,14 +26,15 @@
#include "COM_ProjectorLensDistortionOperation.h"
#include "COM_ScreenLensDistortionOperation.h"
-LensDistortionNode::LensDistortionNode(bNode *editorNode): Node(editorNode)
+LensDistortionNode::LensDistortionNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
bNode *editorNode = this->getbNode();
- NodeLensDist * data = (NodeLensDist*)editorNode->storage;
+ NodeLensDist *data = (NodeLensDist *)editorNode->storage;
if (data->proj) {
ProjectorLensDistortionOperation *operation = new ProjectorLensDistortionOperation();
diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
index 37976216106..be949e2cacb 100644
--- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
@@ -25,8 +25,10 @@
#include "COM_ConvertRGBToYUVOperation.h"
#include "COM_SetAlphaOperation.h"
-LuminanceMatteNode::LuminanceMatteNode(bNode *editorNode): Node(editorNode)
-{}
+LuminanceMatteNode::LuminanceMatteNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
void LuminanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
@@ -37,7 +39,7 @@ void LuminanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorC
ConvertRGBToYUVOperation *rgbToYUV = new ConvertRGBToYUVOperation();
LuminanceMatteOperation *operationSet = new LuminanceMatteOperation();
bNode *editorsnode = getbNode();
- operationSet->setSettings((NodeChroma*)editorsnode->storage);
+ operationSet->setSettings((NodeChroma *)editorsnode->storage);
inputSocket->relinkConnections(rgbToYUV->getInputSocket(0), 0, graph);
addLink(graph, rgbToYUV->getOutputSocket(), operationSet->getInputSocket(0));
diff --git a/source/blender/compositor/nodes/COM_MapUVNode.cpp b/source/blender/compositor/nodes/COM_MapUVNode.cpp
index e0e7e2594ed..447b8239a93 100644
--- a/source/blender/compositor/nodes/COM_MapUVNode.cpp
+++ b/source/blender/compositor/nodes/COM_MapUVNode.cpp
@@ -23,11 +23,12 @@
#include "COM_MapUVOperation.h"
#include "COM_ExecutionSystem.h"
-MapUVNode::MapUVNode(bNode *editorNode): Node(editorNode)
+MapUVNode::MapUVNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void MapUVNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void MapUVNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
MapUVOperation *operation = new MapUVOperation();
diff --git a/source/blender/compositor/nodes/COM_MapValueNode.cpp b/source/blender/compositor/nodes/COM_MapValueNode.cpp
index f56662b1d64..ba2fc804f42 100644
--- a/source/blender/compositor/nodes/COM_MapValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_MapValueNode.cpp
@@ -25,15 +25,16 @@
#include "COM_MapValueOperation.h"
#include "COM_ExecutionSystem.h"
-MapValueNode::MapValueNode(bNode *editorNode): Node(editorNode)
+MapValueNode::MapValueNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void MapValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void MapValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *colourSocket = this->getInputSocket(0);
OutputSocket *valueSocket = this->getOutputSocket(0);
- TexMapping *storage = (TexMapping*)this->getbNode()->storage;
+ TexMapping *storage = (TexMapping *)this->getbNode()->storage;
MapValueOperation *convertProg = new MapValueOperation();
convertProg->setSettings(storage);
colourSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph);
diff --git a/source/blender/compositor/nodes/COM_MaskNode.cpp b/source/blender/compositor/nodes/COM_MaskNode.cpp
index 4371a848a3d..ed07e41a649 100644
--- a/source/blender/compositor/nodes/COM_MaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_MaskNode.cpp
@@ -29,11 +29,12 @@ extern "C" {
#include "DNA_mask_types.h"
}
-MaskNode::MaskNode(bNode *editorNode): Node(editorNode)
+MaskNode::MaskNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
const RenderData *data = &context->getScene()->r;
@@ -54,7 +55,7 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c
operation->setMask(mask);
operation->setFramenumber(context->getFramenumber());
- operation->setSmooth((bool)editorNode->custom1);
+ operation->setSmooth((bool)editorNode->custom1);
graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp
index eabd0481e38..6e9b49253e7 100644
--- a/source/blender/compositor/nodes/COM_MathNode.cpp
+++ b/source/blender/compositor/nodes/COM_MathNode.cpp
@@ -24,61 +24,61 @@
#include "COM_MathBaseOperation.h"
#include "COM_ExecutionSystem.h"
-void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
- MathBaseOperation *operation=NULL;
+ MathBaseOperation *operation = NULL;
switch (this->getbNode()->custom1)
{
- case 0: /* Add */
+ case 0: /* Add */
operation = new MathAddOperation();
break;
- case 1: /* Subtract */
+ case 1: /* Subtract */
operation = new MathSubtractOperation();
break;
- case 2: /* Multiply */
+ case 2: /* Multiply */
operation = new MathMultiplyOperation();
break;
- case 3: /* Divide */
+ case 3: /* Divide */
operation = new MathDivideOperation();
break;
- case 4: /* Sine */
+ case 4: /* Sine */
operation = new MathSineOperation();
break;
- case 5: /* Cosine */
+ case 5: /* Cosine */
operation = new MathCosineOperation();
break;
- case 6: /* Tangent */
+ case 6: /* Tangent */
operation = new MathTangentOperation();
break;
- case 7: /* Arc-Sine */
+ case 7: /* Arc-Sine */
operation = new MathArcSineOperation();
break;
- case 8: /* Arc-Cosine */
+ case 8: /* Arc-Cosine */
operation = new MathArcCosineOperation();
break;
- case 9: /* Arc-Tangent */
+ case 9: /* Arc-Tangent */
operation = new MathArcTangentOperation();
break;
- case 10: /* Power */
+ case 10: /* Power */
operation = new MathPowerOperation();
break;
- case 11: /* Logarithm */
+ case 11: /* Logarithm */
operation = new MathLogarithmOperation();
break;
- case 12: /* Minimum */
+ case 12: /* Minimum */
operation = new MathMinimumOperation();
break;
- case 13: /* Maximum */
+ case 13: /* Maximum */
operation = new MathMaximumOperation();
break;
- case 14: /* Round */
+ case 14: /* Round */
operation = new MathRoundOperation();
break;
- case 15: /* Less Than */
+ case 15: /* Less Than */
operation = new MathLessThanOperation();
break;
- case 16: /* Greater Than */
+ case 16: /* Greater Than */
operation = new MathGreaterThanOperation();
break;
}
diff --git a/source/blender/compositor/nodes/COM_MixNode.cpp b/source/blender/compositor/nodes/COM_MixNode.cpp
index 42e32a4e55e..eb62ebd2635 100644
--- a/source/blender/compositor/nodes/COM_MixNode.cpp
+++ b/source/blender/compositor/nodes/COM_MixNode.cpp
@@ -46,12 +46,12 @@
#include "DNA_material_types.h" // the ramp types
-MixNode::MixNode(bNode *editorNode): Node(editorNode)
+MixNode::MixNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-
-void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *valueSocket = this->getInputSocket(0);
InputSocket *color1Socket = this->getInputSocket(1);
@@ -62,62 +62,62 @@ void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext * co
MixBaseOperation *convertProg;
switch (editorNode->custom1) {
- case MA_RAMP_ADD:
- convertProg = new MixAddOperation();
- break;
- case MA_RAMP_MULT:
- convertProg = new MixMultiplyOperation();
- break;
- case MA_RAMP_LIGHT:
- convertProg = new MixLightenOperation();
- break;
- case MA_RAMP_BURN:
- convertProg = new MixBurnOperation();
- break;
- case MA_RAMP_HUE:
- convertProg = new MixHueOperation();
- break;
- case MA_RAMP_COLOR:
- convertProg = new MixColorOperation();
- break;
- case MA_RAMP_SOFT:
- convertProg = new MixSoftLightOperation();
- break;
- case MA_RAMP_SCREEN:
- convertProg = new MixScreenOperation();
- break;
- case MA_RAMP_LINEAR:
- convertProg = new MixLinearLightOperation();
- break;
- case MA_RAMP_DIFF:
- convertProg = new MixDifferenceOperation();
- break;
- case MA_RAMP_SAT:
- convertProg = new MixSaturationOperation();
- break;
- case MA_RAMP_DIV:
- convertProg = new MixDivideOperation();
- break;
- case MA_RAMP_SUB:
- convertProg = new MixSubtractOperation();
- break;
- case MA_RAMP_DARK:
- convertProg = new MixDarkenOperation();
- break;
- case MA_RAMP_OVERLAY:
- convertProg = new MixOverlayOperation();
- break;
- case MA_RAMP_VAL:
- convertProg = new MixValueOperation();
- break;
- case MA_RAMP_DODGE:
- convertProg = new MixDodgeOperation();
- break;
-
- case MA_RAMP_BLEND:
- default:
- convertProg = new MixBlendOperation();
- break;
+ case MA_RAMP_ADD:
+ convertProg = new MixAddOperation();
+ break;
+ case MA_RAMP_MULT:
+ convertProg = new MixMultiplyOperation();
+ break;
+ case MA_RAMP_LIGHT:
+ convertProg = new MixLightenOperation();
+ break;
+ case MA_RAMP_BURN:
+ convertProg = new MixBurnOperation();
+ break;
+ case MA_RAMP_HUE:
+ convertProg = new MixHueOperation();
+ break;
+ case MA_RAMP_COLOR:
+ convertProg = new MixColorOperation();
+ break;
+ case MA_RAMP_SOFT:
+ convertProg = new MixSoftLightOperation();
+ break;
+ case MA_RAMP_SCREEN:
+ convertProg = new MixScreenOperation();
+ break;
+ case MA_RAMP_LINEAR:
+ convertProg = new MixLinearLightOperation();
+ break;
+ case MA_RAMP_DIFF:
+ convertProg = new MixDifferenceOperation();
+ break;
+ case MA_RAMP_SAT:
+ convertProg = new MixSaturationOperation();
+ break;
+ case MA_RAMP_DIV:
+ convertProg = new MixDivideOperation();
+ break;
+ case MA_RAMP_SUB:
+ convertProg = new MixSubtractOperation();
+ break;
+ case MA_RAMP_DARK:
+ convertProg = new MixDarkenOperation();
+ break;
+ case MA_RAMP_OVERLAY:
+ convertProg = new MixOverlayOperation();
+ break;
+ case MA_RAMP_VAL:
+ convertProg = new MixValueOperation();
+ break;
+ case MA_RAMP_DODGE:
+ convertProg = new MixDodgeOperation();
+ break;
+
+ case MA_RAMP_BLEND:
+ default:
+ convertProg = new MixBlendOperation();
+ break;
}
convertProg->setUseValueAlphaMultiply(this->getbNode()->custom2);
diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
index 083d1bf42b9..89bd0e8549e 100644
--- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp
+++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
@@ -33,11 +33,12 @@ extern "C" {
#include "IMB_imbuf.h"
}
-MovieClipNode::MovieClipNode(bNode *editorNode): Node(editorNode)
+MovieClipNode::MovieClipNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
OutputSocket *outputMovieClip = this->getOutputSocket(0);
OutputSocket *offsetXMovieClip = this->getOutputSocket(1);
@@ -46,10 +47,10 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
OutputSocket *angleMovieClip = this->getOutputSocket(4);
bNode *editorNode = this->getbNode();
- MovieClip *movieClip = (MovieClip*)editorNode->id;
- MovieClipUser *movieClipUser = (MovieClipUser*)editorNode->storage;
+ MovieClip *movieClip = (MovieClip *)editorNode->id;
+ MovieClipUser *movieClipUser = (MovieClipUser *)editorNode->storage;
- ImBuf * ibuf = NULL;
+ ImBuf *ibuf = NULL;
if (movieClip) {
ibuf = BKE_movieclip_get_ibuf(movieClip, movieClipUser);
}
@@ -90,7 +91,7 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
angle = 0.0f;
if (ibuf) {
- if (stab->flag&TRACKING_2D_STABILIZATION) {
+ if (stab->flag & TRACKING_2D_STABILIZATION) {
int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip, context->getFramenumber());
BKE_tracking_stabilization_data_get(&movieClip->tracking, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle);
@@ -98,25 +99,25 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
}
if (offsetXMovieClip->isConnected()) {
- SetValueOperation * operationSetValue = new SetValueOperation();
+ SetValueOperation *operationSetValue = new SetValueOperation();
operationSetValue->setValue(loc[0]);
offsetXMovieClip->relinkConnections(operationSetValue->getOutputSocket());
graph->addOperation(operationSetValue);
}
if (offsetYMovieClip->isConnected()) {
- SetValueOperation * operationSetValue = new SetValueOperation();
+ SetValueOperation *operationSetValue = new SetValueOperation();
operationSetValue->setValue(loc[1]);
offsetYMovieClip->relinkConnections(operationSetValue->getOutputSocket());
graph->addOperation(operationSetValue);
}
if (scaleMovieClip->isConnected()) {
- SetValueOperation * operationSetValue = new SetValueOperation();
+ SetValueOperation *operationSetValue = new SetValueOperation();
operationSetValue->setValue(scale);
scaleMovieClip->relinkConnections(operationSetValue->getOutputSocket());
graph->addOperation(operationSetValue);
}
if (angleMovieClip->isConnected()) {
- SetValueOperation * operationSetValue = new SetValueOperation();
+ SetValueOperation *operationSetValue = new SetValueOperation();
operationSetValue->setValue(angle);
angleMovieClip->relinkConnections(operationSetValue->getOutputSocket());
graph->addOperation(operationSetValue);
diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
index bdf4c53fa72..c29bc27cd80 100644
--- a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
+++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
@@ -28,16 +28,17 @@
MovieDistortionNode::MovieDistortionNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void MovieDistortionNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
+void MovieDistortionNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
OutputSocket *outputSocket = this->getOutputSocket(0);
bNode *bnode = this->getbNode();
- MovieClip * clip = (MovieClip*)bnode->id;
+ MovieClip *clip = (MovieClip *)bnode->id;
- MovieDistortionOperation * operation = new MovieDistortionOperation(bnode->custom1 == 1);
+ MovieDistortionOperation *operation = new MovieDistortionOperation(bnode->custom1 == 1);
operation->setMovieClip(clip);
operation->setFramenumber(context->getFramenumber());
diff --git a/source/blender/compositor/nodes/COM_MuteNode.cpp b/source/blender/compositor/nodes/COM_MuteNode.cpp
index 57b7871318b..f52b7216cca 100644
--- a/source/blender/compositor/nodes/COM_MuteNode.cpp
+++ b/source/blender/compositor/nodes/COM_MuteNode.cpp
@@ -20,21 +20,23 @@
* Monique Dewanchand
*/
+#include <stdio.h>
+
#include "COM_MuteNode.h"
#include "COM_SocketConnection.h"
-#include "stdio.h"
#include "COM_SetValueOperation.h"
#include "COM_SetVectorOperation.h"
#include "COM_SetColorOperation.h"
-MuteNode::MuteNode(bNode *editorNode): Node(editorNode)
+MuteNode::MuteNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void MuteNode::reconnect(ExecutionSystem * graph, OutputSocket * output)
+void MuteNode::reconnect(ExecutionSystem *graph, OutputSocket *output)
{
- vector<InputSocket*> &inputsockets = this->getInputSockets();
- for (unsigned int index = 0; index < inputsockets.size() ; index ++) {
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
+ for (unsigned int index = 0; index < inputsockets.size(); index++) {
InputSocket *input = inputsockets[index];
if (input->getDataType() == output->getDataType()) {
if (input->isConnected()) {
@@ -82,12 +84,12 @@ void MuteNode::reconnect(ExecutionSystem * graph, OutputSocket * output)
output->clearConnections();
}
-void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
- vector<OutputSocket*> &outputsockets = this->getOutputSockets();
+ vector<OutputSocket *> &outputsockets = this->getOutputSockets();
- for (unsigned int index = 0 ; index < outputsockets.size() ; index ++) {
- OutputSocket * output = outputsockets[index];
+ for (unsigned int index = 0; index < outputsockets.size(); index++) {
+ OutputSocket *output = outputsockets[index];
if (output->isConnected()) {
reconnect(graph, output);
}
diff --git a/source/blender/compositor/nodes/COM_NormalNode.cpp b/source/blender/compositor/nodes/COM_NormalNode.cpp
index 0b1faafe302..e00e71e50e9 100644
--- a/source/blender/compositor/nodes/COM_NormalNode.cpp
+++ b/source/blender/compositor/nodes/COM_NormalNode.cpp
@@ -26,19 +26,21 @@
#include "COM_DotproductOperation.h"
#include "COM_SetVectorOperation.h"
-NormalNode::NormalNode(bNode *editorNode): Node(editorNode)
-{}
+NormalNode::NormalNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
-void NormalNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void NormalNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
OutputSocket *outputSocket = this->getOutputSocket(0);
OutputSocket *outputSocketDotproduct = this->getOutputSocket(1);
bNode *editorNode = this->getbNode();
- SetVectorOperation * operationSet = new SetVectorOperation();
- bNodeSocket * insock = (bNodeSocket*)editorNode->outputs.first;
- bNodeSocketValueVector *dval = (bNodeSocketValueVector*)insock->default_value;
+ SetVectorOperation *operationSet = new SetVectorOperation();
+ bNodeSocket *insock = (bNodeSocket *)editorNode->outputs.first;
+ bNodeSocketValueVector *dval = (bNodeSocketValueVector *)insock->default_value;
operationSet->setX(dval->value[0]);
operationSet->setY(dval->value[1]);
operationSet->setZ(dval->value[2]);
diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.cpp b/source/blender/compositor/nodes/COM_NormalizeNode.cpp
index 11173b3a73f..7c1c695f8b6 100644
--- a/source/blender/compositor/nodes/COM_NormalizeNode.cpp
+++ b/source/blender/compositor/nodes/COM_NormalizeNode.cpp
@@ -23,11 +23,12 @@
#include "COM_NormalizeOperation.h"
#include "COM_ExecutionSystem.h"
-NormalizeNode::NormalizeNode(bNode *editorNode): Node(editorNode)
+NormalizeNode::NormalizeNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void NormalizeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void NormalizeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
NormalizeOperation *operation = new NormalizeOperation();
diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cpp b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
index e5deb595d78..db7fbffea4f 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
@@ -27,28 +27,31 @@
#include "BLI_path_util.h"
#include "BKE_utildefines.h"
-OutputFileNode::OutputFileNode(bNode *editorNode): Node(editorNode)
+OutputFileNode::OutputFileNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
- NodeImageMultiFile *storage = (NodeImageMultiFile*)this->getbNode()->storage;
+ NodeImageMultiFile *storage = (NodeImageMultiFile *)this->getbNode()->storage;
if (!context->isRendering()) {
- /* XXX TODO as in previous implementation?
- * add dummy operations and exit, to prevent file writing on each compo update.
+ /* only output files when rendering a sequence -
+ * otherwise, it overwrites the output files just
+ * scrubbing through the timeline when the compositor updates.
*/
+ return;
}
- if (storage->format.imtype==R_IMF_IMTYPE_MULTILAYER) {
+ if (storage->format.imtype == R_IMF_IMTYPE_MULTILAYER) {
/* single output operation for the multilayer file */
OutputOpenExrMultiLayerOperation *outputOperation = new OutputOpenExrMultiLayerOperation(
- context->getScene(), context->getbNodeTree(), storage->base_path, storage->format.exr_codec);
+ context->getScene(), context->getbNodeTree(), storage->base_path, storage->format.exr_codec);
int num_inputs = getNumberOfInputSockets();
bool hasConnections = false;
- for (int i=0; i < num_inputs; ++i) {
+ for (int i = 0; i < num_inputs; ++i) {
InputSocket *input = getInputSocket(i);
if (input->isConnected()) {
hasConnections = true;
@@ -63,10 +66,10 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
graph->addOperation(outputOperation);
}
- else { /* single layer format */
+ else { /* single layer format */
int num_inputs = getNumberOfInputSockets();
bool previewAdded = false;
- for (int i=0; i < num_inputs; ++i) {
+ for (int i = 0; i < num_inputs; ++i) {
InputSocket *input = getInputSocket(i);
if (input->isConnected()) {
NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage;
@@ -77,7 +80,7 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path);
OutputSingleLayerOperation *outputOperation = new OutputSingleLayerOperation(
- context->getScene(), context->getbNodeTree(), input->getDataType(), format, path);
+ context->getScene(), context->getbNodeTree(), input->getDataType(), format, path);
input->relinkConnections(outputOperation->getInputSocket(0));
graph->addOperation(outputOperation);
if (!previewAdded) {
diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
index 8216205b925..95e759fde24 100644
--- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
+++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
@@ -47,14 +47,15 @@
#include "COM_ScaleOperation.h"
#include "COM_SetValueOperation.h"
-RenderLayersNode::RenderLayersNode(bNode *editorNode): Node(editorNode)
+RenderLayersNode::RenderLayersNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputSocketNumber, RenderLayersBaseProg * operation)
+void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputSocketNumber, RenderLayersBaseProg *operation)
{
OutputSocket *outputSocket = this->getOutputSocket(outputSocketNumber);
- Scene *scene = (Scene*)this->getbNode()->id;
+ Scene *scene = (Scene *)this->getbNode()->id;
short layerId = this->getbNode()->custom1;
if (outputSocket->isConnected()) {
@@ -79,7 +80,7 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputS
}
}
-void RenderLayersNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void RenderLayersNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
testSocketConnection(graph, 0, new RenderLayersColourProg());
testSocketConnection(graph, 1, new RenderLayersAlphaProg());
diff --git a/source/blender/compositor/nodes/COM_RotateNode.cpp b/source/blender/compositor/nodes/COM_RotateNode.cpp
index 48acc567739..bb058d18b80 100644
--- a/source/blender/compositor/nodes/COM_RotateNode.cpp
+++ b/source/blender/compositor/nodes/COM_RotateNode.cpp
@@ -28,9 +28,10 @@
RotateNode::RotateNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void RotateNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
+void RotateNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
InputSocket *inputDegreeSocket = this->getInputSocket(1);
@@ -39,15 +40,15 @@ void RotateNode::convertToOperations(ExecutionSystem *system, CompositorContext
SetSamplerOperation *sampler = new SetSamplerOperation();
switch (this->getbNode()->custom1) {
- case 0:
- sampler->setSampler(COM_PS_NEAREST);
- break ;
- case 1:
- sampler->setSampler(COM_PS_BILINEAR);
- break;
- case 2:
- sampler->setSampler(COM_PS_BICUBIC);
- break;
+ case 0:
+ sampler->setSampler(COM_PS_NEAREST);
+ break;
+ case 1:
+ sampler->setSampler(COM_PS_BILINEAR);
+ break;
+ case 2:
+ sampler->setSampler(COM_PS_BICUBIC);
+ break;
}
diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp
index 870ed8f2484..17b521c589d 100644
--- a/source/blender/compositor/nodes/COM_ScaleNode.cpp
+++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp
@@ -29,6 +29,7 @@
ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp b/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp
index cfce56a080a..4f93b226fa1 100644
--- a/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp
+++ b/source/blender/compositor/nodes/COM_SeparateHSVANode.cpp
@@ -27,11 +27,12 @@
#include "COM_SetValueOperation.h"
#include "COM_ConvertRGBToHSVOperation.h"
-SeparateHSVANode::SeparateHSVANode(bNode *editorNode): SeparateRGBANode(editorNode)
+SeparateHSVANode::SeparateHSVANode(bNode *editorNode) : SeparateRGBANode(editorNode)
{
+ /* pass */
}
-void SeparateHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void SeparateHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
ConvertRGBToHSVOperation *operation = new ConvertRGBToHSVOperation();
InputSocket *inputSocket = this->getInputSocket(0);
diff --git a/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp b/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
index dd154fe604d..67ac6ffc388 100644
--- a/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
+++ b/source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
@@ -28,12 +28,13 @@
#include "DNA_material_types.h" // the ramp types
-SeparateRGBANode::SeparateRGBANode(bNode *editorNode): Node(editorNode)
+SeparateRGBANode::SeparateRGBANode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void SeparateRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void SeparateRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *imageSocket = this->getInputSocket(0);
OutputSocket *outputRSocket = this->getOutputSocket(0);
diff --git a/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp b/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp
index 68d20235de7..154e2bcd550 100644
--- a/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp
+++ b/source/blender/compositor/nodes/COM_SeparateYCCANode.cpp
@@ -25,8 +25,9 @@
#include "COM_SetValueOperation.h"
#include "COM_ConvertRGBToYCCOperation.h"
-SeparateYCCANode::SeparateYCCANode(bNode *editorNode): SeparateRGBANode(editorNode)
+SeparateYCCANode::SeparateYCCANode(bNode *editorNode) : SeparateRGBANode(editorNode)
{
+ /* pass */
}
void SeparateYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp b/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp
index 650e5d1340b..8a647b7f849 100644
--- a/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp
+++ b/source/blender/compositor/nodes/COM_SeparateYUVANode.cpp
@@ -25,8 +25,9 @@
#include "COM_SetValueOperation.h"
#include "COM_ConvertRGBToYUVOperation.h"
-SeparateYUVANode::SeparateYUVANode(bNode *editorNode): SeparateRGBANode(editorNode)
+SeparateYUVANode::SeparateYUVANode(bNode *editorNode) : SeparateRGBANode(editorNode)
{
+ /* pass */
}
void SeparateYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
index 1d09b81c4d2..709dc75b502 100644
--- a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
+++ b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
@@ -24,7 +24,7 @@
#include "COM_SetAlphaOperation.h"
#include "COM_ExecutionSystem.h"
-void SetAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void SetAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
SetAlphaOperation *operation = new SetAlphaOperation();
diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
index cdb844cad54..bfb32a96156 100644
--- a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
+++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
@@ -28,7 +28,7 @@
#include "COM_SetVectorOperation.h"
#include "COM_SetColorOperation.h"
-SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput): Node(editorNode, false)
+SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput) : Node(editorNode, false)
{
DataType dt;
@@ -43,10 +43,10 @@ SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bN
this->addOutputSocket(dt, editorOutput);
}
-void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
- OutputSocket * outputsocket = this->getOutputSocket(0);
- InputSocket * inputsocket = this->getInputSocket(0);
+ OutputSocket *outputsocket = this->getOutputSocket(0);
+ InputSocket *inputsocket = this->getInputSocket(0);
if (outputsocket->isConnected()) {
if (inputsocket->isConnected()) {
SocketProxyOperation *operation = new SocketProxyOperation(this->getOutputSocket()->getDataType());
@@ -57,33 +57,33 @@ void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorCont
else {
/* If input is not connected, add a constant value operation instead */
switch (outputsocket->getDataType()) {
- case COM_DT_VALUE:
- {
- SetValueOperation *operation = new SetValueOperation();
- bNodeSocketValueFloat *dval = (bNodeSocketValueFloat*)inputsocket->getbNodeSocket()->default_value;
- operation->setValue(dval->value);
- outputsocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- break;
- }
- case COM_DT_COLOR:
- {
- SetColorOperation *operation = new SetColorOperation();
- bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA*)inputsocket->getbNodeSocket()->default_value;
- operation->setChannels(dval->value);
- outputsocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- break;
- }
- case COM_DT_VECTOR:
- {
- SetVectorOperation *operation = new SetVectorOperation();
- bNodeSocketValueVector *dval = (bNodeSocketValueVector*)inputsocket->getbNodeSocket()->default_value;
- operation->setVector(dval->value);
- outputsocket->relinkConnections(operation->getOutputSocket(0));
- graph->addOperation(operation);
- break;
- }
+ case COM_DT_VALUE:
+ {
+ SetValueOperation *operation = new SetValueOperation();
+ bNodeSocketValueFloat *dval = (bNodeSocketValueFloat *)inputsocket->getbNodeSocket()->default_value;
+ operation->setValue(dval->value);
+ outputsocket->relinkConnections(operation->getOutputSocket(0));
+ graph->addOperation(operation);
+ break;
+ }
+ case COM_DT_COLOR:
+ {
+ SetColorOperation *operation = new SetColorOperation();
+ bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA *)inputsocket->getbNodeSocket()->default_value;
+ operation->setChannels(dval->value);
+ outputsocket->relinkConnections(operation->getOutputSocket(0));
+ graph->addOperation(operation);
+ break;
+ }
+ case COM_DT_VECTOR:
+ {
+ SetVectorOperation *operation = new SetVectorOperation();
+ bNodeSocketValueVector *dval = (bNodeSocketValueVector *)inputsocket->getbNodeSocket()->default_value;
+ operation->setVector(dval->value);
+ outputsocket->relinkConnections(operation->getOutputSocket(0));
+ graph->addOperation(operation);
+ break;
+ }
}
}
}
diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
index 7e8a218cbc1..22a00410384 100644
--- a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
@@ -28,6 +28,7 @@
SplitViewerNode::SplitViewerNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
index 7234e71a43c..85b8695263f 100644
--- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
+++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
@@ -32,18 +32,19 @@ extern "C" {
#include "BKE_tracking.h"
}
-Stabilize2dNode::Stabilize2dNode(bNode *editorNode): Node(editorNode)
+Stabilize2dNode::Stabilize2dNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *imageInput = this->getInputSocket(0);
MovieClip *clip = (MovieClip *)getbNode()->id;
- ScaleOperation * scaleOperation = new ScaleOperation();
- RotateOperation * rotateOperation = new RotateOperation();
- TranslateOperation * translateOperation = new TranslateOperation();
+ ScaleOperation *scaleOperation = new ScaleOperation();
+ RotateOperation *rotateOperation = new RotateOperation();
+ TranslateOperation *translateOperation = new TranslateOperation();
MovieClipAttributeOperation *scaleAttribute = new MovieClipAttributeOperation();
MovieClipAttributeOperation *angleAttribute = new MovieClipAttributeOperation();
MovieClipAttributeOperation *xAttribute = new MovieClipAttributeOperation();
diff --git a/source/blender/compositor/nodes/COM_SwitchNode.cpp b/source/blender/compositor/nodes/COM_SwitchNode.cpp
index bb1a9c119f8..2a4616fcd3e 100644
--- a/source/blender/compositor/nodes/COM_SwitchNode.cpp
+++ b/source/blender/compositor/nodes/COM_SwitchNode.cpp
@@ -24,14 +24,15 @@
#include "COM_ExecutionSystem.h"
#include "COM_SocketProxyOperation.h"
-SwitchNode::SwitchNode(bNode *editorNode): Node(editorNode)
+SwitchNode::SwitchNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void SwitchNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void SwitchNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
- SocketProxyOperation * operation = new SocketProxyOperation(COM_DT_COLOR);
+ SocketProxyOperation *operation = new SocketProxyOperation(COM_DT_COLOR);
int switchFrame = this->getbNode()->custom1;
if (!switchFrame) {
diff --git a/source/blender/compositor/nodes/COM_TextureNode.cpp b/source/blender/compositor/nodes/COM_TextureNode.cpp
index fe8a8e2250e..a3526e3c1a1 100644
--- a/source/blender/compositor/nodes/COM_TextureNode.cpp
+++ b/source/blender/compositor/nodes/COM_TextureNode.cpp
@@ -24,14 +24,15 @@
#include "COM_ExecutionSystem.h"
#include "COM_TextureOperation.h"
-TextureNode::TextureNode(bNode *editorNode): Node(editorNode)
+TextureNode::TextureNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
+void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
{
bNode *editorNode = this->getbNode();
- Tex *texture = (Tex*)editorNode->id;
+ Tex *texture = (Tex *)editorNode->id;
TextureOperation *operation = new TextureOperation();
this->getOutputSocket(1)->relinkConnections(operation->getOutputSocket());
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
diff --git a/source/blender/compositor/nodes/COM_TimeNode.cpp b/source/blender/compositor/nodes/COM_TimeNode.cpp
index b3ce27a3829..8e155e375e1 100644
--- a/source/blender/compositor/nodes/COM_TimeNode.cpp
+++ b/source/blender/compositor/nodes/COM_TimeNode.cpp
@@ -29,11 +29,12 @@ extern "C" {
}
#include "BLI_utildefines.h"
-TimeNode::TimeNode(bNode *editorNode): Node(editorNode)
+TimeNode::TimeNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
SetValueOperation *operation = new SetValueOperation();
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
@@ -50,10 +51,10 @@ void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c
fac = 1.0f;
}
else if (node->custom1 < node->custom2) {
- fac = (context->getFramenumber() - node->custom1)/(float)(node->custom2-node->custom1);
+ fac = (context->getFramenumber() - node->custom1) / (float)(node->custom2 - node->custom1);
}
- fac = curvemapping_evaluateF((CurveMapping*)node->storage, 0, fac);
+ fac = curvemapping_evaluateF((CurveMapping *)node->storage, 0, fac);
operation->setValue(CLAMPIS(fac, 0.0f, 1.0f));
graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_TonemapNode.cpp b/source/blender/compositor/nodes/COM_TonemapNode.cpp
index 80f02f3edbb..a1f33ed464b 100644
--- a/source/blender/compositor/nodes/COM_TonemapNode.cpp
+++ b/source/blender/compositor/nodes/COM_TonemapNode.cpp
@@ -25,14 +25,15 @@
#include "COM_TonemapOperation.h"
#include "COM_ExecutionSystem.h"
-TonemapNode::TonemapNode(bNode *editorNode): Node(editorNode)
+TonemapNode::TonemapNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void TonemapNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
+void TonemapNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
{
- NodeTonemap *data = (NodeTonemap*)this->getbNode()->storage;
- TonemapOperation *operation = data->type==1?new PhotoreceptorTonemapOperation():new TonemapOperation();
+ NodeTonemap *data = (NodeTonemap *)this->getbNode()->storage;
+ TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : new TonemapOperation();
operation->setData(data);
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
diff --git a/source/blender/compositor/nodes/COM_TransformNode.cpp b/source/blender/compositor/nodes/COM_TransformNode.cpp
index da3e85036a5..ff6e276d1ac 100644
--- a/source/blender/compositor/nodes/COM_TransformNode.cpp
+++ b/source/blender/compositor/nodes/COM_TransformNode.cpp
@@ -28,11 +28,12 @@
#include "COM_SetValueOperation.h"
#include "COM_SetSamplerOperation.h"
-TransformNode::TransformNode(bNode *editorNode): Node(editorNode)
+TransformNode::TransformNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void TransformNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void TransformNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *imageInput = this->getInputSocket(0);
InputSocket *xInput = this->getInputSocket(1);
@@ -40,21 +41,21 @@ void TransformNode::convertToOperations(ExecutionSystem *graph, CompositorContex
InputSocket *angleInput = this->getInputSocket(3);
InputSocket *scaleInput = this->getInputSocket(4);
- ScaleOperation * scaleOperation = new ScaleOperation();
- RotateOperation * rotateOperation = new RotateOperation();
- TranslateOperation * translateOperation = new TranslateOperation();
+ ScaleOperation *scaleOperation = new ScaleOperation();
+ RotateOperation *rotateOperation = new RotateOperation();
+ TranslateOperation *translateOperation = new TranslateOperation();
SetSamplerOperation *sampler = new SetSamplerOperation();
switch (this->getbNode()->custom1) {
- case 0:
- sampler->setSampler(COM_PS_NEAREST);
- break ;
- case 1:
- sampler->setSampler(COM_PS_BILINEAR);
- break;
- case 2:
- sampler->setSampler(COM_PS_BICUBIC);
- break;
+ case 0:
+ sampler->setSampler(COM_PS_NEAREST);
+ break;
+ case 1:
+ sampler->setSampler(COM_PS_BILINEAR);
+ break;
+ case 2:
+ sampler->setSampler(COM_PS_BICUBIC);
+ break;
}
imageInput->relinkConnections(sampler->getInputSocket(0), 0, graph);
diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cpp b/source/blender/compositor/nodes/COM_TranslateNode.cpp
index 407c6da4e4d..c805f8f8baa 100644
--- a/source/blender/compositor/nodes/COM_TranslateNode.cpp
+++ b/source/blender/compositor/nodes/COM_TranslateNode.cpp
@@ -27,9 +27,10 @@
TranslateNode::TranslateNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void TranslateNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void TranslateNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputSocket = this->getInputSocket(0);
InputSocket *inputXSocket = this->getInputSocket(1);
diff --git a/source/blender/compositor/nodes/COM_ValueNode.cpp b/source/blender/compositor/nodes/COM_ValueNode.cpp
index 39245e75a2f..89b0602f8b0 100644
--- a/source/blender/compositor/nodes/COM_ValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_ValueNode.cpp
@@ -25,15 +25,16 @@
#include "COM_SetValueOperation.h"
#include "COM_ExecutionSystem.h"
-ValueNode::ValueNode(bNode *editorNode): Node(editorNode)
+ValueNode::ValueNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void ValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void ValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
SetValueOperation *operation = new SetValueOperation();
bNodeSocket *socket = this->getEditorOutputSocket(0);
- bNodeSocketValueFloat *dval = (bNodeSocketValueFloat*)socket->default_value;
+ bNodeSocketValueFloat *dval = (bNodeSocketValueFloat *)socket->default_value;
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
operation->setValue(dval->value);
graph->addOperation(operation);
diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
index 78b9065b4da..5ef384a9984 100644
--- a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
@@ -26,6 +26,7 @@
VectorBlurNode::VectorBlurNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
void VectorBlurNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.cpp b/source/blender/compositor/nodes/COM_VectorCurveNode.cpp
index 908e1a19f16..ee32c3b77a3 100644
--- a/source/blender/compositor/nodes/COM_VectorCurveNode.cpp
+++ b/source/blender/compositor/nodes/COM_VectorCurveNode.cpp
@@ -25,18 +25,19 @@
#include "COM_VectorCurveOperation.h"
#include "COM_ExecutionSystem.h"
-VectorCurveNode::VectorCurveNode(bNode *editorNode): Node(editorNode)
+VectorCurveNode::VectorCurveNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
-void VectorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
+void VectorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
VectorCurveOperation *operation = new VectorCurveOperation();
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- operation->setCurveMapping((CurveMapping*)this->getbNode()->storage);
+ operation->setCurveMapping((CurveMapping *)this->getbNode()->storage);
graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
index a7974efe954..309568c3aec 100644
--- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
@@ -28,7 +28,9 @@
ViewLevelsNode::ViewLevelsNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
+
void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *input = this->getInputSocket(0);
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp
index 79c76f2e89e..9228fdbef85 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp
@@ -28,6 +28,7 @@
ViewerNode::ViewerNode(bNode *editorNode) : Node(editorNode)
{
+ /* pass */
}
void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cpp b/source/blender/compositor/nodes/COM_ZCombineNode.cpp
index 2495d1a5ab2..f48fca72c05 100644
--- a/source/blender/compositor/nodes/COM_ZCombineNode.cpp
+++ b/source/blender/compositor/nodes/COM_ZCombineNode.cpp
@@ -30,10 +30,10 @@
#include "DNA_material_types.h" // the ramp types
-void ZCombineNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
+void ZCombineNode::convertToOperations(ExecutionSystem *system, CompositorContext *context)
{
if (this->getOutputSocket(0)->isConnected()) {
- ZCombineOperation * operation = NULL;
+ ZCombineOperation *operation = NULL;
if (this->getbNode()->custom1) {
operation = new ZCombineAlphaOperation();
}
@@ -48,7 +48,7 @@ void ZCombineNode::convertToOperations(ExecutionSystem *system, CompositorContex
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
system->addOperation(operation);
if (this->getOutputSocket(1)->isConnected()) {
- MathMinimumOperation * zoperation = new MathMinimumOperation();
+ MathMinimumOperation *zoperation = new MathMinimumOperation();
addLink(system, operation->getInputSocket(1)->getConnection()->getFromSocket(), zoperation->getInputSocket(0));
addLink(system, operation->getInputSocket(3)->getConnection()->getFromSocket(), zoperation->getInputSocket(1));
this->getOutputSocket(1)->relinkConnections(zoperation->getOutputSocket());
@@ -57,7 +57,7 @@ void ZCombineNode::convertToOperations(ExecutionSystem *system, CompositorContex
}
else {
if (this->getOutputSocket(1)->isConnected()) {
- MathMinimumOperation * zoperation = new MathMinimumOperation();
+ MathMinimumOperation *zoperation = new MathMinimumOperation();
this->getInputSocket(1)->relinkConnections(zoperation->getInputSocket(0), 1, system);
this->getInputSocket(3)->relinkConnections(zoperation->getInputSocket(1), 3, system);
this->getOutputSocket(1)->relinkConnections(zoperation->getOutputSocket());
diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp
index 0c9f9b97031..e614e1fa15a 100644
--- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_AlphaOverKeyOperation.h"
-AlphaOverKeyOperation::AlphaOverKeyOperation(): MixBaseOperation()
+AlphaOverKeyOperation::AlphaOverKeyOperation() : MixBaseOperation()
{
+ /* pass */
}
void AlphaOverKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -43,12 +44,12 @@ void AlphaOverKeyOperation::executePixel(float *outputValue, float x, float y, P
copy_v4_v4(outputValue, inputOverColor);
}
else {
- float premul = value[0]*inputOverColor[3];
+ float premul = value[0] * inputOverColor[3];
float mul = 1.0f - premul;
- outputValue[0] = (mul*inputColor1[0]) + premul*inputOverColor[0];
- outputValue[1] = (mul*inputColor1[1]) + premul*inputOverColor[1];
- outputValue[2] = (mul*inputColor1[2]) + premul*inputOverColor[2];
- outputValue[3] = (mul*inputColor1[3]) + value[0]*inputOverColor[3];
+ outputValue[0] = (mul * inputColor1[0]) + premul * inputOverColor[0];
+ outputValue[1] = (mul * inputColor1[1]) + premul * inputOverColor[1];
+ outputValue[2] = (mul * inputColor1[2]) + premul * inputOverColor[2];
+ outputValue[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
}
}
diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
index 850bbd5cc00..81c1e4d2587 100644
--- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_AlphaOverMixedOperation.h"
-AlphaOverMixedOperation::AlphaOverMixedOperation(): MixBaseOperation()
+AlphaOverMixedOperation::AlphaOverMixedOperation() : MixBaseOperation()
{
this->x = 0.0f;
}
@@ -44,14 +44,14 @@ void AlphaOverMixedOperation::executePixel(float outputValue[4], float x, float
copy_v4_v4(outputValue, inputOverColor);
}
else {
- float addfac = 1.0f - this->x + inputOverColor[3]*this->x;
- float premul = value[0]*addfac;
- float mul = 1.0f - value[0]*inputOverColor[3];
-
- outputValue[0] = (mul*inputColor1[0]) + premul*inputOverColor[0];
- outputValue[1] = (mul*inputColor1[1]) + premul*inputOverColor[1];
- outputValue[2] = (mul*inputColor1[2]) + premul*inputOverColor[2];
- outputValue[3] = (mul*inputColor1[3]) + value[0]*inputOverColor[3];
+ float addfac = 1.0f - this->x + inputOverColor[3] * this->x;
+ float premul = value[0] * addfac;
+ float mul = 1.0f - value[0] * inputOverColor[3];
+
+ outputValue[0] = (mul * inputColor1[0]) + premul * inputOverColor[0];
+ outputValue[1] = (mul * inputColor1[1]) + premul * inputOverColor[1];
+ outputValue[2] = (mul * inputColor1[2]) + premul * inputOverColor[2];
+ outputValue[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
}
}
diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
index db67f2e0406..a6bf8b8834c 100644
--- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_AlphaOverPremultiplyOperation.h"
-AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation(): MixBaseOperation()
+AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation() : MixBaseOperation()
{
+ /* pass */
}
void AlphaOverPremultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -37,19 +38,19 @@ void AlphaOverPremultiplyOperation::executePixel(float *outputValue, float x, fl
inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers);
/* Zero alpha values should still permit an add of RGB data */
- if (inputOverColor[3]<0.0f) {
+ if (inputOverColor[3] < 0.0f) {
copy_v4_v4(outputValue, inputColor1);
}
else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) {
copy_v4_v4(outputValue, inputOverColor);
}
else {
- float mul = 1.0f - value[0]*inputOverColor[3];
+ float mul = 1.0f - value[0] * inputOverColor[3];
- outputValue[0] = (mul*inputColor1[0]) + value[0]*inputOverColor[0];
- outputValue[1] = (mul*inputColor1[1]) + value[0]*inputOverColor[1];
- outputValue[2] = (mul*inputColor1[2]) + value[0]*inputOverColor[2];
- outputValue[3] = (mul*inputColor1[3]) + value[0]*inputOverColor[3];
+ outputValue[0] = (mul * inputColor1[0]) + value[0] * inputOverColor[0];
+ outputValue[1] = (mul * inputColor1[1]) + value[0] * inputOverColor[1];
+ outputValue[2] = (mul * inputColor1[2]) + value[0] * inputOverColor[2];
+ outputValue[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
}
}
diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
index 4cd9552b108..458d11f2616 100644
--- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
+++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
@@ -28,7 +28,7 @@ extern "C" {
}
-AntiAliasOperation::AntiAliasOperation(): NodeOperation()
+AntiAliasOperation::AntiAliasOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -42,14 +42,14 @@ 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, MemoryBuffer *inputBuffers[], void *data)
{
if (y < 0 || (unsigned int)y >= this->height || x < 0 || (unsigned int)x >= this->width) {
color[0] = 0.0f;
}
else {
- int offset = y*this->width + x;
- color[0] = buffer[offset]/255.0f;
+ int offset = y * this->width + x;
+ color[0] = buffer[offset] / 255.0f;
}
}
@@ -84,17 +84,17 @@ bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
void *AntiAliasOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
{
- if (this->buffer) {return buffer;}
+ if (this->buffer) {return buffer; }
lockMutex();
if (this->buffer == NULL) {
- MemoryBuffer *tile = (MemoryBuffer*)valueReader->initializeTileData(rect, memoryBuffers);
- int size = tile->getHeight()*tile->getWidth();
- float * input = tile->getBuffer();
+ MemoryBuffer *tile = (MemoryBuffer *)valueReader->initializeTileData(rect, memoryBuffers);
+ int size = tile->getHeight() * tile->getWidth();
+ float *input = tile->getBuffer();
char *valuebuffer = new char[size];
- for (int i = 0 ; i < size ; i ++) {
+ for (int i = 0; i < size; i++) {
float in = input[i * COM_NUMBER_OF_CHANNELS];
- if (in < 0.0f) { in = 0.0f;}
- if (in > 1.0f) {in = 1.0f;}
+ if (in < 0.0f) { in = 0.0f; }
+ if (in > 1.0f) {in = 1.0f; }
valuebuffer[i] = in * 255;
}
antialias_tagbuf(tile->getWidth(), tile->getHeight(), valuebuffer);
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index bb915fec590..a233c7a50ae 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -27,11 +27,11 @@ extern "C" {
#include "RE_pipeline.h"
}
-BlurBaseOperation::BlurBaseOperation() : NodeOperation()
+BlurBaseOperation::BlurBaseOperation(DataType data_type=COM_DT_COLOR) : NodeOperation()
{
- this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(data_type);
this->addInputSocket(COM_DT_VALUE);
- this->addOutputSocket(COM_DT_COLOR);
+ this->addOutputSocket(data_type);
this->setComplex(true);
this->inputProgram = NULL;
this->data = NULL;
@@ -89,6 +89,29 @@ float *BlurBaseOperation::make_gausstab(int rad)
return gausstab;
}
+/* normalized distance from the current (inverted so 1.0 is close and 0.0 is far)
+ * 'ease' is applied after, looks nicer */
+float *BlurBaseOperation::make_dist_fac_inverse(int rad)
+{
+ float *dist_fac_invert, val;
+ int i, n;
+
+ n = 2 * rad + 1;
+
+ dist_fac_invert = new float[n];
+
+ for (i = -rad; i <= rad; i++) {
+ val = 1.0f - fabsf(((float)i / (float)rad));
+
+ /* ease - gives less hard lines for dilate/erode feather */
+ val = (3.0f * val * val - 2.0f * val * val * val);
+
+ dist_fac_invert[i + rad] = val;
+ }
+
+ return dist_fac_invert;
+}
+
void BlurBaseOperation::deinitExecution()
{
this->inputProgram = NULL;
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h
index 84fc243a5af..33c07abbb36 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.h
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h
@@ -35,8 +35,9 @@ protected:
SocketReader *inputProgram;
SocketReader *inputSize;
NodeBlurData *data;
- BlurBaseOperation();
+ BlurBaseOperation(DataType data_type);
float *make_gausstab(int rad);
+ float *make_dist_fac_inverse(int rad);
float size;
bool deleteData;
bool sizeavailable;
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
index dca087bb587..e2fce504791 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
@@ -73,13 +73,13 @@ void BokehBlurOperation::initExecution()
void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
- float tempColor[4];
+ float color_accum[4];
float tempBoundingBox[4];
float bokeh[4];
inputBoundingBoxReader->read(tempBoundingBox, x, y, COM_PS_NEAREST, inputBuffers);
if (tempBoundingBox[0] > 0.0f) {
- float overallmultiplyer[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
int bufferwidth = inputBuffer->getWidth();
@@ -96,7 +96,7 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
maxy = min(maxy, inputBuffer->getRect()->ymax);
maxx = min(maxx, inputBuffer->getRect()->xmax);
- zero_v4(tempColor);
+ zero_v4(color_accum);
int step = getStep();
int offsetadd = getOffsetAdd();
@@ -108,15 +108,15 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
float u = this->bokehMidX - (nx - x) * m;
float v = this->bokehMidY - (ny - y) * m;
inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers);
- madd_v4_v4v4(tempColor, bokeh, &buffer[bufferindex]);
- add_v4_v4(overallmultiplyer, bokeh);
+ madd_v4_v4v4(color_accum, bokeh, &buffer[bufferindex]);
+ add_v4_v4(multiplier_accum, bokeh);
bufferindex += offsetadd;
}
}
- color[0] = tempColor[0] * (1.0f / overallmultiplyer[0]);
- color[1] = tempColor[1] * (1.0f / overallmultiplyer[1]);
- color[2] = tempColor[2] * (1.0f / overallmultiplyer[2]);
- color[3] = tempColor[3] * (1.0f / overallmultiplyer[3]);
+ color[0] = color_accum[0] * (1.0f / multiplier_accum[0]);
+ color[1] = color_accum[1] * (1.0f / multiplier_accum[1]);
+ color[2] = color_accum[2] * (1.0f / multiplier_accum[2]);
+ color[3] = color_accum[3] * (1.0f / multiplier_accum[3]);
}
else {
inputProgram->read(color, x, y, COM_PS_NEAREST, inputBuffers);
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp
index 189ba98aa57..abb378e2adb 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_BokehImageOperation.h"
#include "BLI_math.h"
-BokehImageOperation::BokehImageOperation(): NodeOperation()
+BokehImageOperation::BokehImageOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_COLOR);
this->deleteData = false;
@@ -35,7 +35,7 @@ void BokehImageOperation::initExecution()
this->center[0] = this->centerX;
this->center[1] = this->centerY;
this->inverseRounding = 1.0f - this->data->rounding;
- this->circularDistance = getWidth()/2;
+ this->circularDistance = getWidth() / 2;
this->flapRad = (float)(M_PI * 2) / this->data->flaps;
this->flapRadAdd = (this->data->angle / 360.0f) * (float)(M_PI * 2.0);
while (this->flapRadAdd < 0.0f) {
@@ -64,19 +64,19 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y)
const float distanceToCenter = len_v2v2(point, center);
const float bearing = (atan2f(deltaX, deltaY) + (float)(M_PI * 2.0));
- int flapNumber = (int)((bearing-flapRadAdd)/flapRad);
+ int flapNumber = (int)((bearing - flapRadAdd) / flapRad);
detemineStartPointOfFlap(lineP1, flapNumber, distance);
- detemineStartPointOfFlap(lineP2, flapNumber+1, distance);
+ detemineStartPointOfFlap(lineP2, flapNumber + 1, distance);
closest_to_line_v2(closestPoint, point, lineP1, lineP2);
const float distanceLineToCenter = len_v2v2(center, closestPoint);
- const float distanceRoundingToCenter = inverseRounding*distanceLineToCenter+this->data->rounding*distance;
+ const float distanceRoundingToCenter = inverseRounding * distanceLineToCenter + this->data->rounding * distance;
const float catadioptricDistanceToCenter = distanceRoundingToCenter * this->data->catadioptric;
- if (distanceRoundingToCenter>=distanceToCenter && catadioptricDistanceToCenter <= distanceToCenter) {
+ if (distanceRoundingToCenter >= distanceToCenter && catadioptricDistanceToCenter <= distanceToCenter) {
if (distanceRoundingToCenter - distanceToCenter < 1.0f) {
- insideBokeh = (distanceRoundingToCenter-distanceToCenter);
+ insideBokeh = (distanceRoundingToCenter - distanceToCenter);
}
else if (this->data->catadioptric != 0.0f && distanceToCenter - catadioptricDistanceToCenter < 1.0f) {
insideBokeh = (distanceToCenter - catadioptricDistanceToCenter);
@@ -95,7 +95,7 @@ void BokehImageOperation::executePixel(float *color, float x, float y, PixelSamp
float insideBokehMax = isInsideBokeh(distance, x, y);
float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), x, y);
float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), x, y);
- if (shift<0) {
+ if (shift < 0) {
color[0] = insideBokehMax;
color[1] = insideBokehMed;
color[2] = insideBokehMin;
@@ -105,7 +105,7 @@ void BokehImageOperation::executePixel(float *color, float x, float y, PixelSamp
color[1] = insideBokehMed;
color[2] = insideBokehMax;
}
- color[3] = (insideBokehMax+insideBokehMed+insideBokehMin)/3.0f;
+ color[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f;
}
void BokehImageOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
index ae83115ff69..3b99fc9a2a0 100644
--- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
@@ -24,7 +24,7 @@
#include "BLI_math.h"
#include "DNA_node_types.h"
-BoxMaskOperation::BoxMaskOperation(): NodeOperation()
+BoxMaskOperation::BoxMaskOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_VALUE);
@@ -41,7 +41,7 @@ void BoxMaskOperation::initExecution()
const double rad = DEG2RAD((double)this->data->rotation);
this->cosine = cos(rad);
this->sine = sin(rad);
- this->aspectRatio = ((float)this->getWidth())/this->getHeight();
+ this->aspectRatio = ((float)this->getWidth()) / this->getHeight();
}
void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -49,13 +49,13 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler
float inputMask[4];
float inputValue[4];
- float rx = x/this->getWidth();
- float ry = y/this->getHeight();
+ float rx = x / this->getWidth();
+ float ry = y / this->getHeight();
- const float dy = (ry - this->data->y)/this->aspectRatio;
+ const float dy = (ry - this->data->y) / this->aspectRatio;
const float dx = rx - this->data->x;
- rx = this->data->x+(this->cosine*dx + this->sine*dy);
- ry = this->data->y+(-this->sine*dx + this->cosine*dy);
+ rx = this->data->x + (this->cosine * dx + this->sine * dy);
+ ry = this->data->y + (-this->sine * dx + this->cosine * dy);
this->inputMask->read(inputMask, x, y, sampler, inputBuffers);
this->inputValue->read(inputValue, x, y, sampler, inputBuffers);
@@ -70,7 +70,7 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler
switch (this->maskType) {
case CMP_NODE_MASKTYPE_ADD:
if (inside) {
- color[0] = max(inputMask[0],inputValue[0]);
+ color[0] = max(inputMask[0], inputValue[0]);
}
else {
color[0] = inputMask[0];
@@ -78,7 +78,7 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler
break;
case CMP_NODE_MASKTYPE_SUBTRACT:
if (inside) {
- color[0] = inputMask[0]-inputValue[0];
+ color[0] = inputMask[0] - inputValue[0];
CLAMP(color[0], 0, 1);
}
else {
@@ -87,24 +87,24 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler
break;
case CMP_NODE_MASKTYPE_MULTIPLY:
if (inside) {
- color[0] = inputMask[0]*inputValue[0];
+ color[0] = inputMask[0] * inputValue[0];
}
else {
color[0] = 0;
}
break;
case CMP_NODE_MASKTYPE_NOT:
- if (inside) {
- if (inputMask[0]>0.0f) {
- color[0] = 0;
+ if (inside) {
+ if (inputMask[0] > 0.0f) {
+ color[0] = 0;
+ }
+ else {
+ color[0] = inputValue[0];
+ }
}
else {
- color[0] = inputValue[0];
+ color[0] = inputMask[0];
}
- }
- else {
- color[0] = inputMask[0];
- }
break;
}
diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
index a4396a43cf7..95862a1fd83 100644
--- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp
+++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_BrightnessOperation.h"
-BrightnessOperation::BrightnessOperation(): NodeOperation()
+BrightnessOperation::BrightnessOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VALUE);
@@ -52,10 +52,10 @@ void BrightnessOperation::executePixel(float *color, float x, float y, PixelSamp
float delta = contrast / 200.0f;
a = 1.0f - delta * 2.0f;
/*
- * The algorithm is by Werner D. Streidt
- * (http://visca.com/ffactory/archives/5-99/msg00021.html)
- * Extracted of OpenCV demhist.c
- */
+ * The algorithm is by Werner D. Streidt
+ * (http://visca.com/ffactory/archives/5-99/msg00021.html)
+ * Extracted of OpenCV demhist.c
+ */
if (contrast > 0) {
a = 1.0f / a;
b = a * (brightness - delta);
@@ -65,9 +65,9 @@ void BrightnessOperation::executePixel(float *color, float x, float y, PixelSamp
b = a * (brightness + delta);
}
- color[0] = a*inputValue[0]+b;
- color[1] = a*inputValue[1]+b;
- color[2] = a*inputValue[2]+b;
+ color[0] = a * inputValue[0] + b;
+ color[1] = a * inputValue[1] + b;
+ color[2] = a * inputValue[2] + b;
color[3] = inputValue[3];
}
diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp
index 077d8473f0b..3f9003b8c48 100644
--- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp
+++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp
@@ -26,7 +26,7 @@
-CalculateMeanOperation::CalculateMeanOperation(): NodeOperation()
+CalculateMeanOperation::CalculateMeanOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
this->addOutputSocket(COM_DT_VALUE);
@@ -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, MemoryBuffer *inputBuffers[], void *data)
{
color[0] = this->result;
}
@@ -74,7 +74,7 @@ void *CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memo
{
lockMutex();
if (!this->iscalculated) {
- MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)imageReader->initializeTileData(rect, memoryBuffers);
calculateMean(tile);
this->iscalculated = true;
}
@@ -82,44 +82,44 @@ void *CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memo
return NULL;
}
-void CalculateMeanOperation::calculateMean(MemoryBuffer * tile)
+void CalculateMeanOperation::calculateMean(MemoryBuffer *tile)
{
this->result = 0.0f;
float *buffer = tile->getBuffer();
- int size = tile->getWidth()*tile->getHeight();
+ int size = tile->getWidth() * tile->getHeight();
int pixels = 0;
float sum;
- for (int i = 0, offset = 0 ; i < size ; i ++, offset +=4) {
- if (buffer[offset+3] > 0) {
- pixels ++;
+ for (int i = 0, offset = 0; i < size; i++, offset += 4) {
+ if (buffer[offset + 3] > 0) {
+ pixels++;
switch (this->setting)
{
- case 1:
+ case 1:
{
- sum += buffer[offset]*0.35f + buffer[offset+1]*0.45f + buffer[offset+2]*0.2f;
+ sum += buffer[offset] * 0.35f + buffer[offset + 1] * 0.45f + buffer[offset + 2] * 0.2f;
break;
}
- case 2:
+ case 2:
{
- sum+= buffer[offset];
+ sum += buffer[offset];
break;
}
- case 3:
+ case 3:
{
- sum+= buffer[offset+1];
+ sum += buffer[offset + 1];
break;
}
- case 4:
+ case 4:
{
- sum+= buffer[offset+2];
+ sum += buffer[offset + 2];
break;
}
- case 5:
+ case 5:
{
float yuv[3];
- rgb_to_yuv(buffer[offset], buffer[offset+1], buffer[offset+2], &yuv[0], &yuv[1], &yuv[2]);
- sum+=yuv[0];
+ rgb_to_yuv(buffer[offset], buffer[offset + 1], buffer[offset + 2], &yuv[0], &yuv[1], &yuv[2]);
+ sum += yuv[0];
break;
}
}
diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
index dfe1b6aa329..b0739cd7567 100644
--- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
+++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
@@ -26,11 +26,12 @@
-CalculateStandardDeviationOperation::CalculateStandardDeviationOperation(): CalculateMeanOperation()
+CalculateStandardDeviationOperation::CalculateStandardDeviationOperation() : CalculateMeanOperation()
{
+ /* pass */
}
-void CalculateStandardDeviationOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data)
+void CalculateStandardDeviationOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
color[0] = this->standardDeviation;
}
@@ -39,57 +40,57 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect, Memory
{
lockMutex();
if (!this->iscalculated) {
- MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)imageReader->initializeTileData(rect, memoryBuffers);
CalculateMeanOperation::calculateMean(tile);
this->standardDeviation = 0.0f;
float *buffer = tile->getBuffer();
- int size = tile->getWidth()*tile->getHeight();
+ int size = tile->getWidth() * tile->getHeight();
int pixels = 0;
float sum;
float mean = this->result;
- for (int i = 0, offset = 0 ; i < size ; i ++, offset +=4) {
- if (buffer[offset+3] > 0) {
- pixels ++;
+ for (int i = 0, offset = 0; i < size; i++, offset += 4) {
+ if (buffer[offset + 3] > 0) {
+ pixels++;
switch (this->setting)
{
- case 1:
+ case 1:
{
- float value = buffer[offset]*0.35f + buffer[offset+1]*0.45f + buffer[offset+2]*0.2f;
- sum+=(value-mean)*(value-mean);
+ float value = buffer[offset] * 0.35f + buffer[offset + 1] * 0.45f + buffer[offset + 2] * 0.2f;
+ sum += (value - mean) * (value - mean);
break;
}
- case 2:
+ case 2:
{
float value = buffer[offset];
- sum+=value;
- sum+=(value-mean)*(value-mean);
+ sum += value;
+ sum += (value - mean) * (value - mean);
break;
}
- case 3:
+ case 3:
{
- float value = buffer[offset+1];
- sum+=value;
- sum+=(value-mean)*(value-mean);
+ float value = buffer[offset + 1];
+ sum += value;
+ sum += (value - mean) * (value - mean);
break;
}
- case 4:
+ case 4:
{
- float value = buffer[offset+2];
- sum+=value;
- sum+=(value-mean)*(value-mean);
+ float value = buffer[offset + 2];
+ sum += value;
+ sum += (value - mean) * (value - mean);
}
- case 5:
+ case 5:
{
float yuv[3];
- rgb_to_yuv(buffer[offset], buffer[offset+1], buffer[offset+2], &yuv[0], &yuv[1], &yuv[2]);
- sum+=(yuv[0]-mean)*(yuv[0]-mean);
+ rgb_to_yuv(buffer[offset], buffer[offset + 1], buffer[offset + 2], &yuv[0], &yuv[1], &yuv[2]);
+ sum += (yuv[0] - mean) * (yuv[0] - mean);
break;
}
}
}
}
- this->standardDeviation = sqrt(sum / (float)(pixels-1));
+ this->standardDeviation = sqrt(sum / (float)(pixels - 1));
this->iscalculated = true;
}
unlockMutex();
diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
index f949b0a55fa..487c1869782 100644
--- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ChangeHSVOperation.h"
-ChangeHSVOperation::ChangeHSVOperation(): NodeOperation()
+ChangeHSVOperation::ChangeHSVOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
@@ -46,8 +46,8 @@ void ChangeHSVOperation::executePixel(float *outputValue, float x, float y, Pixe
inputOperation->read(inputColor1, x, y, sampler, inputBuffers);
outputValue[0] = inputColor1[0] + (this->hue - 0.5f);
- if (outputValue[0] > 1.0f) outputValue[0] -= 1.0f;
- else if (outputValue[0] < 0.0f) outputValue[0] += 1.0f;
+ if (outputValue[0] > 1.0f) outputValue[0] -= 1.0f;
+ else if (outputValue[0] < 0.0f) outputValue[0] += 1.0f;
outputValue[1] = inputColor1[1] * this->saturation;
outputValue[2] = inputColor1[2] * this->value;
outputValue[3] = inputColor1[3];
diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
index 70bfc8f8cfa..24af1a3aa53 100644
--- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ChannelMatteOperation.h"
#include "BLI_math.h"
-ChannelMatteOperation::ChannelMatteOperation(): NodeOperation()
+ChannelMatteOperation::ChannelMatteOperation() : NodeOperation()
{
addInputSocket(COM_DT_COLOR);
addOutputSocket(COM_DT_VALUE);
@@ -39,9 +39,9 @@ void ChannelMatteOperation::initExecution()
switch (this->limit_method) {
/* SINGLE */
case 0: {
- /* 123 / RGB / HSV / YUV / YCC */
- const int matte_channel=this->matte_channel-1;
- const int limit_channel=this->limit_channel-1;
+ /* 123 / RGB / HSV / YUV / YCC */
+ const int matte_channel = this->matte_channel - 1;
+ const int limit_channel = this->limit_channel - 1;
this->ids[0] = matte_channel;
this->ids[1] = limit_channel;
this->ids[2] = limit_channel;
@@ -107,7 +107,7 @@ void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, P
else if (alpha < limit_min) {
alpha = 0.f;
}
- else {/*blend */
+ else { /*blend */
alpha = (alpha - limit_min) / limit_range;
}
diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
index e082ffed2b6..0ce1a585598 100644
--- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ChromaMatteOperation.h"
#include "BLI_math.h"
-ChromaMatteOperation::ChromaMatteOperation(): NodeOperation()
+ChromaMatteOperation::ChromaMatteOperation() : NodeOperation()
{
addInputSocket(COM_DT_COLOR);
addInputSocket(COM_DT_COLOR);
@@ -66,36 +66,36 @@ void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, Pi
/* Algorithm from book "Video Demistified," does not include the spill reduction part */
/* find theta, the angle that the color space should be rotated based on key*/
- theta=atan2(inKey[2], inKey[1]);
+ theta = atan2(inKey[2], inKey[1]);
/*rotate the cb and cr into x/z space */
- x_angle=inImage[1]*cosf(theta)+inImage[2]*sinf(theta);
- z_angle=inImage[2]*cosf(theta)-inImage[1]*sinf(theta);
+ x_angle = inImage[1] * cosf(theta) + inImage[2] * sinf(theta);
+ z_angle = inImage[2] * cosf(theta) - inImage[1] * sinf(theta);
/*if within the acceptance angle */
/* if kfg is <0 then the pixel is outside of the key color */
- kfg = x_angle-(fabsf(z_angle)/tanf(acceptance/2.f));
+ kfg = x_angle - (fabsf(z_angle) / tanf(acceptance / 2.f));
- if (kfg>0.f) { /* found a pixel that is within key color */
- alpha=(1.f-kfg)*(gain);
+ if (kfg > 0.f) { /* found a pixel that is within key color */
+ alpha = (1.f - kfg) * (gain);
- beta=atan2(z_angle,x_angle);
+ beta = atan2(z_angle, x_angle);
/* if beta is within the cutoff angle */
- if (fabsf(beta) < (cutoff/2.f)) {
- alpha=0.f;
+ if (fabsf(beta) < (cutoff / 2.f)) {
+ alpha = 0.f;
}
/* don't make something that was more transparent less transparent */
- if (alpha<inImage[3]) {
- outputValue[0]=alpha;
+ if (alpha < inImage[3]) {
+ outputValue[0] = alpha;
}
else {
- outputValue[0]=inImage[3];
+ outputValue[0] = inImage[3];
}
}
else { /*pixel is outside key color */
- outputValue[0]=inImage[3]; /* make pixel just as transparent as it was before */
+ outputValue[0] = inImage[3]; /* make pixel just as transparent as it was before */
}
}
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
index 6fe6bde7c09..a48fe169fd7 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
@@ -33,7 +33,7 @@ inline float colorbalance_cdl(float in, float offset, float power, float slope)
return powf(x, power);
}
-ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation(): NodeOperation()
+ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_COLOR);
@@ -61,9 +61,9 @@ void ColorBalanceASCCDLOperation::executePixel(float *outputColor, float x, floa
fac = min(1.0f, fac);
const float mfac = 1.0f - fac;
- outputColor[0] = mfac*inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->lift[0], this->gamma[0], this->gain[0]);
- outputColor[1] = mfac*inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->lift[1], this->gamma[1], this->gain[1]);
- outputColor[2] = mfac*inputColor[2] + fac * colorbalance_cdl(inputColor[2], this->lift[2], this->gamma[2], this->gain[2]);
+ outputColor[0] = mfac * inputColor[0] + fac *colorbalance_cdl(inputColor[0], this->lift[0], this->gamma[0], this->gain[0]);
+ outputColor[1] = mfac * inputColor[1] + fac *colorbalance_cdl(inputColor[1], this->lift[1], this->gamma[1], this->gain[1]);
+ outputColor[2] = mfac * inputColor[2] + fac *colorbalance_cdl(inputColor[2], this->lift[2], this->gamma[2], this->gain[2]);
outputColor[3] = inputColor[3];
}
diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
index 82958a7086e..7a8d62dfe21 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
@@ -38,7 +38,7 @@ inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float g
return powf(srgb_to_linearrgb(x), gamma_inv);
}
-ColorBalanceLGGOperation::ColorBalanceLGGOperation(): NodeOperation()
+ColorBalanceLGGOperation::ColorBalanceLGGOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_COLOR);
@@ -66,9 +66,9 @@ void ColorBalanceLGGOperation::executePixel(float *outputColor, float x, float y
fac = min(1.0f, fac);
const float mfac = 1.0f - fac;
- outputColor[0] = mfac*inputColor[0] + fac * colorbalance_lgg(inputColor[0], this->lift[0], this->gamma_inv[0], this->gain[0]);
- outputColor[1] = mfac*inputColor[1] + fac * colorbalance_lgg(inputColor[1], this->lift[1], this->gamma_inv[1], this->gain[1]);
- outputColor[2] = mfac*inputColor[2] + fac * colorbalance_lgg(inputColor[2], this->lift[2], this->gamma_inv[2], this->gain[2]);
+ outputColor[0] = mfac * inputColor[0] + fac *colorbalance_lgg(inputColor[0], this->lift[0], this->gamma_inv[0], this->gain[0]);
+ outputColor[1] = mfac * inputColor[1] + fac *colorbalance_lgg(inputColor[1], this->lift[1], this->gamma_inv[1], this->gain[1]);
+ outputColor[2] = mfac * inputColor[2] + fac *colorbalance_lgg(inputColor[2], this->lift[2], this->gamma_inv[2], this->gain[2]);
outputColor[3] = inputColor[3];
}
diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
index 8ff58be7980..5f62f9ec403 100644
--- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_ColorCorrectionOperation.h"
#include "BLI_math.h"
-ColorCorrectionOperation::ColorCorrectionOperation(): NodeOperation()
+ColorCorrectionOperation::ColorCorrectionOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VALUE);
@@ -47,7 +47,7 @@ void ColorCorrectionOperation::executePixel(float *output, float x, float y, Pix
this->inputImage->read(inputImageColor, x, y, sampler, inputBuffers);
this->inputMask->read(inputMask, x, y, sampler, inputBuffers);
- float level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2])/3.0f;
+ float level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2]) / 3.0f;
float contrast = this->data->master.contrast;
float saturation = this->data->master.saturation;
float gamma = this->data->master.gamma;
@@ -83,11 +83,11 @@ void ColorCorrectionOperation::executePixel(float *output, float x, float y, Pix
}
#undef MARGIN
#undef MARGIN_DIV
- contrast *= (levelShadows*this->data->shadows.contrast)+(levelMidtones*this->data->midtones.contrast)+(levelHighlights*this->data->highlights.contrast);
- saturation *= (levelShadows*this->data->shadows.saturation)+(levelMidtones*this->data->midtones.saturation)+(levelHighlights*this->data->highlights.saturation);
- gamma *= (levelShadows*this->data->shadows.gamma)+(levelMidtones*this->data->midtones.gamma)+(levelHighlights*this->data->highlights.gamma);
- gain *= (levelShadows*this->data->shadows.gain)+(levelMidtones*this->data->midtones.gain)+(levelHighlights*this->data->highlights.gain);
- lift += (levelShadows*this->data->shadows.lift)+(levelMidtones*this->data->midtones.lift)+(levelHighlights*this->data->highlights.lift);
+ contrast *= (levelShadows * this->data->shadows.contrast) + (levelMidtones * this->data->midtones.contrast) + (levelHighlights * this->data->highlights.contrast);
+ saturation *= (levelShadows * this->data->shadows.saturation) + (levelMidtones * this->data->midtones.saturation) + (levelHighlights * this->data->highlights.saturation);
+ gamma *= (levelShadows * this->data->shadows.gamma) + (levelMidtones * this->data->midtones.gamma) + (levelHighlights * this->data->highlights.gamma);
+ gain *= (levelShadows * this->data->shadows.gain) + (levelMidtones * this->data->midtones.gain) + (levelHighlights * this->data->highlights.gain);
+ lift += (levelShadows * this->data->shadows.lift) + (levelMidtones * this->data->midtones.lift) + (levelHighlights * this->data->highlights.lift);
float invgamma = 1.0f / gamma;
float luma = rgb_to_luma_y(inputImageColor);
@@ -104,15 +104,15 @@ void ColorCorrectionOperation::executePixel(float *output, float x, float y, Pix
g = 0.5f + ((g - 0.5f) * contrast);
b = 0.5f + ((b - 0.5f) * contrast);
- r = powf(r*gain+lift, invgamma);
- g = powf(g*gain+lift, invgamma);
- b = powf(b*gain+lift, invgamma);
+ r = powf(r * gain + lift, invgamma);
+ g = powf(g * gain + lift, invgamma);
+ b = powf(b * gain + lift, invgamma);
// mix with mask
- r = mvalue*inputImageColor[0] + value * r;
- g = mvalue*inputImageColor[1] + value * g;
- b = mvalue*inputImageColor[2] + value * b;
+ r = mvalue * inputImageColor[0] + value * r;
+ g = mvalue * inputImageColor[1] + value * g;
+ b = mvalue * inputImageColor[2] + value * b;
if (this->redChannelEnabled) {
output[0] = r;
diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
index c4336ed5e06..4feac3e7273 100644
--- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
@@ -31,7 +31,7 @@ extern "C" {
#include "MEM_guardedalloc.h"
#endif
-ColorCurveOperation::ColorCurveOperation(): CurveBaseOperation()
+ColorCurveOperation::ColorCurveOperation() : CurveBaseOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_COLOR);
@@ -60,8 +60,8 @@ void ColorCurveOperation::initExecution()
void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
{
- CurveMapping* cumap = this->curveMapping;
- CurveMapping* workingCopy = (CurveMapping*)MEM_dupallocN(cumap);
+ CurveMapping *cumap = this->curveMapping;
+ CurveMapping *workingCopy = (CurveMapping *)MEM_dupallocN(cumap);
float black[4];
float white[4];
@@ -104,7 +104,7 @@ void ColorCurveOperation::deinitExecution()
// Constant level curve mapping
-ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation(): CurveBaseOperation()
+ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation() : CurveBaseOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
index 7706559be00..afb362dbdcd 100644
--- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ColorMatteOperation.h"
#include "BLI_math.h"
-ColorMatteOperation::ColorMatteOperation(): NodeOperation()
+ColorMatteOperation::ColorMatteOperation() : NodeOperation()
{
addInputSocket(COM_DT_COLOR);
addInputSocket(COM_DT_COLOR);
@@ -64,16 +64,17 @@ void ColorMatteOperation::executePixel(float *outputValue, float x, float y, Pix
*/
if (
- /* do hue last because it needs to wrap, and does some more checks */
+ /* do hue last because it needs to wrap, and does some more checks */
- /* sat */ (fabsf(inColor[1] - inKey[1]) < sat) &&
- /* val */ (fabsf(inColor[2] - inKey[2]) < val) &&
+ /* sat */ (fabsf(inColor[1] - inKey[1]) < sat) &&
+ /* val */ (fabsf(inColor[2] - inKey[2]) < val) &&
- /* multiply by 2 because it wraps on both sides of the hue,
- * otherwise 0.5 would key all hue's */
+ /* multiply by 2 because it wraps on both sides of the hue,
+ * otherwise 0.5 would key all hue's */
- /* hue */ ((h_wrap = 2.f * fabsf(inColor[0]-inKey[0])) < hue || (2.f - h_wrap) < hue)
- ) {
+ /* hue */ ((h_wrap = 2.f * fabsf(inColor[0] - inKey[0])) < hue || (2.f - h_wrap) < hue)
+ )
+ {
outputValue[0] = 0.0f; /*make transparent*/
}
diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.cpp b/source/blender/compositor/operations/COM_ColorRampOperation.cpp
index 992bf3b9d1d..9af70ddc5a7 100644
--- a/source/blender/compositor/operations/COM_ColorRampOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorRampOperation.cpp
@@ -30,7 +30,7 @@ extern "C" {
}
#endif
-ColorRampOperation::ColorRampOperation(): NodeOperation()
+ColorRampOperation::ColorRampOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
index 9b57d64eb40..1a534d778c0 100644
--- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
@@ -22,9 +22,9 @@
#include "COM_ColorSpillOperation.h"
#include "BLI_math.h"
-#define avg(a,b) ((a+b)/2)
+#define AVG(a, b) ((a + b) / 2)
-ColorSpillOperation::ColorSpillOperation(): NodeOperation()
+ColorSpillOperation::ColorSpillOperation() : NodeOperation()
{
addInputSocket(COM_DT_COLOR);
addInputSocket(COM_DT_VALUE);
@@ -104,11 +104,11 @@ void ColorSpillOperation::executePixel(float *outputValue, float x, float y, Pix
}
float ColorSpillOperation::calculateMapValue(float fac, float *input)
{
- return fac * (input[this->spillChannel]-(this->settings->limscale*input[this->settings->limchan]));
+ return fac * (input[this->spillChannel] - (this->settings->limscale * input[this->settings->limchan]));
}
float ColorSpillAverageOperation::calculateMapValue(float fac, float *input)
{
- return fac * (input[this->spillChannel]-(this->settings->limscale*avg(input[this->channel2], input[this->channel3])));
+ return fac * (input[this->spillChannel] - (this->settings->limscale * AVG(input[this->channel2], input[this->channel3])));
}
diff --git a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp b/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp
index 6b64934f0b8..dff8ccf7e73 100644
--- a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp
+++ b/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp
@@ -53,7 +53,7 @@ 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, MemoryBuffer *inputBuffers[])
{
float input[4];
/// @todo: remove if statements
diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
index df12a7d6b49..2e8fc9005b8 100644
--- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
@@ -25,7 +25,7 @@
extern "C" {
#include "IMB_imbuf.h"
}
-ConvertColorProfileOperation::ConvertColorProfileOperation(): NodeOperation()
+ConvertColorProfileOperation::ConvertColorProfileOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp
index f4be7d2e65b..c66cb8df9be 100644
--- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertColorToBWOperation.h"
-ConvertColorToBWOperation::ConvertColorToBWOperation(): NodeOperation()
+ConvertColorToBWOperation::ConvertColorToBWOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_VALUE);
@@ -38,7 +38,7 @@ void ConvertColorToBWOperation::executePixel(float *outputValue, float x, float
{
float inputColor[4];
inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers);
- outputValue[0] = inputColor[0]*0.35f + inputColor[1]*0.45f + inputColor[2]*0.2f;
+ outputValue[0] = inputColor[0] * 0.35f + inputColor[1] * 0.45f + inputColor[2] * 0.2f;
}
void ConvertColorToBWOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp
index ce45266ace0..613bfe68fbb 100644
--- a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertColorToVectorOperation.h"
-ConvertColorToVectorOperation::ConvertColorToVectorOperation(): NodeOperation()
+ConvertColorToVectorOperation::ConvertColorToVectorOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_VECTOR);
diff --git a/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp b/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp
index 0d4f2df22d8..2c8caec6f61 100644
--- a/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp
+++ b/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertColourToValueProg.h"
-ConvertColourToValueProg::ConvertColourToValueProg(): NodeOperation()
+ConvertColourToValueProg::ConvertColourToValueProg() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_VALUE);
@@ -38,7 +38,7 @@ void ConvertColourToValueProg::executePixel(float *outputValue, float x, float y
{
float inputColor[4];
inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers);
- outputValue[0] = (inputColor[0] + inputColor[1] + inputColor[2])/3.0f;
+ outputValue[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f;
}
void ConvertColourToValueProg::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
index f64f0c054b1..1746afea713 100644
--- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
@@ -24,7 +24,7 @@
#include "BLI_math.h"
#include "DNA_camera_types.h"
-ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation()
+ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -41,7 +41,7 @@ float ConvertDepthToRadiusOperation::determineFocalDistance()
return 10.0f;
}
else {
- Camera *camera = (Camera*)this->cameraObject->data;
+ Camera *camera = (Camera *)this->cameraObject->data;
cam_lens = camera->lens;
if (camera->dof_ob) {
/* too simple, better to return the distance on the view axis only
@@ -62,12 +62,12 @@ void ConvertDepthToRadiusOperation::initExecution()
{
this->inputOperation = this->getInputSocketReader(0);
float focalDistance = determineFocalDistance();
- if (focalDistance == 0.0f) focalDistance = 1e10f; /* if the dof is 0.0 then set it be be far away */
- inverseFocalDistance = 1.f/focalDistance;
+ if (focalDistance == 0.0f) focalDistance = 1e10f; /* if the dof is 0.0 then set it be be far away */
+ inverseFocalDistance = 1.f / focalDistance;
this->aspect = (this->getWidth() > this->getHeight()) ? (this->getHeight() / (float)this->getWidth()) : (this->getWidth() / (float)this->getHeight());
- this->aperture = 0.5f*(this->cam_lens / (this->aspect*32.f)) / this->fStop;
+ this->aperture = 0.5f * (this->cam_lens / (this->aspect * 32.f)) / this->fStop;
float minsz = MIN2(getWidth(), getHeight());
- this->dof_sp = (float)minsz / (16.f / cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
+ this->dof_sp = (float)minsz / (16.f / cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
}
void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -77,16 +77,16 @@ void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, fl
float radius;
inputOperation->read(inputValue, x, y, sampler, inputBuffers);
z = inputValue[0];
- if (z!=0.f) {
- float iZ = (1.f/z);
+ if (z != 0.f) {
+ float iZ = (1.f / z);
// bug #6656 part 2b, do not rescale
- /*
+#if 0
bcrad = 0.5f*fabs(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f));
// scale crad back to original maximum and blend
crad->rect[px] = bcrad + wts->rect[px]*(scf*crad->rect[px] - bcrad);
- */
- radius = 0.5f*fabsf(this->aperture*(dof_sp*(inverseFocalDistance - iZ) - 1.f));
+#endif
+ radius = 0.5f * fabsf(this->aperture * (dof_sp * (inverseFocalDistance - iZ) - 1.f));
// 'bug' #6615, limit minimum radius to 1 pixel, not really a solution, but somewhat mitigates the problem
if (radius < 0.5f) radius = 0.5f;
if (radius > maxRadius) {
diff --git a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp
index 97dd7e69092..e8c0061319c 100644
--- a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_ConvertHSVToRGBOperation.h"
#include "BLI_math_color.h"
-ConvertHSVToRGBOperation::ConvertHSVToRGBOperation(): NodeOperation()
+ConvertHSVToRGBOperation::ConvertHSVToRGBOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp
index db27e07d52f..842546a2755 100644
--- a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertKeyToPremulOperation.h"
#include "BLI_math.h"
-ConvertKeyToPremulOperation::ConvertKeyToPremulOperation(): NodeOperation()
+ConvertKeyToPremulOperation::ConvertKeyToPremulOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp
index 920b5f8a775..3554be53e3f 100644
--- a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertPremulToKeyOperation.h"
#include "BLI_math.h"
-ConvertPremulToKeyOperation::ConvertPremulToKeyOperation(): NodeOperation()
+ConvertPremulToKeyOperation::ConvertPremulToKeyOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp
index 99054efc267..051d9d2b8f9 100644
--- a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_ConvertRGBToHSVOperation.h"
#include "BLI_math_color.h"
-ConvertRGBToHSVOperation::ConvertRGBToHSVOperation(): NodeOperation()
+ConvertRGBToHSVOperation::ConvertRGBToHSVOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp
index ce62cf0ae49..d984a1ab943 100644
--- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertRGBToYCCOperation.h"
#include "BLI_math_color.h"
-ConvertRGBToYCCOperation::ConvertRGBToYCCOperation(): NodeOperation()
+ConvertRGBToYCCOperation::ConvertRGBToYCCOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
@@ -38,16 +38,16 @@ void ConvertRGBToYCCOperation::setMode(int mode)
{
switch (mode)
{
- case 1:
- this->mode = BLI_YCC_ITU_BT709;
- break;
- case 2:
- this->mode = BLI_YCC_JFIF_0_255;
- break;
- case 0:
- default:
- this->mode = BLI_YCC_ITU_BT601;
- break;
+ case 1:
+ this->mode = BLI_YCC_ITU_BT709;
+ break;
+ case 2:
+ this->mode = BLI_YCC_JFIF_0_255;
+ break;
+ case 0:
+ default:
+ this->mode = BLI_YCC_ITU_BT601;
+ break;
}
}
diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp
index c4b870d6ad5..e5a8e7de1bb 100644
--- a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertRGBToYUVOperation.h"
#include "BLI_math_color.h"
-ConvertRGBToYUVOperation::ConvertRGBToYUVOperation(): NodeOperation()
+ConvertRGBToYUVOperation::ConvertRGBToYUVOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp b/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp
index dce554efbac..9d95c51a546 100644
--- a/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp
+++ b/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertValueToColourProg.h"
-ConvertValueToColourProg::ConvertValueToColourProg(): NodeOperation()
+ConvertValueToColourProg::ConvertValueToColourProg() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp
index ba7913d24ee..5ba3f6ef4a9 100644
--- a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertValueToVectorOperation.h"
-ConvertValueToVectorOperation::ConvertValueToVectorOperation(): NodeOperation()
+ConvertValueToVectorOperation::ConvertValueToVectorOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VECTOR);
diff --git a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp
index 5a4cc4d3549..f6a2072932c 100644
--- a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertVectorToColorOperation.h"
-ConvertVectorToColorOperation::ConvertVectorToColorOperation(): NodeOperation()
+ConvertVectorToColorOperation::ConvertVectorToColorOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VECTOR);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp
index 67cc42ac8fc..ef2d45eea03 100644
--- a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertVectorToValueOperation.h"
-ConvertVectorToValueOperation::ConvertVectorToValueOperation(): NodeOperation()
+ConvertVectorToValueOperation::ConvertVectorToValueOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VECTOR);
this->addOutputSocket(COM_DT_VALUE);
@@ -38,7 +38,7 @@ void ConvertVectorToValueOperation::executePixel(float *outputValue, float x, fl
{
float input[4];
inputOperation->read(input, x, y, sampler, inputBuffers);
- outputValue[0] = (input[0]+input[1]+input[2])/3.0f;
+ outputValue[0] = (input[0] + input[1] + input[2]) / 3.0f;
}
void ConvertVectorToValueOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp
index dbfe4847c78..373de25a276 100644
--- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertYCCToRGBOperation.h"
#include "BLI_math_color.h"
-ConvertYCCToRGBOperation::ConvertYCCToRGBOperation(): NodeOperation()
+ConvertYCCToRGBOperation::ConvertYCCToRGBOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
@@ -38,16 +38,16 @@ void ConvertYCCToRGBOperation::setMode(int mode)
{
switch (mode)
{
- case 1:
- this->mode = BLI_YCC_ITU_BT709;
- break;
- case 2:
- this->mode = BLI_YCC_JFIF_0_255;
- break;
- case 0:
- default:
- this->mode = BLI_YCC_ITU_BT601;
- break;
+ case 1:
+ this->mode = BLI_YCC_ITU_BT709;
+ break;
+ case 2:
+ this->mode = BLI_YCC_JFIF_0_255;
+ break;
+ case 0:
+ default:
+ this->mode = BLI_YCC_ITU_BT601;
+ break;
}
}
diff --git a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp
index d7037a2c2d1..a77806d16d0 100644
--- a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_ConvertYUVToRGBOperation.h"
#include "BLI_math_color.h"
-ConvertYUVToRGBOperation::ConvertYUVToRGBOperation(): NodeOperation()
+ConvertYUVToRGBOperation::ConvertYUVToRGBOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
index 6edb046a070..5ac8c2254dc 100644
--- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
@@ -25,11 +25,12 @@
ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFilterOperation()
{
+ /* pass */
}
-void ConvolutionEdgeFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void ConvolutionEdgeFilterOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
- float in1[4],in2[4], res1[4], res2[4];
+ float in1[4], in2[4], res1[4], res2[4];
int x1 = x - 1;
int x2 = x;
@@ -37,12 +38,12 @@ void ConvolutionEdgeFilterOperation::executePixel(float *color,int x, int y, Mem
int y1 = y - 1;
int y2 = y;
int y3 = y + 1;
- CLAMP(x1, 0, getWidth()-1);
- CLAMP(x2, 0, getWidth()-1);
- CLAMP(x3, 0, getWidth()-1);
- CLAMP(y1, 0, getHeight()-1);
- CLAMP(y2, 0, getHeight()-1);
- CLAMP(y3, 0, getHeight()-1);
+ CLAMP(x1, 0, getWidth() - 1);
+ CLAMP(x2, 0, getWidth() - 1);
+ CLAMP(x3, 0, getWidth() - 1);
+ CLAMP(y1, 0, getHeight() - 1);
+ CLAMP(y2, 0, getHeight() - 1);
+ CLAMP(y3, 0, getHeight() - 1);
float value[4];
this->inputValueOperation->read(value, x2, y2, inputBuffers, NULL);
diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
index 3c9cde92e2e..b4f2714360e 100644
--- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
@@ -61,13 +61,13 @@ void ConvolutionFilterOperation::deinitExecution()
this->inputOperation = NULL;
this->inputValueOperation = NULL;
if (this->filter) {
- delete [] this->filter;
+ delete[] this->filter;
this->filter = NULL;
}
}
-void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data)
+void ConvolutionFilterOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
float in1[4];
float in2[4];
@@ -77,12 +77,12 @@ void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryB
int y1 = y - 1;
int y2 = y;
int y3 = y + 1;
- CLAMP(x1, 0, getWidth()-1);
- CLAMP(x2, 0, getWidth()-1);
- CLAMP(x3, 0, getWidth()-1);
- CLAMP(y1, 0, getHeight()-1);
- CLAMP(y2, 0, getHeight()-1);
- CLAMP(y3, 0, getHeight()-1);
+ CLAMP(x1, 0, getWidth() - 1);
+ CLAMP(x2, 0, getWidth() - 1);
+ CLAMP(x3, 0, getWidth() - 1);
+ CLAMP(y1, 0, getHeight() - 1);
+ CLAMP(y2, 0, getHeight() - 1);
+ CLAMP(y3, 0, getHeight() - 1);
float value[4];
this->inputValueOperation->read(value, x2, y2, inputBuffers, NULL);
const float mval = 1.0f - value[0];
@@ -116,8 +116,8 @@ void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryB
bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInput;
- int addx = (this->filterWidth-1)/2+1;
- int addy = (this->filterHeight-1)/2+1;
+ int addx = (this->filterWidth - 1) / 2 + 1;
+ int addy = (this->filterHeight - 1) / 2 + 1;
newInput.xmax = input->xmax + addx;
newInput.xmin = input->xmin - addx;
newInput.ymax = input->ymax + addy;
diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp
index 192ad8d0bda..0bdd2cfcb51 100644
--- a/source/blender/compositor/operations/COM_CropOperation.cpp
+++ b/source/blender/compositor/operations/COM_CropOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_CropOperation.h"
#include "BLI_math.h"
-CropBaseOperation::CropBaseOperation() :NodeOperation()
+CropBaseOperation::CropBaseOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
this->addOutputSocket(COM_DT_COLOR);
@@ -33,7 +33,7 @@ CropBaseOperation::CropBaseOperation() :NodeOperation()
void CropBaseOperation::updateArea()
{
- SocketReader * inputReference = this->getInputSocketReader(0);
+ SocketReader *inputReference = this->getInputSocketReader(0);
float width = inputReference->getWidth();
float height = inputReference->getHeight();
if (this->relative) {
@@ -68,8 +68,9 @@ void CropBaseOperation::deinitExecution()
this->inputOperation = NULL;
}
-CropOperation::CropOperation() :CropBaseOperation()
+CropOperation::CropOperation() : CropBaseOperation()
{
+ /* pass */
}
void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -85,8 +86,9 @@ void CropOperation::executePixel(float *color, float x, float y, PixelSampler sa
}
}
-CropImageOperation::CropImageOperation() :CropBaseOperation()
+CropImageOperation::CropImageOperation() : CropBaseOperation()
{
+ /* pass */
}
bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
index fda5b00e2a0..6aa8bc2a0df 100644
--- a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
@@ -30,7 +30,7 @@ extern "C" {
}
#endif
-CurveBaseOperation::CurveBaseOperation(): NodeOperation()
+CurveBaseOperation::CurveBaseOperation() : NodeOperation()
{
this->curveMapping = NULL;
}
diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
index 0b1ac1b2127..c27e699f627 100644
--- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_DifferenceMatteOperation.h"
#include "BLI_math.h"
-DifferenceMatteOperation::DifferenceMatteOperation(): NodeOperation()
+DifferenceMatteOperation::DifferenceMatteOperation() : NodeOperation()
{
addInputSocket(COM_DT_COLOR);
addInputSocket(COM_DT_COLOR);
@@ -49,8 +49,8 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y
float inColor1[4];
float inColor2[4];
- const float tolerence=this->settings->t1;
- const float falloff=this->settings->t2;
+ const float tolerence = this->settings->t1;
+ const float falloff = this->settings->t2;
float difference;
float alpha;
@@ -69,15 +69,15 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y
outputValue[0] = 0.0f;
}
/*in the falloff region, make partially transparent */
- else if (difference < falloff+tolerence) {
- difference=difference-tolerence;
- alpha=difference/falloff;
+ else if (difference < falloff + tolerence) {
+ difference = difference - tolerence;
+ alpha = difference / falloff;
/*only change if more transparent than before */
if (alpha < inColor1[3]) {
- outputValue[0]=alpha;
+ outputValue[0] = alpha;
}
else { /* leave as before */
- outputValue[0]=inColor1[3];
+ outputValue[0] = inColor1[3];
}
}
else {
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
index bdd7362952a..306a2d96985 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
@@ -24,7 +24,7 @@
#include "BLI_math.h"
// DilateErode Distance Threshold
-DilateErodeThresholdOperation::DilateErodeThresholdOperation(): NodeOperation()
+DilateErodeThresholdOperation::DilateErodeThresholdOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -38,11 +38,11 @@ void DilateErodeThresholdOperation::initExecution()
{
this->inputProgram = this->getInputSocketReader(0);
if (this->distance < 0.0f) {
- this->scope = - this->distance + this->inset;
+ this->scope = -this->distance + this->inset;
}
else {
- if (this->inset*2 > this->distance) {
- this->scope = max(this->inset*2 - this->distance, this->distance);
+ if (this->inset * 2 > this->distance) {
+ this->scope = max(this->inset * 2 - this->distance, this->distance);
}
else {
this->scope = distance;
@@ -67,45 +67,45 @@ void DilateErodeThresholdOperation::executePixel(float *color, int x, int y, Mem
float pixelvalue;
const float rd = scope * scope;
const float inset = this->inset;
- float mindist = rd*2;
+ float mindist = rd * 2;
- MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+ MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
rcti *rect = inputBuffer->getRect();
const int minx = max(x - scope, rect->xmin);
const int miny = max(y - scope, rect->ymin);
const int maxx = min(x + scope, rect->xmax);
const int maxy = min(y + scope, rect->ymax);
- const int bufferWidth = rect->xmax-rect->xmin;
+ const int bufferWidth = rect->xmax - rect->xmin;
int offset;
this->inputProgram->read(inputValue, x, y, inputBuffers, NULL);
- if (inputValue[0]>sw) {
- for (int yi = miny ; yi<maxy;yi++) {
- offset = ((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4;
- for (int xi = minx ; xi<maxx;xi++) {
- if (buffer[offset]<sw) {
- const float dx = xi-x;
- const float dy = yi-y;
- const float dis = dx*dx+dy*dy;
+ if (inputValue[0] > sw) {
+ for (int yi = miny; yi < maxy; yi++) {
+ const float dy = yi - y;
+ offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin)) * 4;
+ for (int xi = minx; xi < maxx; xi++) {
+ if (buffer[offset] < sw) {
+ const float dx = xi - x;
+ const float dis = dx * dx + dy * dy;
mindist = min(mindist, dis);
}
- offset +=4;
+ offset += 4;
}
}
pixelvalue = -sqrtf(mindist);
}
else {
- for (int yi = miny ; yi<maxy;yi++) {
- offset = ((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4;
- for (int xi = minx ; xi<maxx;xi++) {
- if (buffer[offset]>sw) {
- const float dx = xi-x;
- const float dy = yi-y;
- const float dis = dx*dx+dy*dy;
+ for (int yi = miny; yi < maxy; yi++) {
+ const float dy = yi - y;
+ offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin)) * 4;
+ for (int xi = minx; xi < maxx; xi++) {
+ if (buffer[offset] > sw) {
+ const float dx = xi - x;
+ const float dis = dx * dx + dy * dy;
mindist = min(mindist, dis);
}
- offset +=4;
+ offset += 4;
}
}
@@ -119,7 +119,7 @@ void DilateErodeThresholdOperation::executePixel(float *color, int x, int y, Mem
color[0] = 1.0f;
}
else {
- color[0] = delta/inset;
+ color[0] = delta / inset;
}
}
else {
@@ -127,13 +127,13 @@ void DilateErodeThresholdOperation::executePixel(float *color, int x, int y, Mem
}
}
else {
- const float delta = -distance+pixelvalue;
+ const float delta = -distance + pixelvalue;
if (delta < 0.0f) {
if (delta < -inset) {
color[0] = 1.0f;
}
else {
- color[0] = (-delta)/inset;
+ color[0] = (-delta) / inset;
}
}
else {
@@ -160,7 +160,7 @@ bool DilateErodeThresholdOperation::determineDependingAreaOfInterest(rcti *input
}
// Dilate Distance
-DilateDistanceOperation::DilateDistanceOperation(): NodeOperation()
+DilateDistanceOperation::DilateDistanceOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -187,30 +187,30 @@ void *DilateDistanceOperation::initializeTileData(rcti *rect, MemoryBuffer **mem
void DilateDistanceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
const float distance = this->distance;
- float mindist = distance * distance;
+ const float mindist = distance * distance;
- MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+ MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
rcti *rect = inputBuffer->getRect();
const int minx = max(x - scope, rect->xmin);
const int miny = max(y - scope, rect->ymin);
const int maxx = min(x + scope, rect->xmax);
const int maxy = min(y + scope, rect->ymax);
- const int bufferWidth = rect->xmax-rect->xmin;
+ const int bufferWidth = rect->xmax - rect->xmin;
int offset;
float value = 0.0f;
- for (int yi = miny ; yi<maxy;yi++) {
- offset = ((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4;
- for (int xi = minx ; xi<maxx;xi++) {
- const float dx = xi-x;
- const float dy = yi-y;
- const float dis = dx*dx+dy*dy;
+ for (int yi = miny; yi < maxy; yi++) {
+ const float dy = yi - y;
+ offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin)) * 4;
+ for (int xi = minx; xi < maxx; xi++) {
+ const float dx = xi - x;
+ const float dis = dx * dx + dy * dy;
if (dis <= mindist) {
value = max(buffer[offset], value);
}
- offset +=4;
+ offset += 4;
}
}
color[0] = value;
@@ -235,14 +235,14 @@ bool DilateDistanceOperation::determineDependingAreaOfInterest(rcti *input, Read
static cl_kernel dilateKernel = 0;
void DilateDistanceOperation::executeOpenCL(cl_context context, cl_program program, cl_command_queue queue,
- MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
- MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
- list<cl_kernel> *clKernelsToCleanUp)
+ MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
+ MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
+ list<cl_kernel> *clKernelsToCleanUp)
{
if (!dilateKernel) {
dilateKernel = COM_clCreateKernel(program, "dilateKernel", NULL);
}
- cl_int distanceSquared = this->distance*this->distance;
+ cl_int distanceSquared = this->distance * this->distance;
cl_int scope = this->scope;
COM_clAttachMemoryBufferToKernelParameter(context, dilateKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, this->inputProgram);
@@ -257,35 +257,36 @@ void DilateDistanceOperation::executeOpenCL(cl_context context, cl_program progr
// Erode Distance
ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation()
{
+ /* pass */
}
void ErodeDistanceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
const float distance = this->distance;
- float mindist = distance * distance;
+ const float mindist = distance * distance;
- MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+ MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
rcti *rect = inputBuffer->getRect();
const int minx = max(x - scope, rect->xmin);
const int miny = max(y - scope, rect->ymin);
const int maxx = min(x + scope, rect->xmax);
const int maxy = min(y + scope, rect->ymax);
- const int bufferWidth = rect->xmax-rect->xmin;
+ const int bufferWidth = rect->xmax - rect->xmin;
int offset;
float value = 1.0f;
- for (int yi = miny ; yi<maxy;yi++) {
- offset = ((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4;
- for (int xi = minx ; xi<maxx;xi++) {
- const float dx = xi-x;
- const float dy = yi-y;
- const float dis = dx*dx+dy*dy;
+ for (int yi = miny; yi < maxy; yi++) {
+ const float dy = yi - y;
+ offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin)) * 4;
+ for (int xi = minx; xi < maxx; xi++) {
+ const float dx = xi - x;
+ const float dis = dx * dx + dy * dy;
if (dis <= mindist) {
value = min(buffer[offset], value);
}
- offset +=4;
+ offset += 4;
}
}
color[0] = value;
@@ -293,14 +294,14 @@ void ErodeDistanceOperation::executePixel(float *color, int x, int y, MemoryBuff
static cl_kernel erodeKernel = 0;
void ErodeDistanceOperation::executeOpenCL(cl_context context, cl_program program, cl_command_queue queue,
- MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
- MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
- list<cl_kernel> *clKernelsToCleanUp)
+ MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
+ MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
+ list<cl_kernel> *clKernelsToCleanUp)
{
if (!erodeKernel) {
erodeKernel = COM_clCreateKernel(program, "erodeKernel", NULL);
}
- cl_int distanceSquared = this->distance*this->distance;
+ cl_int distanceSquared = this->distance * this->distance;
cl_int scope = this->scope;
COM_clAttachMemoryBufferToKernelParameter(context, erodeKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, this->inputProgram);
@@ -313,7 +314,7 @@ void ErodeDistanceOperation::executeOpenCL(cl_context context, cl_program progra
}
// Dilate step
-DilateStepOperation::DilateStepOperation(): NodeOperation()
+DilateStepOperation::DilateStepOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -334,37 +335,37 @@ void *DilateStepOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB
}
lockMutex();
if (this->cached_buffer == NULL) {
- MemoryBuffer *buffer = (MemoryBuffer*)inputProgram->initializeTileData(NULL, memoryBuffers);
+ MemoryBuffer *buffer = (MemoryBuffer *)inputProgram->initializeTileData(NULL, memoryBuffers);
float *rectf = buffer->convertToValueBuffer();
int x, y, i;
float *p;
int bwidth = buffer->getWidth();
int bheight = buffer->getHeight();
- for (i = 0 ; i < this->iterations ; i ++) {
- for (y=0; y < bheight; y++) {
- for (x=0; x < bwidth-1; x++) {
- p = rectf + (bwidth*y + x);
+ for (i = 0; i < this->iterations; i++) {
+ for (y = 0; y < bheight; y++) {
+ for (x = 0; x < bwidth - 1; x++) {
+ p = rectf + (bwidth * y + x);
*p = MAX2(*p, *(p + 1));
}
}
- for (y=0; y < bheight; y++) {
- for (x=bwidth-1; x >= 1; x--) {
- p = rectf + (bwidth*y + x);
+ for (y = 0; y < bheight; y++) {
+ for (x = bwidth - 1; x >= 1; x--) {
+ p = rectf + (bwidth * y + x);
*p = MAX2(*p, *(p - 1));
}
}
- for (x=0; x < bwidth; x++) {
- for (y=0; y < bheight-1; y++) {
- p = rectf + (bwidth*y + x);
+ for (x = 0; x < bwidth; x++) {
+ for (y = 0; y < bheight - 1; y++) {
+ p = rectf + (bwidth * y + x);
*p = MAX2(*p, *(p + bwidth));
}
}
- for (x=0; x < bwidth; x++) {
- for (y=bheight-1; y >= 1; y--) {
- p = rectf + (bwidth*y + x);
+ for (x = 0; x < bwidth; x++) {
+ for (y = bheight - 1; y >= 1; y--) {
+ p = rectf + (bwidth * y + x);
*p = MAX2(*p, *(p - bwidth));
}
}
@@ -378,7 +379,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB
void DilateStepOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
- color[0] = this->cached_buffer[y*this->getWidth()+x];
+ color[0] = this->cached_buffer[y * this->getWidth() + x];
}
void DilateStepOperation::deinitExecution()
@@ -409,8 +410,9 @@ bool DilateStepOperation::determineDependingAreaOfInterest(rcti *input, ReadBuff
}
// Erode step
-ErodeStepOperation::ErodeStepOperation(): DilateStepOperation()
+ErodeStepOperation::ErodeStepOperation() : DilateStepOperation()
{
+ /* pass */
}
void *ErodeStepOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
@@ -420,37 +422,37 @@ void *ErodeStepOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
}
lockMutex();
if (this->cached_buffer == NULL) {
- MemoryBuffer *buffer = (MemoryBuffer*)inputProgram->initializeTileData(NULL, memoryBuffers);
+ MemoryBuffer *buffer = (MemoryBuffer *)inputProgram->initializeTileData(NULL, memoryBuffers);
float *rectf = buffer->convertToValueBuffer();
int x, y, i;
float *p;
int bwidth = buffer->getWidth();
int bheight = buffer->getHeight();
- for (i = 0 ; i < this->iterations ; i ++) {
- for (y=0; y < bheight; y++) {
- for (x=0; x < bwidth-1; x++) {
- p = rectf + (bwidth*y + x);
+ for (i = 0; i < this->iterations; i++) {
+ for (y = 0; y < bheight; y++) {
+ for (x = 0; x < bwidth - 1; x++) {
+ p = rectf + (bwidth * y + x);
*p = MIN2(*p, *(p + 1));
}
}
- for (y=0; y < bheight; y++) {
- for (x=bwidth-1; x >= 1; x--) {
- p = rectf + (bwidth*y + x);
+ for (y = 0; y < bheight; y++) {
+ for (x = bwidth - 1; x >= 1; x--) {
+ p = rectf + (bwidth * y + x);
*p = MIN2(*p, *(p - 1));
}
}
- for (x=0; x < bwidth; x++) {
- for (y=0; y < bheight-1; y++) {
- p = rectf + (bwidth*y + x);
+ for (x = 0; x < bwidth; x++) {
+ for (y = 0; y < bheight - 1; y++) {
+ p = rectf + (bwidth * y + x);
*p = MIN2(*p, *(p + bwidth));
}
}
- for (x=0; x < bwidth; x++) {
- for (y=bheight-1; y >= 1; y--) {
- p = rectf + (bwidth*y + x);
+ for (x = 0; x < bwidth; x++) {
+ for (y = bheight - 1; y >= 1; y--) {
+ p = rectf + (bwidth * y + x);
*p = MIN2(*p, *(p - bwidth));
}
}
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
index 2add367f39e..be50641a125 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
@@ -23,7 +23,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-DisplaceOperation::DisplaceOperation(): NodeOperation()
+DisplaceOperation::DisplaceOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VECTOR);
@@ -52,14 +52,14 @@ void DisplaceOperation::initExecution()
/* minimum distance (in pixels) a pixel has to be displaced
* in order to take effect */
-#define DISPLACE_EPSILON 0.01f
+#define DISPLACE_EPSILON 0.01f
void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
float inVector[4];
float inScale[4];
- float p_dx, p_dy; /* main displacement in pixel space */
+ float p_dx, p_dy; /* main displacement in pixel space */
float d_dx, d_dy;
float dxt, dyt;
float u, v;
@@ -83,17 +83,17 @@ void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *i
v = y - p_dy + 0.5f;
/* calc derivatives */
- this->inputVectorProgram->read(inVector, x+1, y, COM_PS_NEAREST, inputBuffers);
+ this->inputVectorProgram->read(inVector, x + 1, y, COM_PS_NEAREST, inputBuffers);
d_dx = inVector[0] * xs;
- this->inputVectorProgram->read(inVector, x, y+1, COM_PS_NEAREST, inputBuffers);
+ this->inputVectorProgram->read(inVector, x, y + 1, COM_PS_NEAREST, inputBuffers);
d_dy = inVector[0] * ys;
/* clamp derivatives to minimum displacement distance in UV space */
dxt = p_dx - d_dx;
dyt = p_dy - d_dy;
- dxt = signf(dxt)*maxf(fabsf(dxt), DISPLACE_EPSILON)/this->getWidth();
- dyt = signf(dyt)*maxf(fabsf(dyt), DISPLACE_EPSILON)/this->getHeight();
+ dxt = signf(dxt) * maxf(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth();
+ dyt = signf(dyt) * maxf(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight();
/* EWA filtering */
this->inputColorProgram->read(color, u, v, dxt, dyt, inputBuffers);
@@ -111,7 +111,7 @@ bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffer
{
rcti colorInput;
rcti vectorInput;
- NodeOperation *operation=NULL;
+ NodeOperation *operation = NULL;
/* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */
/* image */
diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
index 8675caca1e2..716646e9c36 100644
--- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
@@ -23,7 +23,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-DisplaceSimpleOperation::DisplaceSimpleOperation(): NodeOperation()
+DisplaceSimpleOperation::DisplaceSimpleOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VECTOR);
@@ -51,14 +51,14 @@ void DisplaceSimpleOperation::initExecution()
/* minimum distance (in pixels) a pixel has to be displaced
* in order to take effect */
-#define DISPLACE_EPSILON 0.01f
+#define DISPLACE_EPSILON 0.01f
void DisplaceSimpleOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
{
float inVector[4];
float inScale[4];
- float p_dx, p_dy; /* main displacement in pixel space */
+ float p_dx, p_dy; /* main displacement in pixel space */
float u, v;
this->inputScaleXProgram->read(inScale, x, y, sampler, inputBuffers);
@@ -79,8 +79,8 @@ void DisplaceSimpleOperation::executePixel(float *color, float x, float y, Pixel
/* clamp nodes to avoid glitches */
u = x - p_dx + 0.5f;
v = y - p_dy + 0.5f;
- CLAMP(u, 0.f, this->getWidth()-1.f);
- CLAMP(v, 0.f, this->getHeight()-1.f);
+ CLAMP(u, 0.f, this->getWidth() - 1.f);
+ CLAMP(v, 0.f, this->getHeight() - 1.f);
this->inputColorProgram->read(color, u, v, sampler, inputBuffers);
}
@@ -96,7 +96,7 @@ void DisplaceSimpleOperation::deinitExecution()
bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti colorInput;
- NodeOperation *operation=NULL;
+ NodeOperation *operation = NULL;
/* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */
/* image */
diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp
index 304f7fa5066..ec01ba922b5 100644
--- a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_DistanceMatteOperation.h"
#include "BLI_math.h"
-DistanceMatteOperation::DistanceMatteOperation(): NodeOperation()
+DistanceMatteOperation::DistanceMatteOperation() : NodeOperation()
{
addInputSocket(COM_DT_COLOR);
addInputSocket(COM_DT_COLOR);
@@ -49,8 +49,8 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y,
float inKey[4];
float inImage[4];
- const float tolerence=this->settings->t1;
- const float falloff=this->settings->t2;
+ const float tolerence = this->settings->t1;
+ const float falloff = this->settings->t2;
float distance;
float alpha;
@@ -58,9 +58,9 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y,
this->inputKeyProgram->read(inKey, x, y, sampler, inputBuffers);
this->inputImageProgram->read(inImage, x, y, sampler, inputBuffers);
- distance = sqrt(pow((inKey[0]-inImage[0]),2)+
- pow((inKey[1]-inImage[1]),2)+
- pow((inKey[2]-inImage[2]),2));
+ distance = sqrt(pow((inKey[0] - inImage[0]), 2) +
+ pow((inKey[1] - inImage[1]), 2) +
+ pow((inKey[2] - inImage[2]), 2));
/* store matte(alpha) value in [0] to go with
* COM_SetAlphaOperation and the Value output
@@ -68,23 +68,23 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y,
/*make 100% transparent */
if (distance < tolerence) {
- outputValue[0]=0.f;
+ outputValue[0] = 0.f;
}
/*in the falloff region, make partially transparent */
- else if (distance < falloff+tolerence) {
- distance=distance-tolerence;
- alpha=distance/falloff;
+ else if (distance < falloff + tolerence) {
+ distance = distance - tolerence;
+ alpha = distance / falloff;
/*only change if more transparent than before */
if (alpha < inImage[3]) {
- outputValue[0]=alpha;
+ outputValue[0] = alpha;
}
else { /* leave as before */
- outputValue[0]=inImage[3];
+ outputValue[0] = inImage[3];
}
}
else {
- /* leave as before */
- outputValue[0]=inImage[3];
+ /* leave as before */
+ outputValue[0] = inImage[3];
}
}
diff --git a/source/blender/compositor/operations/COM_DotproductOperation.cpp b/source/blender/compositor/operations/COM_DotproductOperation.cpp
index b03b176f08a..e225a677989 100644
--- a/source/blender/compositor/operations/COM_DotproductOperation.cpp
+++ b/source/blender/compositor/operations/COM_DotproductOperation.cpp
@@ -44,12 +44,12 @@ 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, MemoryBuffer *inputBuffers[])
{
float input1[4];
float input2[4];
this->input1Operation->read(input1, x, y, sampler, inputBuffers);
this->input2Operation->read(input2, x, y, sampler, inputBuffers);
- color[0] = -(input1[0]*input2[0]+input1[1]*input2[1]+input1[2]*input2[2]);
+ color[0] = -(input1[0] * input2[0] + input1[1] * input2[1] + input1[2] * input2[2]);
}
diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
index df04b889200..8344a4d248b 100644
--- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
@@ -30,735 +30,735 @@
static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
{
int x;
- unsigned int isz=0; // inner edge size
- unsigned int osz=0; // outer edge size
- unsigned int gsz=0; // gradient fill area size
+ unsigned int isz = 0; // inner edge size
+ unsigned int osz = 0; // outer edge size
+ unsigned int gsz = 0; // gradient fill area size
/* Test the four corners */
/* upper left corner */
- x=t-rw+1;
+ x = t - rw + 1;
// test if inner mask is filled
if (limask[x]) {
// test if pixel underneath, or to the right, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) {
+ if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + 1] && lomask[x + 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
lres[x] = 3; // flag pixel as outer edge
}
/* upper right corner */
- x=t;
+ x = t;
// test if inner mask is filled
if (limask[x]) {
// test if pixel underneath, or to the left, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) {
+ if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x - 1] && lomask[x - 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
/* lower left corner */
- x=0;
+ x = 0;
// test if inner mask is filled
if (limask[x]) {
// test if pixel above, or to the right, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) {
+ if ((!limask[x + rw] && lomask[x + rw]) || (!limask[x + 1] && lomask[x + 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
/* lower right corner */
- x=rw-1;
+ x = rw - 1;
// test if inner mask is filled
if (limask[x]) {
// test if pixel above, or to the left, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) {
+ if ((!limask[x + rw] && lomask[x + rw]) || (!limask[x - 1] && lomask[x - 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
/* Test the TOP row of pixels in buffer, except corners */
- for (x = t-1; x>=(t-rw)+2; x--) {
+ for (x = t - 1; x >= (t - rw) + 2; x--) {
// test if inner mask is filled
if (limask[x]) {
// test if pixel to the right, or to the left, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+ if ((!limask[x - 1] && lomask[x - 1]) || (!limask[x + 1] && lomask[x + 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
}
/* Test the BOTTOM row of pixels in buffer, except corners */
- for (x = rw-2; x; x--) {
+ for (x = rw - 2; x; x--) {
// test if inner mask is filled
if (limask[x]) {
// test if pixel to the right, or to the left, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+ if ((!limask[x - 1] && lomask[x - 1]) || (!limask[x + 1] && lomask[x + 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
}
/* Test the LEFT edge of pixels in buffer, except corners */
- for (x = t-(rw<<1)+1; x>=rw; x-=rw) {
+ for (x = t - (rw << 1) + 1; x >= rw; x -= rw) {
// test if inner mask is filled
if (limask[x]) {
// test if pixel underneath, or above, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+ if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + rw] && lomask[x + rw])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
}
/* Test the RIGHT edge of pixels in buffer, except corners */
- for (x = t-rw; x>rw; x-=rw) {
+ for (x = t - rw; x > rw; x -= rw) {
// test if inner mask is filled
if (limask[x]) {
// test if pixel underneath, or above, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+ if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + rw] && lomask[x + rw])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
}
- rsize[0]=isz; // fill in our return sizes for edges + fill
- rsize[1]=osz;
- rsize[2]=gsz;
+ rsize[0] = isz; // fill in our return sizes for edges + fill
+ rsize[1] = osz;
+ rsize[2] = gsz;
}
static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
{
int x;
- unsigned int isz=0; // inner edge size
- unsigned int osz=0; // outer edge size
- unsigned int gsz=0; // gradient fill area size
+ unsigned int isz = 0; // inner edge size
+ unsigned int osz = 0; // outer edge size
+ unsigned int gsz = 0; // gradient fill area size
/* Test the four corners */
/* upper left corner */
- x=t-rw+1;
+ x = t - rw + 1;
// test if inner mask is filled
if (limask[x]) {
// test if pixel underneath, or to the right, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) {
+ if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + 1] && lomask[x + 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right
+ if (!lomask[x - rw] || !lomask[x + 1]) { // test if outer mask is empty underneath or to the right
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
/* upper right corner */
- x=t;
+ x = t;
// test if inner mask is filled
if (limask[x]) {
// test if pixel underneath, or to the left, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) {
+ if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x - 1] && lomask[x - 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left
+ if (!lomask[x - rw] || !lomask[x - 1]) { // test if outer mask is empty underneath or to the left
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
/* lower left corner */
- x=0;
+ x = 0;
// test if inner mask is filled
if (limask[x]) {
// test if pixel above, or to the right, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) {
+ if ((!limask[x + rw] && lomask[x + rw]) || (!limask[x + 1] && lomask[x + 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty above or to the right
+ if (!lomask[x + rw] || !lomask[x + 1]) { // test if outer mask is empty above or to the right
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
/* lower right corner */
- x=rw-1;
+ x = rw - 1;
// test if inner mask is filled
if (limask[x]) {
// test if pixel above, or to the left, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) {
+ if ((!limask[x + rw] && lomask[x + rw]) || (!limask[x - 1] && lomask[x - 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left
+ if (!lomask[x + rw] || !lomask[x - 1]) { // test if outer mask is empty above or to the left
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
/* Test the TOP row of pixels in buffer, except corners */
- for (x = t-1; x>=(t-rw)+2; x--) {
+ for (x = t - 1; x >= (t - rw) + 2; x--) {
// test if inner mask is filled
if (limask[x]) {
// test if pixel to the left, or to the right, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+ if ((!limask[x - 1] && lomask[x - 1]) || (!limask[x + 1] && lomask[x + 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x - 1] || !lomask[x + 1]) { // test if outer mask is empty to the left or to the right
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
}
/* Test the BOTTOM row of pixels in buffer, except corners */
- for (x = rw-2; x; x--) {
+ for (x = rw - 2; x; x--) {
// test if inner mask is filled
if (limask[x]) {
// test if pixel to the left, or to the right, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+ if ((!limask[x - 1] && lomask[x - 1]) || (!limask[x + 1] && lomask[x + 1])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x - 1] || !lomask[x + 1]) { // test if outer mask is empty to the left or to the right
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
}
/* Test the LEFT edge of pixels in buffer, except corners */
- for (x = t-(rw<<1)+1; x>=rw; x-=rw) {
+ for (x = t - (rw << 1) + 1; x >= rw; x -= rw) {
// test if inner mask is filled
if (limask[x]) {
// test if pixel underneath, or above, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+ if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + rw] && lomask[x + rw])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x - rw] || !lomask[x + rw]) { // test if outer mask is empty underneath or above
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
}
/* Test the RIGHT edge of pixels in buffer, except corners */
- for (x = t-rw; x>rw; x-=rw) {
+ for (x = t - rw; x > rw; x -= rw) {
// test if inner mask is filled
if (limask[x]) {
// test if pixel underneath, or above, are empty in the inner mask,
// but filled in the outer mask
- if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+ if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + rw] && lomask[x + rw])) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x - rw] || !lomask[x + rw]) { // test if outer mask is empty underneath or above
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
}
- rsize[0]=isz; // fill in our return sizes for edges + fill
- rsize[1]=osz;
- rsize[2]=gsz;
+ rsize[0] = isz; // fill in our return sizes for edges + fill
+ rsize[1] = osz;
+ rsize[2] = gsz;
}
static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
{
int x;
- unsigned int isz=0; // inner edge size
- unsigned int osz=0; // outer edge size
- unsigned int gsz=0; // gradient fill area size
+ unsigned int isz = 0; // inner edge size
+ unsigned int osz = 0; // outer edge size
+ unsigned int gsz = 0; // gradient fill area size
/* Test the four corners */
/* upper left corner */
- x=t-rw+1;
+ x = t - rw + 1;
// test if inner mask is filled
if (limask[x]) {
// test if the inner mask is empty underneath or to the right
- if (!limask[x-rw] || !limask[x+1]) {
+ if (!limask[x - rw] || !limask[x + 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
/* upper right corner */
- x=t;
+ x = t;
// test if inner mask is filled
if (limask[x]) {
// test if the inner mask is empty underneath or to the left
- if (!limask[x-rw] || !limask[x-1]) {
+ if (!limask[x - rw] || !limask[x - 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
/* lower left corner */
- x=0;
+ x = 0;
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty above or to the right
- if (!limask[x+rw] || !limask[x+1]) {
+ if (!limask[x + rw] || !limask[x + 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
/* lower right corner */
- x=rw-1;
+ x = rw - 1;
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty above or to the left
- if (!limask[x+rw] || !limask[x-1]) {
+ if (!limask[x + rw] || !limask[x - 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
/* Test the TOP row of pixels in buffer, except corners */
- for (x = t-1; x>=(t-rw)+2; x--) {
+ for (x = t - 1; x >= (t - rw) + 2; x--) {
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty to the left or to the right
- if (!limask[x-1] || !limask[x+1]) {
+ if (!limask[x - 1] || !limask[x + 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
}
/* Test the BOTTOM row of pixels in buffer, except corners */
- for (x = rw-2; x; x--) {
+ for (x = rw - 2; x; x--) {
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty to the left or to the right
- if (!limask[x-1] || !limask[x+1]) {
+ if (!limask[x - 1] || !limask[x + 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
}
/* Test the LEFT edge of pixels in buffer, except corners */
- for (x = t-(rw<<1)+1; x>=rw; x-=rw) {
+ for (x = t - (rw << 1) + 1; x >= rw; x -= rw) {
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty underneath or above
- if (!limask[x-rw] || !limask[x+rw]) {
+ if (!limask[x - rw] || !limask[x + rw]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
}
/* Test the RIGHT edge of pixels in buffer, except corners */
- for (x = t-rw; x>rw; x-=rw) {
+ for (x = t - rw; x > rw; x -= rw) {
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty underneath or above
- if (!limask[x-rw] || !limask[x+rw]) {
+ if (!limask[x - rw] || !limask[x + rw]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
}
- rsize[0]=isz; // fill in our return sizes for edges + fill
- rsize[1]=osz;
- rsize[2]=gsz;
+ rsize[0] = isz; // fill in our return sizes for edges + fill
+ rsize[1] = osz;
+ rsize[2] = gsz;
}
static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
{
int x;
- unsigned int isz=0; // inner edge size
- unsigned int osz=0; // outer edge size
- unsigned int gsz=0; // gradient fill area size
+ unsigned int isz = 0; // inner edge size
+ unsigned int osz = 0; // outer edge size
+ unsigned int gsz = 0; // gradient fill area size
/* Test the four corners */
/* upper left corner */
- x=t-rw+1;
+ x = t - rw + 1;
// test if inner mask is filled
if (limask[x]) {
// test if the inner mask is empty underneath or to the right
- if (!limask[x-rw] || !limask[x+1]) {
+ if (!limask[x - rw] || !limask[x + 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right
+ if (!lomask[x - rw] || !lomask[x + 1]) { // test if outer mask is empty underneath or to the right
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
/* upper right corner */
- x=t;
+ x = t;
// test if inner mask is filled
if (limask[x]) {
// test if the inner mask is empty underneath or to the left
- if (!limask[x-rw] || !limask[x-1]) {
+ if (!limask[x - rw] || !limask[x - 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left
+ if (!lomask[x - rw] || !lomask[x - 1]) { // test if outer mask is empty above or to the left
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
/* lower left corner */
- x=0;
+ x = 0;
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty above or to the right
- if (!limask[x+rw] || !limask[x+1]) {
+ if (!limask[x + rw] || !limask[x + 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right
+ if (!lomask[x + rw] || !lomask[x + 1]) { // test if outer mask is empty underneath or to the right
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
/* lower right corner */
- x=rw-1;
+ x = rw - 1;
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty above or to the left
- if (!limask[x+rw] || !limask[x-1]) {
+ if (!limask[x + rw] || !limask[x - 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left
+ if (!lomask[x + rw] || !lomask[x - 1]) { // test if outer mask is empty underneath or to the left
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
/* Test the TOP row of pixels in buffer, except corners */
- for (x = t-1; x>=(t-rw)+2; x--) {
+ for (x = t - 1; x >= (t - rw) + 2; x--) {
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty to the left or to the right
- if (!limask[x-1] || !limask[x+1]) {
+ if (!limask[x - 1] || !limask[x + 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x - 1] || !lomask[x + 1]) { // test if outer mask is empty to the left or to the right
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
}
/* Test the BOTTOM row of pixels in buffer, except corners */
- for (x = rw-2; x; x--) {
+ for (x = rw - 2; x; x--) {
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty to the left or to the right
- if (!limask[x-1] || !limask[x+1]) {
+ if (!limask[x - 1] || !limask[x + 1]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x - 1] || !lomask[x + 1]) { // test if outer mask is empty to the left or to the right
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
}
/* Test the LEFT edge of pixels in buffer, except corners */
- for (x = t-(rw<<1)+1; x>=rw; x-=rw) {
+ for (x = t - (rw << 1) + 1; x >= rw; x -= rw) {
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty underneath or above
- if (!limask[x-rw] || !limask[x+rw]) {
+ if (!limask[x - rw] || !limask[x + rw]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
+ if (!lomask[x - rw] || !lomask[x + rw]) { // test if outer mask is empty underneath or above
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
}
/* Test the RIGHT edge of pixels in buffer, except corners */
- for (x = t-rw; x>rw; x-=rw) {
+ for (x = t - rw; x > rw; x -= rw) {
// test if inner mask is filled
if (limask[x]) {
// test if inner mask is empty underneath or above
- if (!limask[x-rw] || !limask[x+rw]) {
+ if (!limask[x - rw] || !limask[x + rw]) {
isz++; // increment inner edge size
- lres[x]=4; // flag pixel as inner edge
+ lres[x] = 4; // flag pixel as inner edge
}
else {
- res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge
+ res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge
}
}
- else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
- if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
+ else if (lomask[x]) { // inner mask was empty, test if outer mask is filled
+ if (!lomask[x - rw] || !lomask[x + rw]) { // test if outer mask is empty underneath or above
osz++; // increment outer edge size
- lres[x]=3; // flag pixel as outer edge
+ lres[x] = 3; // flag pixel as outer edge
}
else {
gsz++; // increment the gradient pixel count
- lres[x]=2; // flag pixel as gradient
+ lres[x] = 2; // flag pixel as gradient
}
}
}
- rsize[0]=isz; // fill in our return sizes for edges + fill
- rsize[1]=osz;
- rsize[2]=gsz;
+ rsize[0] = isz; // fill in our return sizes for edges + fill
+ rsize[1] = osz;
+ rsize[2] = gsz;
}
static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
@@ -771,43 +771,43 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l
int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
/* Test all rows between the FIRST and LAST rows, excluding left and right edges */
- for (x = (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
- a=x-2;
- pix_prevRow=a+rw;
- pix_nextRow=a-rw;
- pix_prevCol=a+1;
- pix_nextCol=a-1;
- while (a>dx-2) {
+ for (x = (t - rw) + 1, dx = x - (rw - 2); dx > rw; x -= rw, dx -= rw) {
+ a = x - 2;
+ pix_prevRow = a + rw;
+ pix_nextRow = a - rw;
+ pix_prevCol = a + 1;
+ pix_nextCol = a - 1;
+ while (a > dx - 2) {
if (!limask[a]) { // if the inner mask is empty
if (lomask[a]) { // if the outer mask is full
/*
- Next we test all 4 directions around the current pixel: next/prev/up/down
- The test ensures that the outer mask is empty and that the inner mask
- is also empty. If both conditions are true for any one of the 4 adjacent pixels
- then the current pixel is counted as being a true outer edge pixel.
- */
+ Next we test all 4 directions around the current pixel: next/prev/up/down
+ The test ensures that the outer mask is empty and that the inner mask
+ is also empty. If both conditions are true for any one of the 4 adjacent pixels
+ then the current pixel is counted as being a true outer edge pixel.
+ */
if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
(!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
(!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
(!lomask[pix_prevRow] && !limask[pix_prevRow]))
{
- in_osz++; // increment the outer boundary pixel count
- lres[a]=3; // flag pixel as part of outer edge
+ in_osz++; // increment the outer boundary pixel count
+ lres[a] = 3; // flag pixel as part of outer edge
}
- else { // it's not a boundary pixel, but it is a gradient pixel
- in_gsz++; // increment the gradient pixel count
- lres[a]=2; // flag pixel as gradient
+ else { // it's not a boundary pixel, but it is a gradient pixel
+ in_gsz++; // increment the gradient pixel count
+ lres[a] = 2; // flag pixel as gradient
}
}
}
else {
if (!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) {
- in_isz++; // increment the inner boundary pixel count
- lres[a]=4; // flag pixel as part of inner edge
+ in_isz++; // increment the inner boundary pixel count
+ lres[a] = 4; // flag pixel as part of inner edge
}
else {
- res[a]=1.0f; // pixel is part of inner mask, but not at an edge
+ res[a] = 1.0f; // pixel is part of inner mask, but not at an edge
}
}
a--;
@@ -818,9 +818,9 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l
}
}
- rsize[0]=in_isz; // fill in our return sizes for edges + fill
- rsize[1]=in_osz;
- rsize[2]=in_gsz;
+ rsize[0] = in_isz; // fill in our return sizes for edges + fill
+ rsize[1] = in_osz;
+ rsize[2] = in_gsz;
}
static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
@@ -833,32 +833,32 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i
int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
/* Test all rows between the FIRST and LAST rows, excluding left and right edges */
- for (x = (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
- a=x-2;
- pix_prevRow=a+rw;
- pix_nextRow=a-rw;
- pix_prevCol=a+1;
- pix_nextCol=a-1;
- while (a>dx-2) {
- if (!limask[a]) { // if the inner mask is empty
- if (lomask[a]) { // if the outer mask is full
+ for (x = (t - rw) + 1, dx = x - (rw - 2); dx > rw; x -= rw, dx -= rw) {
+ a = x - 2;
+ pix_prevRow = a + rw;
+ pix_nextRow = a - rw;
+ pix_prevCol = a + 1;
+ pix_nextCol = a - 1;
+ while (a > dx - 2) {
+ if (!limask[a]) { // if the inner mask is empty
+ if (lomask[a]) { // if the outer mask is full
/*
- Next we test all 4 directions around the current pixel: next/prev/up/down
- The test ensures that the outer mask is empty and that the inner mask
- is also empty. If both conditions are true for any one of the 4 adjacent pixels
- then the current pixel is counted as being a true outer edge pixel.
- */
+ Next we test all 4 directions around the current pixel: next/prev/up/down
+ The test ensures that the outer mask is empty and that the inner mask
+ is also empty. If both conditions are true for any one of the 4 adjacent pixels
+ then the current pixel is counted as being a true outer edge pixel.
+ */
if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
(!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
(!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
(!lomask[pix_prevRow] && !limask[pix_prevRow]))
{
- in_osz++; // increment the outer boundary pixel count
- lres[a]=3; // flag pixel as part of outer edge
+ in_osz++; // increment the outer boundary pixel count
+ lres[a] = 3; // flag pixel as part of outer edge
}
- else { // it's not a boundary pixel, but it is a gradient pixel
- in_gsz++; // increment the gradient pixel count
- lres[a]=2; // flag pixel as gradient
+ else { // it's not a boundary pixel, but it is a gradient pixel
+ in_gsz++; // increment the gradient pixel count
+ lres[a] = 2; // flag pixel as gradient
}
}
@@ -869,24 +869,24 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i
(!limask[pix_nextRow] && lomask[pix_nextRow]) ||
(!limask[pix_prevRow] && lomask[pix_prevRow]))
{
- in_isz++; // increment the inner boundary pixel count
- lres[a]=4; // flag pixel as part of inner edge
+ in_isz++; // increment the inner boundary pixel count
+ lres[a] = 4; // flag pixel as part of inner edge
}
else {
- res[a]=1.0f; // pixel is part of inner mask, but not at an edge
+ res[a] = 1.0f; // pixel is part of inner mask, but not at an edge
}
}
a--;
- pix_prevRow--; // advance all four "surrounding" pixel pointers
+ pix_prevRow--; // advance all four "surrounding" pixel pointers
pix_nextRow--;
pix_prevCol--;
pix_nextCol--;
}
}
- rsize[0]=in_isz; // fill in our return sizes for edges + fill
- rsize[1]=in_osz;
- rsize[2]=in_gsz;
+ rsize[0] = in_isz; // fill in our return sizes for edges + fill
+ rsize[1] = in_osz;
+ rsize[2] = in_gsz;
}
static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz)
@@ -898,102 +898,102 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
unsigned int rsl; // long used for finding fast 1.0/sqrt
unsigned int gradientFillOffset;
- unsigned int innerAccum=0; // for looping inner edge pixel indexes, represents current position from offset
- unsigned int outerAccum=0; // for looping outer edge pixel indexes, represents current position from offset
- unsigned int gradientAccum=0; // for looping gradient pixel indexes, represents current position from offset
+ unsigned int innerAccum = 0; // for looping inner edge pixel indexes, represents current position from offset
+ unsigned int outerAccum = 0; // for looping outer edge pixel indexes, represents current position from offset
+ unsigned int gradientAccum = 0; // for looping gradient pixel indexes, represents current position from offset
/*
- Here we compute the size of buffer needed to hold (row,col) coordinates
- for each pixel previously determined to be either gradient, inner edge,
- or outer edge.
-
- Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even
- though gbuf[] is declared as unsigned short* (2 bytes) because we don't
- store the pixel indexes, we only store x,y location of pixel in buffer.
-
- This does make the assumption that x and y can fit in 16 unsigned bits
- so if Blender starts doing renders greater than 65536 in either direction
- this will need to allocate gbuf[] as unsigned int *and allocate 8 bytes
- per flagged pixel.
-
- In general, the buffer on-screen:
-
- Example: 9 by 9 pixel block
-
- . = pixel non-white in both outer and inner mask
- o = pixel white in outer, but not inner mask, adjacent to "." pixel
- g = pixel white in outer, but not inner mask, not adjacent to "." pixel
- i = pixel white in inner mask, adjacent to "g" or "." pixel
- F = pixel white in inner mask, only adjacent to other pixels white in the inner mask
-
-
- ......... <----- pixel #80
- ..oooo...
- .oggggo..
- .oggiggo.
- .ogiFigo.
- .oggiggo.
- .oggggo..
- ..oooo...
- pixel #00 -----> .........
-
- gsz = 18 (18 "g" pixels above)
- isz = 4 (4 "i" pixels above)
- osz = 18 (18 "o" pixels above)
-
-
- The memory in gbuf[] after filling will look like this:
-
- gradientFillOffset (0 pixels) innerEdgeOffset (18 pixels) outerEdgeOffset (22 pixels)
- / / /
- / / /
- |X Y X Y X Y X Y > <X Y X Y > <X Y X Y X Y > <X Y X Y | <- (x,y)
- +--------------------------------> <----------------> <------------------------> <----------------+
- |0 2 4 6 8 10 12 14 > ... <68 70 72 74 > ... <80 82 84 86 88 90 > ... <152 154 156 158 | <- bytes
- +--------------------------------> <----------------> <------------------------> <----------------+
- |g0 g0 g1 g1 g2 g2 g3 g3 > <g17 g17 i0 i0 > <i2 i2 i3 i3 o0 o0 > <o16 o16 o17 o17 | <- pixel
- / / /
- / / /
- / / /
- +---------- gradientAccum (18) ---------+ +--- innerAccum (22) ---+ +--- outerAccum (40) ---+
-
-
- Ultimately we do need the pixel's memory buffer index to set the output
- pixel color, but it's faster to reconstruct the memory buffer location
- each iteration of the final gradient calculation than it is to deconstruct
- a memory location into x,y pairs each round.
-*/
-
-
- gradientFillOffset=0; // since there are likely "more" of these, put it first. :)
- *innerEdgeOffset=gradientFillOffset+gsz; // set start of inner edge indexes
- *outerEdgeOffset=(*innerEdgeOffset)+isz; // set start of outer edge indexes
+ Here we compute the size of buffer needed to hold (row,col) coordinates
+ for each pixel previously determined to be either gradient, inner edge,
+ or outer edge.
+
+ Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even
+ though gbuf[] is declared as unsigned short* (2 bytes) because we don't
+ store the pixel indexes, we only store x,y location of pixel in buffer.
+
+ This does make the assumption that x and y can fit in 16 unsigned bits
+ so if Blender starts doing renders greater than 65536 in either direction
+ this will need to allocate gbuf[] as unsigned int *and allocate 8 bytes
+ per flagged pixel.
+
+ In general, the buffer on-screen:
+
+ Example: 9 by 9 pixel block
+
+ . = pixel non-white in both outer and inner mask
+ o = pixel white in outer, but not inner mask, adjacent to "." pixel
+ g = pixel white in outer, but not inner mask, not adjacent to "." pixel
+ i = pixel white in inner mask, adjacent to "g" or "." pixel
+ F = pixel white in inner mask, only adjacent to other pixels white in the inner mask
+
+
+ ......... <----- pixel #80
+ ..oooo...
+ .oggggo..
+ .oggiggo.
+ .ogiFigo.
+ .oggiggo.
+ .oggggo..
+ ..oooo...
+ pixel #00 -----> .........
+
+ gsz = 18 (18 "g" pixels above)
+ isz = 4 (4 "i" pixels above)
+ osz = 18 (18 "o" pixels above)
+
+
+ The memory in gbuf[] after filling will look like this:
+
+ gradientFillOffset (0 pixels) innerEdgeOffset (18 pixels) outerEdgeOffset (22 pixels)
+ / / /
+ / / /
+ |X Y X Y X Y X Y > <X Y X Y > <X Y X Y X Y > <X Y X Y | <- (x,y)
+ +--------------------------------> <----------------> <------------------------> <----------------+
+ |0 2 4 6 8 10 12 14 > ... <68 70 72 74 > ... <80 82 84 86 88 90 > ... <152 154 156 158 | <- bytes
+ +--------------------------------> <----------------> <------------------------> <----------------+
+ |g0 g0 g1 g1 g2 g2 g3 g3 > <g17 g17 i0 i0 > <i2 i2 i3 i3 o0 o0 > <o16 o16 o17 o17 | <- pixel
+ / / /
+ / / /
+ / / /
+ +---------- gradientAccum (18) ---------+ +--- innerAccum (22) ---+ +--- outerAccum (40) ---+
+
+
+ Ultimately we do need the pixel's memory buffer index to set the output
+ pixel color, but it's faster to reconstruct the memory buffer location
+ each iteration of the final gradient calculation than it is to deconstruct
+ a memory location into x,y pairs each round.
+ */
+
+
+ gradientFillOffset = 0; // since there are likely "more" of these, put it first. :)
+ *innerEdgeOffset = gradientFillOffset + gsz; // set start of inner edge indexes
+ *outerEdgeOffset = (*innerEdgeOffset) + isz; // set start of outer edge indexes
/* set the accumulators to correct positions */ // set up some accumulator variables for loops
gradientAccum = gradientFillOffset; // each accumulator variable starts at its respective
innerAccum = *innerEdgeOffset; // section's offset so when we start filling, each
outerAccum = *outerEdgeOffset; // section fills up it's allocated space in gbuf
//uses dmin=row, rsl=col
- for (x=0,dmin=0; x<t; x+=rw,dmin++) {
- for (rsl=0; rsl<rw; rsl++) {
- a=x+rsl;
- if (lres[a]==2) { // it is a gradient pixel flagged by 2
- ud=gradientAccum<<1; // double the index to reach correct unsigned short location
- gbuf[ud]=dmin; // insert pixel's row into gradient pixel location buffer
- gbuf[ud+1]=rsl; // insert pixel's column into gradient pixel location buffer
- gradientAccum++; // increment gradient index buffer pointer
+ for (x = 0, dmin = 0; x < t; x += rw, dmin++) {
+ for (rsl = 0; rsl < rw; rsl++) {
+ a = x + rsl;
+ if (lres[a] == 2) { // it is a gradient pixel flagged by 2
+ ud = gradientAccum << 1; // double the index to reach correct unsigned short location
+ gbuf[ud] = dmin; // insert pixel's row into gradient pixel location buffer
+ gbuf[ud + 1] = rsl; // insert pixel's column into gradient pixel location buffer
+ gradientAccum++; // increment gradient index buffer pointer
}
- else if (lres[a]==3) { // it is an outer edge pixel flagged by 3
- ud=outerAccum<<1; // double the index to reach correct unsigned short location
- gbuf[ud]=dmin; // insert pixel's row into outer edge pixel location buffer
- gbuf[ud+1]=rsl; // insert pixel's column into outer edge pixel location buffer
- outerAccum++; // increment outer edge index buffer pointer
- res[a]=0.0f; // set output pixel intensity now since it won't change later
+ else if (lres[a] == 3) { // it is an outer edge pixel flagged by 3
+ ud = outerAccum << 1; // double the index to reach correct unsigned short location
+ gbuf[ud] = dmin; // insert pixel's row into outer edge pixel location buffer
+ gbuf[ud + 1] = rsl; // insert pixel's column into outer edge pixel location buffer
+ outerAccum++; // increment outer edge index buffer pointer
+ res[a] = 0.0f; // set output pixel intensity now since it won't change later
}
- else if (lres[a]==4) { // it is an inner edge pixel flagged by 4
- ud=innerAccum<<1; // double int index to reach correct unsigned short location
- gbuf[ud]=dmin; // insert pixel's row into inner edge pixel location buffer
- gbuf[ud+1]=rsl; // insert pixel's column into inner edge pixel location buffer
- innerAccum++; // increment inner edge index buffer pointer
- res[a]=1.0f; // set output pixel intensity now since it won't change later
+ else if (lres[a] == 4) { // it is an inner edge pixel flagged by 4
+ ud = innerAccum << 1; // double int index to reach correct unsigned short location
+ gbuf[ud] = dmin; // insert pixel's row into inner edge pixel location buffer
+ gbuf[ud + 1] = rsl; // insert pixel's column into inner edge pixel location buffer
+ innerAccum++; // increment inner edge index buffer pointer
+ res[a] = 1.0f; // set output pixel intensity now since it won't change later
}
}
}
@@ -1019,111 +1019,111 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
int dy; // dy = Y-delta (used for distance proportion calculation)
/*
- The general algorithm used to color each gradient pixel is:
-
- 1.) Loop through all gradient pixels.
- A.) For each gradient pixel:
- a.) Loop though all outside edge pixels, looking for closest one
- to the gradient pixel we are in.
- b.) Loop through all inside edge pixels, looking for closest one
- to the gradient pixel we are in.
- c.) Find proportion of distance from gradient pixel to inside edge
- pixel compared to sum of distance to inside edge and distance to
- outside edge.
-
- In an image where:
- . = blank (black) pixels, not covered by inner mask or outer mask
- + = desired gradient pixels, covered only by outer mask
- * = white full mask pixels, covered by at least inner mask
-
- ...............................
- ...............+++++++++++.....
- ...+O++++++..++++++++++++++....
- ..+++\++++++++++++++++++++.....
- .+++++G+++++++++*******+++.....
- .+++++|+++++++*********+++.....
- .++***I****************+++.....
- .++*******************+++......
- .+++*****************+++.......
- ..+++***************+++........
- ....+++**********+++...........
- ......++++++++++++.............
- ...............................
-
- O = outside edge pixel
- \
- G = gradient pixel
- |
- I = inside edge pixel
-
- __
- *note that IO does not need to be a straight line, in fact
- many cases can arise where straight lines do not work
- correctly.
-
- __ __ __
- d.) Pixel color is assigned as |GO| / ( |GI| + |GO| )
-
- The implementation does not compute distance, but the reciprocal of the
- distance. This is done to avoid having to compute a square root, as a
- reciprocal square root can be computed faster. Therefore, the code computes
- 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
- 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
-
- Loop through all gradient pixels.
- */
-
- for (x = gsz-1; x>=0; x--) {
- gradientFillOffset=x<<1;
- t=gbuf[gradientFillOffset]; // calculate column of pixel indexed by gbuf[x]
- fsz=gbuf[gradientFillOffset+1]; // calculate row of pixel indexed by gbuf[x]
- dmin=0xffffffff; // reset min distance to edge pixel
- for (a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) { // loop through all outer edge buffer pixels
- ud=a<<1;
- dy=t-gbuf[ud]; // set dx to gradient pixel column - outer edge pixel row
- dx=fsz-gbuf[ud+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
+ * The general algorithm used to color each gradient pixel is:
+ *
+ * 1.) Loop through all gradient pixels.
+ * A.) For each gradient pixel:
+ * a.) Loop though all outside edge pixels, looking for closest one
+ * to the gradient pixel we are in.
+ * b.) Loop through all inside edge pixels, looking for closest one
+ * to the gradient pixel we are in.
+ * c.) Find proportion of distance from gradient pixel to inside edge
+ * pixel compared to sum of distance to inside edge and distance to
+ * outside edge.
+ *
+ * In an image where:
+ * . = blank (black) pixels, not covered by inner mask or outer mask
+ * + = desired gradient pixels, covered only by outer mask
+ * * = white full mask pixels, covered by at least inner mask
+ *
+ * ...............................
+ * ...............+++++++++++.....
+ * ...+O++++++..++++++++++++++....
+ * ..+++\++++++++++++++++++++.....
+ * .+++++G+++++++++*******+++.....
+ * .+++++|+++++++*********+++.....
+ * .++***I****************+++.....
+ * .++*******************+++......
+ * .+++*****************+++.......
+ * ..+++***************+++........
+ * ....+++**********+++...........
+ * ......++++++++++++.............
+ * ...............................
+ *
+ * O = outside edge pixel
+ * \
+ * G = gradient pixel
+ * |
+ * I = inside edge pixel
+ *
+ * __
+ * *note that IO does not need to be a straight line, in fact
+ * many cases can arise where straight lines do not work
+ * correctly.
+ *
+ * __ __ __
+ * d.) Pixel color is assigned as |GO| / ( |GI| + |GO| )
+ *
+ * The implementation does not compute distance, but the reciprocal of the
+ * distance. This is done to avoid having to compute a square root, as a
+ * reciprocal square root can be computed faster. Therefore, the code computes
+ * 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
+ * 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
+ *
+ * Loop through all gradient pixels.
+ */
+
+ for (x = gsz - 1; x >= 0; x--) {
+ gradientFillOffset = x << 1;
+ t = gbuf[gradientFillOffset]; // calculate column of pixel indexed by gbuf[x]
+ fsz = gbuf[gradientFillOffset + 1]; // calculate row of pixel indexed by gbuf[x]
+ dmin = 0xffffffff; // reset min distance to edge pixel
+ for (a = outerEdgeOffset + osz - 1; a >= outerEdgeOffset; a--) { // loop through all outer edge buffer pixels
+ ud = a << 1;
+ dy = t - gbuf[ud]; // set dx to gradient pixel column - outer edge pixel row
+ dx = fsz - gbuf[ud + 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=(float)(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 ** --
- dmin=0xffffffff; // reset min distance to edge pixel
- for (a = innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels
- ud=a<<1;
- dy=t-gbuf[ud]; // compute delta in Y from gradient pixel to inside edge pixel
- dx=fsz-gbuf[ud+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
+ odist = (float)(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 ** --
+ dmin = 0xffffffff; // reset min distance to edge pixel
+ for (a = innerEdgeOffset + isz - 1; a >= innerEdgeOffset; a--) { // loop through all inside edge pixels
+ ud = a << 1;
+ dy = t - gbuf[ud]; // compute delta in Y from gradient pixel to inside edge pixel
+ dx = fsz - gbuf[ud + 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=(float)(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 = (float)(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)); //
/*
- 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.
- */
+ * 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.
+ */
/*
- Here we reconstruct the pixel's memory location in the CompBuf by
- Pixel Index = Pixel Column + ( Pixel Row * Row Width )
- */
- res[gbuf[gradientFillOffset+1]+(gbuf[gradientFillOffset]*rw)]=(idist/(idist+odist)); //set intensity
+ * Here we reconstruct the pixel's memory location in the CompBuf by
+ * Pixel Index = Pixel Column + ( Pixel Row * Row Width )
+ */
+ res[gbuf[gradientFillOffset + 1] + (gbuf[gradientFillOffset] * rw)] = (idist / (idist + odist)); //set intensity
}
}
@@ -1140,92 +1140,92 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float
int t; // t = total number of pixels in buffer - 1 (used for loop starts)
int fsz; // size of the frame
- unsigned int isz=0; // size (in pixels) of inside edge pixel index buffer
- unsigned int osz=0; // size (in pixels) of outside edge pixel index buffer
- unsigned int gsz=0; // size (in pixels) of gradient pixel index buffer
- unsigned int rsize[3]; // size storage to pass to helper functions
- unsigned int innerEdgeOffset=0; // offset into final buffer where inner edge pixel indexes start
- unsigned int outerEdgeOffset=0; // offset into final buffer where outer edge pixel indexes start
+ unsigned int isz = 0; // size (in pixels) of inside edge pixel index buffer
+ unsigned int osz = 0; // size (in pixels) of outside edge pixel index buffer
+ unsigned int gsz = 0; // size (in pixels) of gradient pixel index buffer
+ unsigned int rsize[3]; // size storage to pass to helper functions
+ unsigned int innerEdgeOffset = 0; // offset into final buffer where inner edge pixel indexes start
+ unsigned int outerEdgeOffset = 0; // offset into final buffer where outer edge pixel indexes start
unsigned short *gbuf; // gradient/inner/outer pixel location index buffer
if (true) { // if both input sockets have some data coming in...
- t=(this->getWidth()*this->getHeight())-1; // determine size of the frame
+ t = (this->getWidth() * this->getHeight()) - 1; // determine size of the frame
- lres = (unsigned int*)res; // unsigned int pointer to output buffer (for bit level ops)
- limask=(unsigned int*)imask; // unsigned int pointer to input mask (for bit level ops)
- lomask=(unsigned int*)omask; // unsigned int pointer to output mask (for bit level ops)
+ lres = (unsigned int *)res; // unsigned int pointer to output buffer (for bit level ops)
+ limask = (unsigned int *)imask; // unsigned int pointer to input mask (for bit level ops)
+ lomask = (unsigned int *)omask; // unsigned int pointer to output mask (for bit level ops)
rw = this->getWidth(); // width of a row of pixels
/*
- The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the
- LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows.
- This allows for quick computation of outer edge pixels where
- a screen edge pixel is marked to be gradient.
-
- The pixel type (gradient vs inner-edge vs outer-edge) tests change
- depending on the user selected "Inner Edge Mode" and the user selected
- "Buffer Edge Mode" on the node's GUI. There are 4 sets of basically the
- same algorithm:
-
- 1.) Inner Edge -> Adjacent Only
- Buffer Edge -> Keep Inside
-
- 2.) Inner Edge -> Adjacent Only
- Buffer Edge -> Bleed Out
-
- 3.) Inner Edge -> All
- Buffer Edge -> Keep Inside
-
- 4.) Inner Edge -> All
- Buffer Edge -> Bleed Out
-
- Each version has slightly different criteria for detecting an edge pixel.
+ * The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the
+ * LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows.
+ * This allows for quick computation of outer edge pixels where
+ * a screen edge pixel is marked to be gradient.
+ *
+ * The pixel type (gradient vs inner-edge vs outer-edge) tests change
+ * depending on the user selected "Inner Edge Mode" and the user selected
+ * "Buffer Edge Mode" on the node's GUI. There are 4 sets of basically the
+ * same algorithm:
+ *
+ * 1.) Inner Edge -> Adjacent Only
+ * Buffer Edge -> Keep Inside
+ *
+ * 2.) Inner Edge -> Adjacent Only
+ * Buffer Edge -> Bleed Out
+ *
+ * 3.) Inner Edge -> All
+ * Buffer Edge -> Keep Inside
+ *
+ * 4.) Inner Edge -> All
+ * Buffer Edge -> Bleed Out
+ *
+ * Each version has slightly different criteria for detecting an edge pixel.
*/
- if (this->adjecentOnly) { // if "adjacent only" inner edge mode is turned on
- if (this->keepInside) { // if "keep inside" buffer edge mode is turned on
- do_adjacentKeepBorders(t,rw,limask,lomask,lres,res,rsize);
+ if (this->adjecentOnly) { // if "adjacent only" inner edge mode is turned on
+ if (this->keepInside) { // if "keep inside" buffer edge mode is turned on
+ do_adjacentKeepBorders(t, rw, limask, lomask, lres, res, rsize);
}
- else { // "bleed out" buffer edge mode is turned on
- do_adjacentBleedBorders(t,rw,limask,lomask,lres,res,rsize);
+ else { // "bleed out" buffer edge mode is turned on
+ do_adjacentBleedBorders(t, rw, limask, lomask, lres, res, rsize);
}
- isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
- osz=rsize[1];
- gsz=rsize[2];
+ isz = rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
+ osz = rsize[1];
+ gsz = rsize[2];
// detect edges in all non-border pixels in the buffer
- do_adjacentEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
+ do_adjacentEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz);
}
- else { // "all" inner edge mode is turned on
- if (this->keepInside) { // if "keep inside" buffer edge mode is turned on
- do_allKeepBorders(t,rw,limask,lomask,lres,res,rsize);
+ else { // "all" inner edge mode is turned on
+ if (this->keepInside) { // if "keep inside" buffer edge mode is turned on
+ do_allKeepBorders(t, rw, limask, lomask, lres, res, rsize);
}
- else { // "bleed out" buffer edge mode is turned on
- do_allBleedBorders(t,rw,limask,lomask,lres,res,rsize);
+ else { // "bleed out" buffer edge mode is turned on
+ do_allBleedBorders(t, rw, limask, lomask, lres, res, rsize);
}
- isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
- osz=rsize[1];
- gsz=rsize[2];
+ isz = rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
+ osz = rsize[1];
+ gsz = rsize[2];
// detect edges in all non-border pixels in the buffer
- do_allEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
+ do_allEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz);
}
- isz=rsize[0]; // set edge and gradient buffer sizes once again...
- osz=rsize[1]; // the sizes in rsize[] may have been modified
- gsz=rsize[2]; // by the do_*EdgeDetection() function.
+ isz = rsize[0]; // set edge and gradient buffer sizes once again...
+ osz = rsize[1]; // the sizes in rsize[] may have been modified
+ gsz = rsize[2]; // by the do_*EdgeDetection() function.
- fsz=gsz+isz+osz; // calculate size of pixel index buffer needed
- gbuf = (unsigned short*)MEM_callocN(sizeof (unsigned short)*fsz*2, "DEM"); // allocate edge/gradient pixel index buffer
+ fsz = gsz + isz + osz; // calculate size of pixel index buffer needed
+ gbuf = (unsigned short *)MEM_callocN(sizeof(unsigned short) * fsz * 2, "DEM"); // allocate edge/gradient pixel index buffer
- do_createEdgeLocationBuffer(t,rw,lres,res,gbuf,&innerEdgeOffset,&outerEdgeOffset,isz,gsz);
- do_fillGradientBuffer(rw,res,gbuf,isz,osz,gsz,innerEdgeOffset,outerEdgeOffset);
+ do_createEdgeLocationBuffer(t, rw, lres, res, gbuf, &innerEdgeOffset, &outerEdgeOffset, isz, gsz);
+ do_fillGradientBuffer(rw, res, gbuf, isz, osz, gsz, innerEdgeOffset, outerEdgeOffset);
- MEM_freeN(gbuf); // free the gradient index buffer
+ MEM_freeN(gbuf); // free the gradient index buffer
}
}
-DoubleEdgeMaskOperation::DoubleEdgeMaskOperation(): NodeOperation()
+DoubleEdgeMaskOperation::DoubleEdgeMaskOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_VALUE);
@@ -1266,9 +1266,9 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **mem
lockMutex();
if (this->cachedInstance == NULL) {
- MemoryBuffer *innerMask = (MemoryBuffer*)inputInnerMask->initializeTileData(rect, memoryBuffers);
- MemoryBuffer *outerMask = (MemoryBuffer*)inputOuterMask->initializeTileData(rect, memoryBuffers);
- float *data = new float[this->getWidth()*this->getHeight()];
+ MemoryBuffer *innerMask = (MemoryBuffer *)inputInnerMask->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *outerMask = (MemoryBuffer *)inputOuterMask->initializeTileData(rect, memoryBuffers);
+ float *data = new float[this->getWidth() * this->getHeight()];
float *imask = innerMask->convertToValueBuffer();
float *omask = outerMask->convertToValueBuffer();
doDoubleEdgeMask(imask, omask, data);
@@ -1281,12 +1281,12 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **mem
}
void DoubleEdgeMaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
- float *buffer = (float*) data;
- int index = (y*this->getWidth() + x);
+ float *buffer = (float *) data;
+ int index = (y * this->getWidth() + x);
color[0] = buffer[index];
- color[1] = buffer[index+1];
- color[2] = buffer[index+2];
- color[3] = buffer[index+3];
+ color[1] = buffer[index + 1];
+ color[2] = buffer[index + 2];
+ color[3] = buffer[index + 3];
}
void DoubleEdgeMaskOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
index 650c57dd8dc..0beacd02738 100644
--- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
@@ -24,7 +24,7 @@
#include "BLI_math.h"
#include "DNA_node_types.h"
-EllipseMaskOperation::EllipseMaskOperation(): NodeOperation()
+EllipseMaskOperation::EllipseMaskOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_VALUE);
@@ -41,7 +41,7 @@ void EllipseMaskOperation::initExecution()
const double rad = DEG2RAD((double)this->data->rotation);
this->cosine = cos(rad);
this->sine = sin(rad);
- this->aspectRatio = ((float)this->getWidth())/this->getHeight();
+ this->aspectRatio = ((float)this->getWidth()) / this->getHeight();
}
void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -49,32 +49,32 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam
float inputMask[4];
float inputValue[4];
- float rx = x/this->getWidth();
- float ry = y/this->getHeight();
+ float rx = x / this->getWidth();
+ float ry = y / this->getHeight();
- const float dy = (ry - this->data->y)/this->aspectRatio;
+ const float dy = (ry - this->data->y) / this->aspectRatio;
const float dx = rx - this->data->x;
- rx = this->data->x+(this->cosine*dx + this->sine*dy);
- ry = this->data->y+(-this->sine*dx + this->cosine*dy);
+ rx = this->data->x + (this->cosine * dx + this->sine * dy);
+ ry = this->data->y + (-this->sine * dx + this->cosine * dy);
this->inputMask->read(inputMask, x, y, sampler, inputBuffers);
this->inputValue->read(inputValue, x, y, sampler, inputBuffers);
- const float halfHeight = (this->data->height)/2.0f;
- const float halfWidth = this->data->width/2.0f;
- float sx = rx-this->data->x;
+ const float halfHeight = (this->data->height) / 2.0f;
+ const float halfWidth = this->data->width / 2.0f;
+ float sx = rx - this->data->x;
sx *= sx;
const float tx = halfWidth * halfWidth;
- float sy = ry-this->data->y;
+ float sy = ry - this->data->y;
sy *= sy;
const float ty = halfHeight * halfHeight;
- bool inside = ((sx/tx)+(sy/ty))<1.0f;
+ bool inside = ((sx / tx) + (sy / ty)) < 1.0f;
switch (this->maskType) {
case CMP_NODE_MASKTYPE_ADD:
if (inside) {
- color[0] = max(inputMask[0],inputValue[0]);
+ color[0] = max(inputMask[0], inputValue[0]);
}
else {
color[0] = inputMask[0];
@@ -82,7 +82,7 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam
break;
case CMP_NODE_MASKTYPE_SUBTRACT:
if (inside) {
- color[0] = inputMask[0]-inputValue[0];
+ color[0] = inputMask[0] - inputValue[0];
CLAMP(color[0], 0, 1);
}
else {
@@ -91,24 +91,24 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam
break;
case CMP_NODE_MASKTYPE_MULTIPLY:
if (inside) {
- color[0] = inputMask[0]*inputValue[0];
+ color[0] = inputMask[0] * inputValue[0];
}
else {
color[0] = 0;
}
break;
case CMP_NODE_MASKTYPE_NOT:
- if (inside) {
- if (inputMask[0]>0.0f) {
- color[0] = 0;
+ if (inside) {
+ if (inputMask[0] > 0.0f) {
+ color[0] = 0;
+ }
+ else {
+ color[0] = inputValue[0];
+ }
}
else {
- color[0] = inputValue[0];
+ color[0] = inputMask[0];
}
- }
- else {
- color[0] = inputMask[0];
- }
break;
}
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index 7830eef829c..7491b0f30dd 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -20,11 +20,13 @@
* Monique Dewanchand
*/
+#include <limits.h>
+
#include "COM_FastGaussianBlurOperation.h"
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
-FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation()
+FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation(COM_DT_COLOR)
{
this->iirgaus = NULL;
}
@@ -74,7 +76,7 @@ void FastGaussianBlurOperation::deinitExecution()
delete this->iirgaus;
this->iirgaus = NULL;
}
- BlurBaseOperation::deinitMutex();
+ BlurBaseOperation::deinitMutex();
}
void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
@@ -84,7 +86,7 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **m
MemoryBuffer *newBuf = (MemoryBuffer *)this->inputProgram->initializeTileData(rect, memoryBuffers);
MemoryBuffer *copy = newBuf->duplicate();
updateSize(memoryBuffers);
-
+
int c;
sx = data->sizex * this->size / 2.0f;
sy = data->sizey * this->size / 2.0f;
@@ -109,11 +111,14 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **m
return iirgaus;
}
-void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int chan, int xy)
+void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsigned int chan, unsigned int xy)
{
double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3];
double *X, *Y, *W;
- int i, x, y, sz;
+ const unsigned int src_width = src->getWidth();
+ const unsigned int src_height = src->getHeight();
+ unsigned int x, y, sz;
+ unsigned int i;
float *buffer = src->getBuffer();
// <0.5 not valid, though can have a possibly useful sort of sharpening effect
@@ -123,8 +128,8 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int ch
// XXX The YVV macro defined below explicitly expects sources of at least 3x3 pixels,
// so just skiping blur along faulty direction if src's def is below that limit!
- if (src->getWidth() < 3) xy &= ~(int) 1;
- if (src->getHeight() < 3) xy &= ~(int) 2;
+ if (src_width < 3) xy &= ~(int) 1;
+ if (src_height < 3) xy &= ~(int) 2;
if (xy < 1) return;
// see "Recursive Gabor Filtering" by Young/VanVliet
@@ -178,33 +183,34 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int ch
Y[L - 1] = cf[0] * W[L - 1] + cf[1] * tsv[0] + cf[2] * tsv[1] + cf[3] * tsv[2]; \
Y[L - 2] = cf[0] * W[L - 2] + cf[1] * Y[L - 1] + cf[2] * tsv[0] + cf[3] * tsv[1]; \
Y[L - 3] = cf[0] * W[L - 3] + cf[1] * Y[L - 2] + cf[2] * Y[L - 1] + cf[3] * tsv[0]; \
- for (i = L - 4; i >= 0; i--) { \
+ /* 'i != UINT_MAX' is really 'i >= 0', but necessary for unsigned int wrapping */ \
+ for (i = L - 4; i != UINT_MAX; i--) { \
Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3]; \
} \
} (void)0
// intermediate buffers
- sz = MAX2(src->getWidth(), src->getHeight());
+ sz = MAX2(src_width, src_height);
X = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss X buf");
Y = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss Y buf");
W = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss W buf");
if (xy & 1) { // H
- for (y = 0; y < src->getHeight(); ++y) {
- const int yx = y * src->getWidth();
- for (x = 0; x < src->getWidth(); ++x)
+ for (y = 0; y < src_height; ++y) {
+ const int yx = y * src_width;
+ for (x = 0; x < src_width; ++x)
X[x] = buffer[(x + yx) * COM_NUMBER_OF_CHANNELS + chan];
- YVV(src->getWidth());
- for (x = 0; x < src->getWidth(); ++x)
+ YVV(src_width);
+ for (x = 0; x < src_width; ++x)
buffer[(x + yx) * COM_NUMBER_OF_CHANNELS + chan] = Y[x];
}
}
if (xy & 2) { // V
- for (x = 0; x < src->getWidth(); ++x) {
- for (y = 0; y < src->getHeight(); ++y)
- X[y] = buffer[(x + y * src->getWidth()) * COM_NUMBER_OF_CHANNELS + chan];
- YVV(src->getHeight());
- for (y = 0; y < src->getHeight(); ++y)
- buffer[(x + y * src->getWidth()) * COM_NUMBER_OF_CHANNELS + chan] = Y[y];
+ for (x = 0; x < src_width; ++x) {
+ for (y = 0; y < src_height; ++y)
+ X[y] = buffer[(x + y * src_width) * COM_NUMBER_OF_CHANNELS + chan];
+ YVV(src_height);
+ for (y = 0; y < src_height; ++y)
+ buffer[(x + y * src_width) * COM_NUMBER_OF_CHANNELS + chan] = Y[y];
}
}
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
index f92e3dc68a5..0f3929f052c 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
@@ -36,7 +36,7 @@ public:
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
- static void IIR_gauss(MemoryBuffer *src, float sigma, int channel, int xy);
+ static void IIR_gauss(MemoryBuffer *src, float sigma, unsigned int channel, unsigned int xy);
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
void deinitExecution();
void initExecution();
diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp
index 38018ffc3f7..5023473f4aa 100644
--- a/source/blender/compositor/operations/COM_FlipOperation.cpp
+++ b/source/blender/compositor/operations/COM_FlipOperation.cpp
@@ -42,10 +42,10 @@ 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, MemoryBuffer *inputBuffers[])
{
- float nx = this->flipX?this->getWidth()-1-x:x;
- float ny = this->flipY?this->getHeight()-1-y:y;
+ float nx = this->flipX ? this->getWidth() - 1 - x : x;
+ float ny = this->flipY ? this->getHeight() - 1 - y : y;
this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
}
@@ -55,16 +55,16 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper
rcti newInput;
if (this->flipX) {
- newInput.xmax = (this->getWidth()- 1 - input->xmin)+1;
- newInput.xmin = (this->getWidth()- 1 - input->xmax)-1;
+ newInput.xmax = (this->getWidth() - 1 - input->xmin) + 1;
+ newInput.xmin = (this->getWidth() - 1 - input->xmax) - 1;
}
else {
newInput.xmin = input->xmin;
newInput.xmax = input->xmax;
}
if (this->flipY) {
- newInput.ymax = (this->getHeight()- 1 - input->ymin)+1;
- newInput.ymin = (this->getHeight()- 1 - input->ymax)-1;
+ newInput.ymax = (this->getHeight() - 1 - input->ymin) + 1;
+ newInput.ymin = (this->getHeight() - 1 - input->ymax) - 1;
}
else {
newInput.ymin = input->ymin;
diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
index a4fb20402a4..3e90b643604 100644
--- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
+++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_GammaCorrectOperation.h"
#include "BLI_math.h"
-GammaCorrectOperation::GammaCorrectOperation(): NodeOperation()
+GammaCorrectOperation::GammaCorrectOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
@@ -45,9 +45,9 @@ void GammaCorrectOperation::executePixel(float *color, float x, float y, PixelSa
}
/* check for negative to avoid nan's */
- color[0] = inputColor[0]>0.0f?inputColor[0]*inputColor[0] :0.0f;
- color[1] = inputColor[1]>0.0f?inputColor[1]*inputColor[1] :0.0f;
- color[2] = inputColor[2]>0.0f?inputColor[2]*inputColor[2] :0.0f;
+ color[0] = inputColor[0] > 0.0f ? inputColor[0] * inputColor[0] : 0.0f;
+ color[1] = inputColor[1] > 0.0f ? inputColor[1] * inputColor[1] : 0.0f;
+ color[2] = inputColor[2] > 0.0f ? inputColor[2] * inputColor[2] : 0.0f;
inputColor[0] *= inputColor[3];
inputColor[1] *= inputColor[3];
@@ -64,7 +64,7 @@ void GammaCorrectOperation::deinitExecution()
this->inputProgram = NULL;
}
-GammaUncorrectOperation::GammaUncorrectOperation(): NodeOperation()
+GammaUncorrectOperation::GammaUncorrectOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
@@ -86,9 +86,9 @@ void GammaUncorrectOperation::executePixel(float *color, float x, float y, Pixel
inputColor[2] /= inputColor[3];
}
- color[0] = inputColor[0]>0.0f?sqrtf(inputColor[0]) :0.0f;
- color[1] = inputColor[1]>0.0f?sqrtf(inputColor[1]) :0.0f;
- color[2] = inputColor[2]>0.0f?sqrtf(inputColor[2]) :0.0f;
+ color[0] = inputColor[0] > 0.0f ? sqrtf(inputColor[0]) : 0.0f;
+ color[1] = inputColor[1] > 0.0f ? sqrtf(inputColor[1]) : 0.0f;
+ color[2] = inputColor[2] > 0.0f ? sqrtf(inputColor[2]) : 0.0f;
inputColor[0] *= inputColor[3];
inputColor[1] *= inputColor[3];
diff --git a/source/blender/compositor/operations/COM_GammaOperation.cpp b/source/blender/compositor/operations/COM_GammaOperation.cpp
index 989ffd5dfba..2c3e78840ee 100644
--- a/source/blender/compositor/operations/COM_GammaOperation.cpp
+++ b/source/blender/compositor/operations/COM_GammaOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_GammaOperation.h"
#include "BLI_math.h"
-GammaOperation::GammaOperation(): NodeOperation()
+GammaOperation::GammaOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VALUE);
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
new file mode 100644
index 00000000000..1283ac48923
--- /dev/null
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
@@ -0,0 +1,190 @@
+/*
+ * 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
+ * Campbell Barton
+ */
+
+#include "COM_GaussianAlphaXBlurOperation.h"
+#include "BLI_math.h"
+
+extern "C" {
+ #include "RE_pipeline.h"
+}
+
+GaussianAlphaXBlurOperation::GaussianAlphaXBlurOperation() : BlurBaseOperation(COM_DT_VALUE)
+{
+ this->gausstab = NULL;
+ this->rad = 0;
+}
+
+void *GaussianAlphaXBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+{
+ if (!this->sizeavailable) {
+ updateGauss(memoryBuffers);
+ }
+ void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
+ return buffer;
+}
+
+void GaussianAlphaXBlurOperation::initExecution()
+{
+ /* BlurBaseOperation::initExecution(); */ /* until we suppoer size input - comment this */
+
+ if (this->sizeavailable) {
+ float rad = size * this->data->sizex;
+ if (rad < 1)
+ rad = 1;
+
+ this->rad = rad;
+ this->gausstab = BlurBaseOperation::make_gausstab(rad);
+ this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
+ }
+}
+
+void GaussianAlphaXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
+{
+ if (this->gausstab == NULL) {
+ updateSize(memoryBuffers);
+ float rad = size * this->data->sizex;
+ if (rad < 1)
+ rad = 1;
+
+ this->rad = rad;
+ this->gausstab = BlurBaseOperation::make_gausstab(rad);
+ }
+
+ if (this->distbuf_inv == NULL) {
+ updateSize(memoryBuffers);
+ float rad = size * this->data->sizex;
+ if (rad < 1)
+ rad = 1;
+
+ this->rad = rad;
+ this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
+ }
+}
+
+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)
+{
+ const bool do_invert = this->do_subtract;
+ MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
+ float *buffer = inputBuffer->getBuffer();
+ int bufferwidth = inputBuffer->getWidth();
+ int bufferstartx = inputBuffer->getRect()->xmin;
+ int bufferstarty = inputBuffer->getRect()->ymin;
+
+ int miny = y;
+ int maxy = y;
+ int minx = x - this->rad;
+ int maxx = x + this->rad;
+ miny = max(miny, inputBuffer->getRect()->ymin);
+ minx = max(minx, inputBuffer->getRect()->xmin);
+ maxy = min(maxy, inputBuffer->getRect()->ymax);
+ maxx = min(maxx, inputBuffer->getRect()->xmax);
+
+ /* *** this is the main part which is different to 'GaussianXBlurOperation' *** */
+ int step = getStep();
+ int offsetadd = getOffsetAdd();
+ int bufferindex = ((minx - bufferstartx) * 4) + ((miny - bufferstarty) * 4 * bufferwidth);
+
+ /* gauss */
+ float alpha_accum = 0.0f;
+ float multiplier_accum = 0.0f;
+
+ /* dilate */
+ float value_max = finv_test(buffer[(x * 4) + (y * 4 * bufferwidth)], do_invert); /* init with the current color to avoid unneeded lookups */
+ float distfacinv_max = 1.0f; /* 0 to 1 */
+
+ for (int nx = minx; nx < maxx; nx += step) {
+ const int index = (nx - x) + this->rad;
+ float value = finv_test(buffer[bufferindex], do_invert);
+ float multiplier;
+
+ /* gauss */
+ {
+ multiplier = gausstab[index];
+ alpha_accum += value * multiplier;
+ multiplier_accum += multiplier;
+ }
+
+ /* dilate - find most extreme color */
+ if (value > value_max) {
+ multiplier = distbuf_inv[index];
+ value *= multiplier;
+ if (value > value_max) {
+ value_max = value;
+ distfacinv_max = multiplier;
+ }
+ }
+ bufferindex += offsetadd;
+ }
+
+ /* blend between the max value and gauss blue - gives nice feather */
+ const float value_blur = alpha_accum / multiplier_accum;
+ const float value_final = (value_max * distfacinv_max) + (value_blur * (1.0f - distfacinv_max));
+ color[0] = finv_test(value_final, do_invert);
+}
+
+void GaussianAlphaXBlurOperation::deinitExecution()
+{
+ BlurBaseOperation::deinitExecution();
+ delete [] this->gausstab;
+ this->gausstab = NULL;
+ delete [] this->distbuf_inv;
+ this->distbuf_inv = NULL;
+}
+
+bool GaussianAlphaXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+{
+ rcti newInput;
+#if 0 /* until we add size input */
+ 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
+#endif
+ {
+ if (this->sizeavailable && this->gausstab != NULL) {
+ newInput.xmax = input->xmax + rad;
+ newInput.xmin = input->xmin - rad;
+ newInput.ymax = input->ymax;
+ newInput.ymin = input->ymin;
+ }
+ else {
+ newInput.xmax = this->getWidth();
+ newInput.xmin = 0;
+ newInput.ymax = this->getHeight();
+ newInput.ymin = 0;
+ }
+ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+ }
+}
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
new file mode 100644
index 00000000000..3268e51be01
--- /dev/null
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
@@ -0,0 +1,62 @@
+/*
+ * 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
+ * Campbell Barton
+ */
+
+#ifndef _COM_GaussianAlphaXBlurOperation_h
+#define _COM_GaussianAlphaXBlurOperation_h
+#include "COM_NodeOperation.h"
+#include "COM_BlurBaseOperation.h"
+
+class GaussianAlphaXBlurOperation : public BlurBaseOperation {
+private:
+ float *gausstab;
+ float *distbuf_inv;
+ bool do_subtract;
+ int rad;
+ void updateGauss(MemoryBuffer **memoryBuffers);
+public:
+ GaussianAlphaXBlurOperation();
+
+ /**
+ * @brief the inner loop of this program
+ */
+ void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+
+ /**
+ * @brief initialize the execution
+ */
+ void initExecution();
+
+ /**
+ * @brief Deinitialize the execution
+ */
+ void deinitExecution();
+
+ void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
+
+ /**
+ * Set subtract for Dilate/Erode functionality
+ */
+ void setSubtract(bool subtract) { this->do_subtract = subtract; }
+};
+#endif
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
new file mode 100644
index 00000000000..1d67c23e41b
--- /dev/null
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -0,0 +1,190 @@
+/*
+ * 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
+ * Campbell Barton
+ */
+
+#include "COM_GaussianAlphaYBlurOperation.h"
+#include "BLI_math.h"
+
+extern "C" {
+ #include "RE_pipeline.h"
+}
+
+GaussianAlphaYBlurOperation::GaussianAlphaYBlurOperation() : BlurBaseOperation(COM_DT_VALUE)
+{
+ this->gausstab = NULL;
+ this->rad = 0;
+}
+
+void *GaussianAlphaYBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+{
+ if (!this->sizeavailable) {
+ updateGauss(memoryBuffers);
+ }
+ void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
+ return buffer;
+}
+
+void GaussianAlphaYBlurOperation::initExecution()
+{
+ /* BlurBaseOperation::initExecution(); */ /* until we suppoer size input - comment this */
+
+ if (this->sizeavailable) {
+ float rad = size * this->data->sizey;
+ if (rad < 1)
+ rad = 1;
+
+ this->rad = rad;
+ this->gausstab = BlurBaseOperation::make_gausstab(rad);
+ this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
+ }
+}
+
+void GaussianAlphaYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
+{
+ if (this->gausstab == NULL) {
+ updateSize(memoryBuffers);
+ float rad = size * this->data->sizey;
+ if (rad < 1)
+ rad = 1;
+
+ this->rad = rad;
+ this->gausstab = BlurBaseOperation::make_gausstab(rad);
+ }
+
+ if (this->distbuf_inv == NULL) {
+ updateSize(memoryBuffers);
+ float rad = size * this->data->sizex;
+ if (rad < 1)
+ rad = 1;
+
+ this->rad = rad;
+ this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
+ }
+}
+
+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)
+{
+ const bool do_invert = this->do_subtract;
+ MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
+ float *buffer = inputBuffer->getBuffer();
+ int bufferwidth = inputBuffer->getWidth();
+ int bufferstartx = inputBuffer->getRect()->xmin;
+ int bufferstarty = inputBuffer->getRect()->ymin;
+
+ int miny = y - this->rad;
+ int maxy = y + this->rad;
+ int minx = x;
+ int maxx = x;
+ miny = max(miny, inputBuffer->getRect()->ymin);
+ minx = max(minx, inputBuffer->getRect()->xmin);
+ maxy = min(maxy, inputBuffer->getRect()->ymax);
+ maxx = min(maxx, inputBuffer->getRect()->xmax);
+
+ /* *** this is the main part which is different to 'GaussianYBlurOperation' *** */
+ int step = getStep();
+
+ /* gauss */
+ float alpha_accum = 0.0f;
+ float multiplier_accum = 0.0f;
+
+ /* dilate */
+ float value_max = finv_test(buffer[(x * 4) + (y * 4 * bufferwidth)], do_invert); /* init with the current color to avoid unneeded lookups */
+ float distfacinv_max = 1.0f; /* 0 to 1 */
+
+ for (int ny = miny; ny < maxy; ny += step) {
+ int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
+
+ const int index = (ny - y) + this->rad;
+ float value = finv_test(buffer[bufferindex], do_invert);
+ float multiplier;
+
+ /* gauss */
+ {
+ multiplier = gausstab[index];
+ alpha_accum += value * multiplier;
+ multiplier_accum += multiplier;
+ }
+
+ /* dilate - find most extreme color */
+ if (value > value_max) {
+ multiplier = distbuf_inv[index];
+ value *= multiplier;
+ if (value > value_max) {
+ value_max = value;
+ distfacinv_max = multiplier;
+ }
+ }
+
+ }
+
+ /* blend between the max value and gauss blue - gives nice feather */
+ const float value_blur = alpha_accum / multiplier_accum;
+ const float value_final = (value_max * distfacinv_max) + (value_blur * (1.0f - distfacinv_max));
+ color[0] = finv_test(value_final, do_invert);
+}
+
+void GaussianAlphaYBlurOperation::deinitExecution()
+{
+ BlurBaseOperation::deinitExecution();
+ delete [] this->gausstab;
+ this->gausstab = NULL;
+ delete [] this->distbuf_inv;
+ this->distbuf_inv = NULL;
+}
+
+bool GaussianAlphaYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+{
+ rcti newInput;
+#if 0 /* until we add size input */
+ 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
+#endif
+ {
+ if (this->sizeavailable && this->gausstab != NULL) {
+ newInput.xmax = input->xmax;
+ newInput.xmin = input->xmin;
+ newInput.ymax = input->ymax + rad;
+ newInput.ymin = input->ymin - rad;
+ }
+ else {
+ newInput.xmax = this->getWidth();
+ newInput.xmin = 0;
+ newInput.ymax = this->getHeight();
+ newInput.ymin = 0;
+ }
+ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+ }
+}
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
new file mode 100644
index 00000000000..0ffc264ba98
--- /dev/null
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
@@ -0,0 +1,62 @@
+/*
+ * 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
+ * Campbell Barton
+ */
+
+#ifndef _COM_GaussianAlphaYBlurOperation_h
+#define _COM_GaussianAlphaYBlurOperation_h
+#include "COM_NodeOperation.h"
+#include "COM_BlurBaseOperation.h"
+
+class GaussianAlphaYBlurOperation : public BlurBaseOperation {
+private:
+ float *gausstab;
+ float *distbuf_inv;
+ bool do_subtract;
+ int rad;
+ void updateGauss(MemoryBuffer **memoryBuffers);
+public:
+ GaussianAlphaYBlurOperation();
+
+ /**
+ * the inner loop of this program
+ */
+ void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
+
+ /**
+ * @brief initialize the execution
+ */
+ void initExecution();
+
+ /**
+ * Deinitialize the execution
+ */
+ void deinitExecution();
+
+ void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
+ bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
+
+ /**
+ * Set subtract for Dilate/Erode functionality
+ */
+ void setSubtract(bool subtract) { this->do_subtract = subtract; }
+};
+#endif
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index b38ed28cd6a..dc9e354b124 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -27,7 +27,7 @@ extern "C" {
#include "RE_pipeline.h"
}
-GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation()
+GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation(COM_DT_COLOR)
{
this->gausstab = NULL;
}
@@ -115,7 +115,7 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, Memory
tempColor[1] = 0;
tempColor[2] = 0;
tempColor[3] = 0;
- float overallmultiplyer = 0;
+ float multiplier_accum = 0;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
int bufferwidth = inputBuffer->getWidth();
@@ -138,15 +138,15 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, Memory
index = ((ny - y) + this->rady) * (this->radx * 2 + 1) + (minx - x + this->radx);
int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
for (int nx = minx; nx < maxx; nx += step) {
- const float multiplyer = gausstab[index];
- madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplyer);
- overallmultiplyer += multiplyer;
+ const float multiplier = gausstab[index];
+ madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplier);
+ multiplier_accum += multiplier;
index += step;
bufferindex += offsetadd;
}
}
- mul_v4_v4fl(color, tempColor, 1.0f / overallmultiplyer);
+ mul_v4_v4fl(color, tempColor, 1.0f / multiplier_accum);
}
void GaussianBokehBlurOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index 09a2a70ead3..7a1964a4a63 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -27,7 +27,7 @@ extern "C" {
#include "RE_pipeline.h"
}
-GaussianXBlurOperation::GaussianXBlurOperation() : BlurBaseOperation()
+GaussianXBlurOperation::GaussianXBlurOperation() : BlurBaseOperation(COM_DT_COLOR)
{
this->gausstab = NULL;
this->rad = 0;
@@ -72,12 +72,8 @@ void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
- float tempColor[4];
- tempColor[0] = 0;
- tempColor[1] = 0;
- tempColor[2] = 0;
- tempColor[3] = 0;
- float overallmultiplyer = 0.0f;
+ float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ float multiplier_accum = 0.0f;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
int bufferwidth = inputBuffer->getWidth();
@@ -99,12 +95,12 @@ void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuff
int bufferindex = ((minx - bufferstartx) * 4) + ((miny - bufferstarty) * 4 * bufferwidth);
for (int nx = minx; nx < maxx; nx += step) {
index = (nx - x) + this->rad;
- const float multiplyer = gausstab[index];
- madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplyer);
- overallmultiplyer += multiplyer;
+ const float multiplier = gausstab[index];
+ madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier);
+ multiplier_accum += multiplier;
bufferindex += offsetadd;
}
- mul_v4_v4fl(color, tempColor, 1.0f / overallmultiplyer);
+ mul_v4_v4fl(color, color_accum, 1.0f / multiplier_accum);
}
void GaussianXBlurOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
index 5dc896fafaa..10a8a538391 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
@@ -34,17 +34,17 @@ public:
GaussianXBlurOperation();
/**
- *@brief the inner loop of this program
+ * @brief the inner loop of this program
*/
void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
/**
- *@brief initialize the execution
+ * @brief initialize the execution
*/
void initExecution();
/**
- *@brief Deinitialize the execution
+ * @brief Deinitialize the execution
*/
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index ace817194f3..06c1c78d85a 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -27,7 +27,7 @@ extern "C" {
#include "RE_pipeline.h"
}
-GaussianYBlurOperation::GaussianYBlurOperation() : BlurBaseOperation()
+GaussianYBlurOperation::GaussianYBlurOperation() : BlurBaseOperation(COM_DT_COLOR)
{
this->gausstab = NULL;
this->rad = 0;
@@ -69,12 +69,8 @@ void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
void GaussianYBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
- float tempColor[4];
- tempColor[0] = 0;
- tempColor[1] = 0;
- tempColor[2] = 0;
- tempColor[3] = 0;
- float overallmultiplyer = 0;
+ float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ float multiplier_accum = 0.0f;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
int bufferwidth = inputBuffer->getWidth();
@@ -95,11 +91,11 @@ void GaussianYBlurOperation::executePixel(float *color, int x, int y, MemoryBuff
for (int ny = miny; ny < maxy; ny += step) {
index = (ny - y) + this->rad;
int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
- const float multiplyer = gausstab[index];
- madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplyer);
- overallmultiplyer += multiplyer;
+ const float multiplier = gausstab[index];
+ madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier);
+ multiplier_accum += multiplier;
}
- mul_v4_v4fl(color, tempColor, 1.0f / overallmultiplyer);
+ mul_v4_v4fl(color, color_accum, 1.0f / multiplier_accum);
}
void GaussianYBlurOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
index 2afcc2e5cc7..b8e46e2d0be 100644
--- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
+++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
@@ -32,7 +32,7 @@ extern "C" {
}
#endif
-HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation(): CurveBaseOperation()
+HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation() : CurveBaseOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
@@ -53,7 +53,7 @@ void HueSaturationValueCorrectOperation::executePixel(float *output, float x, fl
/* adjust hue, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(this->curveMapping, 0, hsv[0]);
- hsv[0] += f-0.5f;
+ hsv[0] += f - 0.5f;
/* adjust saturation, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(this->curveMapping, 1, hsv[0]);
diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cpp b/source/blender/compositor/operations/COM_IDMaskOperation.cpp
index 834ca4fc5ed..d02367088d7 100644
--- a/source/blender/compositor/operations/COM_IDMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_IDMaskOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_IDMaskOperation.h"
-IDMaskOperation::IDMaskOperation(): NodeOperation()
+IDMaskOperation::IDMaskOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -38,7 +38,7 @@ void IDMaskOperation::executePixel(float *color, float x, float y, PixelSampler
float inputValue[4];
this->inputProgram->read(inputValue, x, y, sampler, inputBuffers);
- const float a = (inputValue[0] == this->objectIndex)?1.0f:0.0f;
+ const float a = (inputValue[0] == this->objectIndex) ? 1.0f : 0.0f;
color[0] = a;
}
diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp
index 04cd91d3c3a..9dbe8419daa 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_ImageOperation.cpp
@@ -36,7 +36,7 @@ extern "C" {
#include "IMB_imbuf_types.h"
}
-BaseImageOperation::BaseImageOperation(): NodeOperation()
+BaseImageOperation::BaseImageOperation() : NodeOperation()
{
this->image = NULL;
this->buffer = NULL;
@@ -48,15 +48,15 @@ BaseImageOperation::BaseImageOperation(): NodeOperation()
this->depthBuffer = NULL;
this->numberOfChannels = 0;
}
-ImageOperation::ImageOperation(): BaseImageOperation()
+ImageOperation::ImageOperation() : BaseImageOperation()
{
this->addOutputSocket(COM_DT_COLOR);
}
-ImageAlphaOperation::ImageAlphaOperation(): BaseImageOperation()
+ImageAlphaOperation::ImageAlphaOperation() : BaseImageOperation()
{
this->addOutputSocket(COM_DT_VALUE);
}
-ImageDepthOperation::ImageDepthOperation(): BaseImageOperation()
+ImageDepthOperation::ImageDepthOperation() : BaseImageOperation()
{
this->addOutputSocket(COM_DT_VALUE);
}
@@ -66,12 +66,12 @@ ImBuf *BaseImageOperation::getImBuf()
ImBuf *ibuf;
ibuf = BKE_image_get_ibuf(this->image, this->imageUser);
- if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
- return NULL;
+ if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) {
+ return NULL;
}
if (ibuf->rect_float == NULL) {
- IMB_float_from_rect(ibuf);
+ IMB_float_from_rect(ibuf);
}
return ibuf;
}
@@ -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, MemoryBuffer *inputBuffers[])
{
if (this->imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
color[0] = 0.0f;
@@ -118,15 +118,15 @@ void ImageOperation::executePixel(float *color, float x, float y, PixelSampler s
}
else {
switch (sampler) {
- case COM_PS_NEAREST:
- neareast_interpolation_color(this->buffer, NULL, color, x, y);
- break;
- case COM_PS_BILINEAR:
- bilinear_interpolation_color(this->buffer, NULL, color, x, y);
- break;
- case COM_PS_BICUBIC:
- bicubic_interpolation_color(this->buffer, NULL, color, x, y);
- break;
+ case COM_PS_NEAREST:
+ neareast_interpolation_color(this->buffer, NULL, color, x, y);
+ break;
+ case COM_PS_BILINEAR:
+ bilinear_interpolation_color(this->buffer, NULL, color, x, y);
+ break;
+ case COM_PS_BICUBIC:
+ bicubic_interpolation_color(this->buffer, NULL, color, x, y);
+ break;
}
}
}
@@ -141,15 +141,15 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp
else {
tempcolor[3] = 1.0f;
switch (sampler) {
- case COM_PS_NEAREST:
- neareast_interpolation_color(this->buffer, NULL, tempcolor, x, y);
- break;
- case COM_PS_BILINEAR:
- bilinear_interpolation_color(this->buffer, NULL, tempcolor, x, y);
- break;
- case COM_PS_BICUBIC:
- bicubic_interpolation_color(this->buffer, NULL, tempcolor, x, y);
- break;
+ case COM_PS_NEAREST:
+ neareast_interpolation_color(this->buffer, NULL, tempcolor, x, y);
+ break;
+ case COM_PS_BILINEAR:
+ bilinear_interpolation_color(this->buffer, NULL, tempcolor, x, y);
+ break;
+ case COM_PS_BICUBIC:
+ bicubic_interpolation_color(this->buffer, NULL, tempcolor, x, y);
+ break;
}
color[0] = tempcolor[3];
}
diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp
index 82158c4adad..6142959a12e 100644
--- a/source/blender/compositor/operations/COM_InvertOperation.cpp
+++ b/source/blender/compositor/operations/COM_InvertOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_InvertOperation.h"
-InvertOperation::InvertOperation(): NodeOperation()
+InvertOperation::InvertOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_COLOR);
@@ -50,16 +50,16 @@ void InvertOperation::executePixel(float *out, float x, float y, PixelSampler sa
const float invertedValue = 1.0f - value;
if (color) {
- out[0] = (1.0f - inputColor[0])*value + inputColor[0]*invertedValue;
- out[1] = (1.0f - inputColor[1])*value + inputColor[1]*invertedValue;
- out[2] = (1.0f - inputColor[2])*value + inputColor[2]*invertedValue;
+ out[0] = (1.0f - inputColor[0]) * value + inputColor[0] * invertedValue;
+ out[1] = (1.0f - inputColor[1]) * value + inputColor[1] * invertedValue;
+ out[2] = (1.0f - inputColor[2]) * value + inputColor[2] * invertedValue;
}
else {
copy_v3_v3(out, inputColor);
}
if (alpha)
- out[3] = (1.0f - inputColor[3])*value + inputColor[3]*invertedValue;
+ out[3] = (1.0f - inputColor[3]) * value + inputColor[3] * invertedValue;
else
out[3] = inputColor[3];
diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
index 09b5b7a523c..2c9949f2b4b 100644
--- a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
@@ -28,7 +28,7 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
-KeyingClipOperation::KeyingClipOperation(): NodeOperation()
+KeyingClipOperation::KeyingClipOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -56,7 +56,7 @@ void KeyingClipOperation::executePixel(float *color, int x, int y, MemoryBuffer
const int delta = this->kernelRadius;
const float tolerance = this->kernelTolerance;
- MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+ MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
int bufferWidth = inputBuffer->getWidth();
diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
index b7fd2772729..04523384653 100644
--- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
@@ -40,7 +40,7 @@ static int get_pixel_primary_channel(float *pixel)
return 2;
}
-KeyingDespillOperation::KeyingDespillOperation(): NodeOperation()
+KeyingDespillOperation::KeyingDespillOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp
index e04c79f6713..0a450cc3bf8 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp
@@ -52,7 +52,7 @@ static float get_pixel_saturation(float pixelColor[4], float screen_balance, int
return (pixelColor[primary_channel] - val) * fabsf(1.0f - val);
}
-KeyingOperation::KeyingOperation(): NodeOperation()
+KeyingOperation::KeyingOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
index f6301557aaf..b728f6c5cca 100644
--- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
@@ -39,7 +39,7 @@ extern "C" {
#include "IMB_imbuf_types.h"
}
-KeyingScreenOperation::KeyingScreenOperation(): NodeOperation()
+KeyingScreenOperation::KeyingScreenOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_COLOR);
this->movieClip = NULL;
@@ -149,7 +149,7 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
BLI_voronoi_triangulate(sites, sites_total, &edges, width, height,
&triangulation->triangulated_points, &triangulation->triangulated_points_total,
- &triangulation->triangles, &triangulation->triangles_total);
+ &triangulation->triangles, &triangulation->triangles_total);
MEM_freeN(sites);
BLI_freelistN(&edges);
@@ -204,8 +204,8 @@ void KeyingScreenOperation::executePixel(float *color, int x, int y, MemoryBuffe
for (i = 0; i < triangulation->triangles_total; i++) {
int *triangle = triangulation->triangles[i];
VoronoiTriangulationPoint *a = &triangulation->triangulated_points[triangle[0]],
- *b = &triangulation->triangulated_points[triangle[1]],
- *c = &triangulation->triangulated_points[triangle[2]];
+ *b = &triangulation->triangulated_points[triangle[1]],
+ *c = &triangulation->triangulated_points[triangle[2]];
float co[2] = {(float) x, (float) y}, w[3];
if (barycentric_coords_v2(a->co, b->co, c->co, co, w)) {
diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
index f206bf4df8e..6e8aa9461e6 100644
--- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_LuminanceMatteOperation.h"
#include "BLI_math.h"
-LuminanceMatteOperation::LuminanceMatteOperation(): NodeOperation()
+LuminanceMatteOperation::LuminanceMatteOperation() : NodeOperation()
{
addInputSocket(COM_DT_COLOR);
addOutputSocket(COM_DT_VALUE);
@@ -44,26 +44,26 @@ void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y,
{
float inColor[4];
- const float high=this->settings->t1;
- const float low=this->settings->t2;
+ const float high = this->settings->t1;
+ const float low = this->settings->t2;
float alpha;
this->inputImageProgram->read(inColor, x, y, sampler, inputBuffers);
/* one line thread-friend algorithm:
- outputValue[0] = max(inputValue[3], min(high, max(low, ((inColor[0]-low)/(high-low))))
- */
+ * outputValue[0] = max(inputValue[3], min(high, max(low, ((inColor[0]-low)/(high-low))))
+ */
/* test range*/
if (inColor[0] > high) {
- alpha=1.f;
+ alpha = 1.f;
}
else if (inColor[0] < low) {
- alpha=0.f;
+ alpha = 0.f;
}
- else {/*blend */
- alpha=(inColor[0]-low)/(high-low);
+ else { /*blend */
+ alpha = (inColor[0] - low) / (high - low);
}
@@ -72,12 +72,12 @@ void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y,
*/
/* don't make something that was more transparent less transparent */
- if (alpha<inColor[3]) {
- outputValue[0]=alpha;
+ if (alpha < inColor[3]) {
+ outputValue[0] = alpha;
}
else {
- /* leave now it was before */
- outputValue[0]=inColor[3];
+ /* leave now it was before */
+ outputValue[0] = inColor[3];
}
}
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp
index 035f5584065..b29dcfab194 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_MapUVOperation.h"
#include "BLI_math.h"
-MapUVOperation::MapUVOperation(): NodeOperation()
+MapUVOperation::MapUVOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VECTOR);
@@ -44,7 +44,7 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s
{
float inputUV[4];
float uv_a[4], uv_b[4];
- float u,v;
+ float u, v;
float dx, dy;
float uv_l, uv_r;
@@ -52,48 +52,45 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s
this->inputUVProgram->read(inputUV, x, y, sampler, inputBuffers);
if (inputUV[2] == 0.f) {
- color[0] = 0.f;
- color[1] = 0.f;
- color[2] = 0.f;
- color[3] = 0.f;
- return;
+ zero_v4(color);
+ return;
}
/* adaptive sampling, red (U) channel */
- this->inputUVProgram->read(uv_a, x-1, y, COM_PS_NEAREST, inputBuffers);
- this->inputUVProgram->read(uv_b, x+1, y, COM_PS_NEAREST, inputBuffers);
- 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;
+ this->inputUVProgram->read(uv_a, x - 1, y, COM_PS_NEAREST, inputBuffers);
+ this->inputUVProgram->read(uv_b, x + 1, y, COM_PS_NEAREST, inputBuffers);
+ 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->inputUVProgram->read(uv_a, x, y-1, COM_PS_NEAREST, inputBuffers);
- this->inputUVProgram->read(uv_b, x, y+1, COM_PS_NEAREST, inputBuffers);
- 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;
+ this->inputUVProgram->read(uv_a, x, y - 1, COM_PS_NEAREST, inputBuffers);
+ this->inputUVProgram->read(uv_b, x, y + 1, COM_PS_NEAREST, inputBuffers);
+ 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->inputUVProgram->read(uv_a, x-1, y-1, COM_PS_NEAREST, inputBuffers);
- this->inputUVProgram->read(uv_b, x-1, y+1, COM_PS_NEAREST, inputBuffers);
- 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;
- uv_d = uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f;
-
- dx+= 0.25f * (uv_l + uv_r);
- dy+= 0.25f * (uv_u + uv_d);
-
- this->inputUVProgram->read(uv_a, x+1, y-1, COM_PS_NEAREST, inputBuffers);
- this->inputUVProgram->read(uv_b, x+1, y+1, COM_PS_NEAREST, inputBuffers);
- 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;
- uv_d = uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f;
-
- dx+= 0.25f * (uv_l + uv_r);
- dy+= 0.25f * (uv_u + uv_d);
+ this->inputUVProgram->read(uv_a, x - 1, y - 1, COM_PS_NEAREST, inputBuffers);
+ this->inputUVProgram->read(uv_b, x - 1, y + 1, COM_PS_NEAREST, inputBuffers);
+ 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;
+ uv_d = uv_b[2] != 0.f ? fabsf(inputUV[1] - uv_b[1]) : 0.f;
+
+ dx += 0.25f * (uv_l + uv_r);
+ dy += 0.25f * (uv_u + uv_d);
+
+ this->inputUVProgram->read(uv_a, x + 1, y - 1, COM_PS_NEAREST, inputBuffers);
+ this->inputUVProgram->read(uv_b, x + 1, y + 1, COM_PS_NEAREST, inputBuffers);
+ 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;
+ uv_d = uv_b[2] != 0.f ? fabsf(inputUV[1] - uv_b[1]) : 0.f;
+
+ dx += 0.25f * (uv_l + uv_r);
+ dy += 0.25f * (uv_u + uv_d);
/* UV to alpha threshold */
const float threshold = this->alpha * 0.05f;
@@ -114,10 +111,7 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s
/* "premul" */
if (alpha < 1.0f) {
- color[0]*= alpha;
- color[1]*= alpha;
- color[2]*= alpha;
- color[3]*= alpha;
+ mul_v4_fl(color, alpha);
}
}
@@ -131,7 +125,7 @@ bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOpe
{
rcti colorInput;
rcti uvInput;
- NodeOperation *operation=NULL;
+ NodeOperation *operation = NULL;
/* the uv buffer only needs a 3x3 buffer. The image needs whole buffer */
diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp
index bf6d29c0456..6d7804dd6e3 100644
--- a/source/blender/compositor/operations/COM_MapValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_MapValueOperation.h"
-MapValueOperation::MapValueOperation(): NodeOperation()
+MapValueOperation::MapValueOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -39,12 +39,12 @@ void MapValueOperation::executePixel(float *outputValue, float x, float y, Pixel
float src[4];
inputOperation->read(src, x, y, sampler, inputBuffers);
TexMapping *texmap = this->settings;
- float value = (src[0] + texmap->loc[0])*texmap->size[0];
+ float value = (src[0] + texmap->loc[0]) * texmap->size[0];
if (texmap->flag & TEXMAP_CLIP_MIN)
- if (value<texmap->min[0])
+ if (value < texmap->min[0])
value = texmap->min[0];
if (texmap->flag & TEXMAP_CLIP_MAX)
- if (value>texmap->max[0])
+ if (value > texmap->max[0])
value = texmap->max[0];
outputValue[0] = value;
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp
index 8f7115659a1..0493bdee12c 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_MaskOperation.cpp
@@ -32,10 +32,10 @@
extern "C" {
#include "BKE_mask.h"
- #include "../../../../intern/raskter/raskter.h"
+ #include "../../../../intern/raskter/raskter.h"
}
-MaskOperation::MaskOperation(): NodeOperation()
+MaskOperation::MaskOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_VALUE);
this->mask = NULL;
@@ -76,9 +76,9 @@ void *MaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers
buffer = (float *)MEM_callocN(sizeof(float) * width * height, "rasterized mask");
BKE_mask_rasterize(mask, width, height, buffer, TRUE, this->smooth);
- if(this->smooth) {
- PLX_antialias_buffer(buffer, width, height);
- }
+ if (this->smooth) {
+ PLX_antialias_buffer(buffer, width, height);
+ }
this->rasterizedMask = buffer;
}
@@ -110,7 +110,7 @@ void MaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *input
color[0] = 0.0f;
}
else {
- float *buffer = (float*) data;
+ float *buffer = (float *) data;
int index = (y * this->getWidth() + x);
color[0] = buffer[index];
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index b943ec88fde..5e9fb70b206 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -25,7 +25,7 @@ extern "C" {
#include "BLI_math.h"
}
-MathBaseOperation::MathBaseOperation(): NodeOperation()
+MathBaseOperation::MathBaseOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_VALUE);
@@ -50,14 +50,15 @@ void MathBaseOperation::deinitExecution()
void MathBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
InputSocket *socket;
- unsigned int tempPreferredResolution[] = {0,0};
+ unsigned int tempPreferredResolution[] = {0, 0};
unsigned int tempResolution[2];
socket = this->getInputSocket(0);
socket->determineResolution(tempResolution, tempPreferredResolution);
if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
this->setResolutionInputSocketIndex(0);
- } else {
+ }
+ else {
this->setResolutionInputSocketIndex(1);
}
NodeOperation::determineResolution(resolution, preferredResolution);
@@ -104,7 +105,7 @@ void MathDivideOperation::executePixel(float *outputValue, float x, float y, Pix
inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
- if (inputValue2[0]==0) /* We don't want to divide by zero. */
+ if (inputValue2[0] == 0) /* We don't want to divide by zero. */
outputValue[0] = 0.0;
else
outputValue[0] = inputValue1[0] / inputValue2[0];
@@ -151,7 +152,7 @@ void MathArcSineOperation::executePixel(float *outputValue, float x, float y, Pi
inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
- if (inputValue1[0] <= 1 && inputValue1[0] >= -1 )
+ if (inputValue1[0] <= 1 && inputValue1[0] >= -1)
outputValue[0] = asin(inputValue1[0]);
else
outputValue[0] = 0.0;
@@ -165,7 +166,7 @@ void MathArcCosineOperation::executePixel(float *outputValue, float x, float y,
inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
- if (inputValue1[0] <= 1 && inputValue1[0] >= -1 )
+ if (inputValue1[0] <= 1 && inputValue1[0] >= -1)
outputValue[0] = acos(inputValue1[0]);
else
outputValue[0] = 0.0;
@@ -260,7 +261,7 @@ void MathLessThanOperation::executePixel(float *outputValue, float x, float y, P
inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
- outputValue[0] = inputValue1[0]<inputValue2[0]?1.0f:0.0f;
+ outputValue[0] = inputValue1[0] < inputValue2[0] ? 1.0f : 0.0f;
}
void MathGreaterThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -271,7 +272,7 @@ void MathGreaterThanOperation::executePixel(float *outputValue, float x, float y
inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers);
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
- outputValue[0] = inputValue1[0]>inputValue2[0]?1.0f:0.0f;
+ outputValue[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f;
}
diff --git a/source/blender/compositor/operations/COM_MixAddOperation.cpp b/source/blender/compositor/operations/COM_MixAddOperation.cpp
index a4f601ae9e6..bd9538a5600 100644
--- a/source/blender/compositor/operations/COM_MixAddOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixAddOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixAddOperation.h"
-MixAddOperation::MixAddOperation(): MixBaseOperation()
+MixAddOperation::MixAddOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -41,9 +42,9 @@ void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSa
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
}
- outputValue[0] = inputColor1[0]+value*inputColor2[0];
- outputValue[1] = inputColor1[1]+value*inputColor2[1];
- outputValue[2] = inputColor1[2]+value*inputColor2[2];
+ outputValue[0] = inputColor1[0] + value * inputColor2[0];
+ outputValue[1] = inputColor1[1] + value * inputColor2[1];
+ outputValue[2] = inputColor1[2] + value * inputColor2[2];
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.cpp b/source/blender/compositor/operations/COM_MixBaseOperation.cpp
index 49ae67a06f7..0efab2942b0 100644
--- a/source/blender/compositor/operations/COM_MixBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixBaseOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_MixBaseOperation.h"
-MixBaseOperation::MixBaseOperation(): NodeOperation()
+MixBaseOperation::MixBaseOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_COLOR);
@@ -55,9 +55,9 @@ void MixBaseOperation::executePixel(float *outputColor, float x, float y, PixelS
value *= inputColor2[3];
}
float valuem = 1.0f - value;
- outputColor[0] = valuem*(inputColor1[0])+value*(inputColor2[0]);
- outputColor[1] = valuem*(inputColor1[1])+value*(inputColor2[1]);
- outputColor[2] = valuem*(inputColor1[2])+value*(inputColor2[2]);
+ outputColor[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
+ outputColor[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
+ outputColor[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
outputColor[3] = inputColor1[3];
}
@@ -71,7 +71,7 @@ void MixBaseOperation::deinitExecution()
void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
InputSocket *socket;
- unsigned int tempPreferredResolution[] = {0,0};
+ unsigned int tempPreferredResolution[] = {0, 0};
unsigned int tempResolution[2];
socket = this->getInputSocket(1);
diff --git a/source/blender/compositor/operations/COM_MixBlendOperation.cpp b/source/blender/compositor/operations/COM_MixBlendOperation.cpp
index 579f15bcc27..f010d23ce60 100644
--- a/source/blender/compositor/operations/COM_MixBlendOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixBlendOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixBlendOperation.h"
-MixBlendOperation::MixBlendOperation(): MixBaseOperation()
+MixBlendOperation::MixBlendOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixBlendOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -42,8 +43,8 @@ void MixBlendOperation::executePixel(float *outputValue, float x, float y, Pixel
value *= inputColor2[3];
}
float valuem = 1.0f - value;
- outputValue[0] = valuem*(inputColor1[0])+value*(inputColor2[0]);
- outputValue[1] = valuem*(inputColor1[1])+value*(inputColor2[1]);
- outputValue[2] = valuem*(inputColor1[2])+value*(inputColor2[2]);
+ outputValue[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
+ outputValue[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
+ outputValue[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixBurnOperation.cpp b/source/blender/compositor/operations/COM_MixBurnOperation.cpp
index 7cad107c5e9..e94834148e8 100644
--- a/source/blender/compositor/operations/COM_MixBurnOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixBurnOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixBurnOperation.h"
-MixBurnOperation::MixBurnOperation(): MixBaseOperation()
+MixBurnOperation::MixBurnOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -42,7 +43,7 @@ void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelS
}
float valuem = 1.0f - value;
- tmp = valuem + value*inputColor2[0];
+ tmp = valuem + value * inputColor2[0];
if (tmp <= 0.0f)
outputValue[0] = 0.0f;
else {
@@ -55,7 +56,7 @@ void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelS
outputValue[0] = tmp;
}
- tmp = valuem + value*inputColor2[1];
+ tmp = valuem + value * inputColor2[1];
if (tmp <= 0.0f)
outputValue[1] = 0.0f;
else {
@@ -68,7 +69,7 @@ void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelS
outputValue[1] = tmp;
}
- tmp = valuem + value*inputColor2[2];
+ tmp = valuem + value * inputColor2[2];
if (tmp <= 0.0f)
outputValue[2] = 0.0f;
else {
diff --git a/source/blender/compositor/operations/COM_MixColorOperation.cpp b/source/blender/compositor/operations/COM_MixColorOperation.cpp
index e14b10b305e..f3e893bc18f 100644
--- a/source/blender/compositor/operations/COM_MixColorOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixColorOperation.cpp
@@ -26,8 +26,9 @@ extern "C" {
#include "BLI_math.h"
}
-MixColorOperation::MixColorOperation(): MixBaseOperation()
+MixColorOperation::MixColorOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -45,16 +46,16 @@ void MixColorOperation::executePixel(float *outputValue, float x, float y, Pixel
}
float valuem = 1.0f - value;
- float colH,colS,colV;
+ float colH, colS, colV;
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
- if (colS!=0.0f) {
- float rH,rS,rV;
- float tmpr,tmpg,tmpb;
+ if (colS != 0.0f) {
+ float rH, rS, rV;
+ float tmpr, tmpg, tmpb;
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
- hsv_to_rgb(colH , colS, rV, &tmpr, &tmpg, &tmpb);
- outputValue[0] = valuem*(inputColor1[0]) + value*tmpr;
- outputValue[1] = valuem*(inputColor1[1]) + value*tmpg;
- outputValue[2] = valuem*(inputColor1[2]) + value*tmpb;
+ hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb);
+ outputValue[0] = valuem * (inputColor1[0]) + value * tmpr;
+ outputValue[1] = valuem * (inputColor1[1]) + value * tmpg;
+ outputValue[2] = valuem * (inputColor1[2]) + value * tmpb;
}
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp
index 666db9d8f32..a36c663ddda 100644
--- a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixDarkenOperation.h"
-MixDarkenOperation::MixDarkenOperation(): MixBaseOperation()
+MixDarkenOperation::MixDarkenOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixDarkenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -41,13 +42,13 @@ void MixDarkenOperation::executePixel(float *outputValue, float x, float y, Pixe
}
float valuem = 1.0f - value;
float tmp;
- tmp=inputColor2[0]+((1.0f-inputColor2[0])*valuem);
+ tmp = inputColor2[0] + ((1.0f - inputColor2[0]) * valuem);
if (tmp < inputColor1[0]) outputValue[0] = tmp;
else outputValue[0] = inputColor1[0];
- tmp=inputColor2[1]+((1.0f-inputColor2[1])*valuem);
+ tmp = inputColor2[1] + ((1.0f - inputColor2[1]) * valuem);
if (tmp < inputColor1[1]) outputValue[1] = tmp;
else outputValue[1] = inputColor1[1];
- tmp=inputColor2[2]+((1.0f-inputColor2[2])*valuem);
+ tmp = inputColor2[2] + ((1.0f - inputColor2[2]) * valuem);
if (tmp < inputColor1[2]) outputValue[2] = tmp;
else outputValue[2] = inputColor1[2];
diff --git a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp
index 497bb9c2bb5..69886753480 100644
--- a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp
@@ -23,8 +23,9 @@
#include "COM_MixDifferenceOperation.h"
#include "BLI_math.h"
-MixDifferenceOperation::MixDifferenceOperation(): MixBaseOperation()
+MixDifferenceOperation::MixDifferenceOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixDifferenceOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -41,9 +42,9 @@ void MixDifferenceOperation::executePixel(float *outputValue, float x, float y,
value *= inputColor2[3];
}
float valuem = 1.0f - value;
- outputValue[0] = valuem*inputColor1[0] + value*fabsf(inputColor1[0]-inputColor2[0]);
- outputValue[1] = valuem*inputColor1[1] + value*fabsf(inputColor1[1]-inputColor2[1]);
- outputValue[2] = valuem*inputColor1[2] + value*fabsf(inputColor1[2]-inputColor2[2]);
+ outputValue[0] = valuem * inputColor1[0] + value *fabsf(inputColor1[0] - inputColor2[0]);
+ 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];
}
diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.cpp b/source/blender/compositor/operations/COM_MixDivideOperation.cpp
index c522fcf225a..8b6586c5336 100644
--- a/source/blender/compositor/operations/COM_MixDivideOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixDivideOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixDivideOperation.h"
-MixDivideOperation::MixDivideOperation(): MixBaseOperation()
+MixDivideOperation::MixDivideOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -42,15 +43,15 @@ void MixDivideOperation::executePixel(float *outputValue, float x, float y, Pixe
float valuem = 1.0f - value;
if (inputColor2[0] != 0.0f)
- outputValue[0] = valuem*(inputColor1[0]) + value*(inputColor1[0])/inputColor2[0];
+ outputValue[0] = valuem * (inputColor1[0]) + value * (inputColor1[0]) / inputColor2[0];
else
outputValue[0] = 0.0f;
if (inputColor2[1] != 0.0f)
- outputValue[1] = valuem*(inputColor1[1]) + value*(inputColor1[1])/inputColor2[1];
+ outputValue[1] = valuem * (inputColor1[1]) + value * (inputColor1[1]) / inputColor2[1];
else
outputValue[1] = 0.0f;
if (inputColor2[2] != 0.0f)
- outputValue[2] = valuem*(inputColor1[2]) + value*(inputColor1[2])/inputColor2[2];
+ outputValue[2] = valuem * (inputColor1[2]) + value * (inputColor1[2]) / inputColor2[2];
else
outputValue[2] = 0.0f;
diff --git a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp
index 10c04ba376b..971ddd5b736 100644
--- a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixDodgeOperation.h"
-MixDodgeOperation::MixDodgeOperation(): MixBaseOperation()
+MixDodgeOperation::MixDodgeOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixDodgeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -42,7 +43,7 @@ void MixDodgeOperation::executePixel(float *outputValue, float x, float y, Pixel
}
if (inputColor1[0] != 0.0f) {
- tmp = 1.0f - value*inputColor2[0];
+ tmp = 1.0f - value * inputColor2[0];
if (tmp <= 0.0f)
outputValue[0] = 1.0f;
else {
@@ -57,7 +58,7 @@ void MixDodgeOperation::executePixel(float *outputValue, float x, float y, Pixel
outputValue[0] = 0.0f;
if (inputColor1[1] != 0.0f) {
- tmp = 1.0f - value*inputColor2[1];
+ tmp = 1.0f - value * inputColor2[1];
if (tmp <= 0.0f)
outputValue[1] = 1.0f;
else {
@@ -72,7 +73,7 @@ void MixDodgeOperation::executePixel(float *outputValue, float x, float y, Pixel
outputValue[1] = 0.0f;
if (inputColor1[2] != 0.0f) {
- tmp = 1.0f - value*inputColor2[2];
+ tmp = 1.0f - value * inputColor2[2];
if (tmp <= 0.0f)
outputValue[2] = 1.0f;
else {
diff --git a/source/blender/compositor/operations/COM_MixGlareOperation.cpp b/source/blender/compositor/operations/COM_MixGlareOperation.cpp
index 229fc1e5313..bfb0efe692f 100644
--- a/source/blender/compositor/operations/COM_MixGlareOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixGlareOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixGlareOperation.h"
-MixGlareOperation::MixGlareOperation(): MixBaseOperation()
+MixGlareOperation::MixGlareOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixGlareOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -37,10 +38,10 @@ void MixGlareOperation::executePixel(float *outputValue, float x, float y, Pixel
inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
inputColor2Operation->read(inputColor2, x, y, sampler, inputBuffers);
value = inputValue[0];
- float mf = 2.f - 2.f*fabsf(value - 0.5f);
+ float mf = 2.f - 2.f * fabsf(value - 0.5f);
- outputValue[0] = mf*((inputColor1[0])+value*(inputColor2[0]-inputColor1[0]));
- outputValue[1] = mf*((inputColor1[1])+value*(inputColor2[1]-inputColor1[1]));
- outputValue[2] = mf*((inputColor1[2])+value*(inputColor2[2]-inputColor1[2]));
+ outputValue[0] = mf * ((inputColor1[0]) + value * (inputColor2[0] - inputColor1[0]));
+ outputValue[1] = mf * ((inputColor1[1]) + value * (inputColor2[1] - inputColor1[1]));
+ outputValue[2] = mf * ((inputColor1[2]) + value * (inputColor2[2] - inputColor1[2]));
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixHueOperation.cpp b/source/blender/compositor/operations/COM_MixHueOperation.cpp
index de376f3500c..05d02805ebc 100644
--- a/source/blender/compositor/operations/COM_MixHueOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixHueOperation.cpp
@@ -26,8 +26,9 @@ extern "C" {
#include "BLI_math.h"
}
-MixHueOperation::MixHueOperation(): MixBaseOperation()
+MixHueOperation::MixHueOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -45,16 +46,16 @@ void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSa
}
float valuem = 1.0f - value;
- float colH,colS,colV;
+ float colH, colS, colV;
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
- if (colS!=0.0f) {
- float rH,rS,rV;
- float tmpr,tmpg,tmpb;
+ if (colS != 0.0f) {
+ float rH, rS, rV;
+ float tmpr, tmpg, tmpb;
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
- hsv_to_rgb(colH , rS, rV, &tmpr, &tmpg, &tmpb);
- outputValue[0] = valuem*(inputColor1[0]) + value*tmpr;
- outputValue[1] = valuem*(inputColor1[1]) + value*tmpg;
- outputValue[2] = valuem*(inputColor1[2]) + value*tmpb;
+ hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb);
+ outputValue[0] = valuem * (inputColor1[0]) + value * tmpr;
+ outputValue[1] = valuem * (inputColor1[1]) + value * tmpg;
+ outputValue[2] = valuem * (inputColor1[2]) + value * tmpb;
}
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.cpp b/source/blender/compositor/operations/COM_MixLightenOperation.cpp
index bc3e5090bd8..6e1af7a3c44 100644
--- a/source/blender/compositor/operations/COM_MixLightenOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixLightenOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixLightenOperation.h"
-MixLightenOperation::MixLightenOperation(): MixBaseOperation()
+MixLightenOperation::MixLightenOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixLightenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -40,13 +41,13 @@ void MixLightenOperation::executePixel(float *outputValue, float x, float y, Pix
value *= inputColor2[3];
}
float tmp;
- tmp=value * inputColor2[0];
+ tmp = value * inputColor2[0];
if (tmp > inputColor1[0]) outputValue[0] = tmp;
else outputValue[0] = inputColor1[0];
- tmp=value * inputColor2[1];
+ tmp = value * inputColor2[1];
if (tmp > inputColor1[1]) outputValue[1] = tmp;
else outputValue[1] = inputColor1[1];
- tmp=value * inputColor2[2];
+ tmp = value * inputColor2[2];
if (tmp > inputColor1[2]) outputValue[2] = tmp;
else outputValue[2] = inputColor1[2];
outputValue[3] = inputColor1[3];
diff --git a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp
index b68064f0e47..bf1c181b566 100644
--- a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixLinearLightOperation.h"
-MixLinearLightOperation::MixLinearLightOperation(): MixBaseOperation()
+MixLinearLightOperation::MixLinearLightOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixLinearLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -40,17 +41,17 @@ void MixLinearLightOperation::executePixel(float *outputValue, float x, float y,
value *= inputColor2[3];
}
if (inputColor2[0] > 0.5f)
- outputValue[0] = inputColor1[0] + value*(2.0f*(inputColor2[0]-0.5f));
+ outputValue[0] = inputColor1[0] + value * (2.0f * (inputColor2[0] - 0.5f));
else
- outputValue[0] = inputColor1[0] + value*(2.0f*(inputColor2[0]) - 1.0f);
+ outputValue[0] = inputColor1[0] + value * (2.0f * (inputColor2[0]) - 1.0f);
if (inputColor2[1] > 0.5f)
- outputValue[1] = inputColor1[1] + value*(2.0f*(inputColor2[1]-0.5f));
+ outputValue[1] = inputColor1[1] + value * (2.0f * (inputColor2[1] - 0.5f));
else
- outputValue[1] = inputColor1[1] + value*(2.0f*(inputColor2[1]) - 1.0f);
+ outputValue[1] = inputColor1[1] + value * (2.0f * (inputColor2[1]) - 1.0f);
if (inputColor2[2] > 0.5f)
- outputValue[2] = inputColor1[2] + value*(2.0f*(inputColor2[2]-0.5f));
+ outputValue[2] = inputColor1[2] + value * (2.0f * (inputColor2[2] - 0.5f));
else
- outputValue[2] = inputColor1[2] + value*(2.0f*(inputColor2[2]) - 1.0f);
+ outputValue[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f);
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp b/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp
index fdf8c1ca51b..62018ed5698 100644
--- a/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixMultiplyOperation.h"
-MixMultiplyOperation::MixMultiplyOperation(): MixBaseOperation()
+MixMultiplyOperation::MixMultiplyOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -41,9 +42,9 @@ void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, Pi
value *= inputColor2[3];
}
float valuem = 1.0f - value;
- outputValue[0] = inputColor1[0] *(valuem+value*inputColor2[0]);
- outputValue[1] = inputColor1[1] *(valuem+value*inputColor2[1]);
- outputValue[2] = inputColor1[2] *(valuem+value*inputColor2[2]);
+ outputValue[0] = inputColor1[0] * (valuem + value * inputColor2[0]);
+ outputValue[1] = inputColor1[1] * (valuem + value * inputColor2[1]);
+ outputValue[2] = inputColor1[2] * (valuem + value * inputColor2[2]);
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp
index 0025daeb3f5..a269045c598 100644
--- a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixOverlayOperation.h"
-MixOverlayOperation::MixOverlayOperation(): MixBaseOperation()
+MixOverlayOperation::MixOverlayOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixOverlayOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -43,22 +44,22 @@ void MixOverlayOperation::executePixel(float *outputValue, float x, float y, Pix
float valuem = 1.0f - value;
if (inputColor1[0] < 0.5f) {
- outputValue[0] = inputColor1[0] * (valuem + 2.0f*value*inputColor2[0]);
+ outputValue[0] = inputColor1[0] * (valuem + 2.0f * value * inputColor2[0]);
}
else {
- outputValue[0] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
+ outputValue[0] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
}
if (inputColor1[1] < 0.5f) {
- outputValue[1] = inputColor1[1] * (valuem + 2.0f*value*inputColor2[1]);
+ outputValue[1] = inputColor1[1] * (valuem + 2.0f * value * inputColor2[1]);
}
else {
- outputValue[1] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
+ outputValue[1] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
}
if (inputColor1[2] < 0.5f) {
- outputValue[2] = inputColor1[2] * (valuem + 2.0f*value*inputColor2[2]);
+ outputValue[2] = inputColor1[2] * (valuem + 2.0f * value * inputColor2[2]);
}
else {
- outputValue[2] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
+ outputValue[2] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
}
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp
index f6f6ec73c6e..863a17a7f80 100644
--- a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp
@@ -26,8 +26,9 @@ extern "C" {
#include "BLI_math.h"
}
-MixSaturationOperation::MixSaturationOperation(): MixBaseOperation()
+MixSaturationOperation::MixSaturationOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixSaturationOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -45,12 +46,12 @@ void MixSaturationOperation::executePixel(float *outputValue, float x, float y,
}
float valuem = 1.0f - value;
- float rH,rS,rV;
+ float rH, rS, rV;
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
- if (rS!=0.0f) {
- float colH,colS,colV;
+ if (rS != 0.0f) {
+ float colH, colS, colV;
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
- hsv_to_rgb(rH , (valuem*rS+value*colS), rV, &outputValue[0], &outputValue[1], &outputValue[2]);
+ hsv_to_rgb(rH, (valuem * rS + value * colS), rV, &outputValue[0], &outputValue[1], &outputValue[2]);
}
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixScreenOperation.cpp b/source/blender/compositor/operations/COM_MixScreenOperation.cpp
index a1a98bd82a2..6fb7befeba4 100644
--- a/source/blender/compositor/operations/COM_MixScreenOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixScreenOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixScreenOperation.h"
-MixScreenOperation::MixScreenOperation(): MixBaseOperation()
+MixScreenOperation::MixScreenOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixScreenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -42,9 +43,9 @@ void MixScreenOperation::executePixel(float *outputValue, float x, float y, Pixe
}
float valuem = 1.0f - value;
- outputValue[0] = 1.0f - (valuem + value*(1.0f-inputColor2[0])) *(1.0f-inputColor1[0]);
- 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[0] = 1.0f - (valuem + value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
+ 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];
}
diff --git a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp
index ea6a3ddd498..9f7d0823473 100644
--- a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp
@@ -22,12 +22,13 @@
#include "COM_MixSoftLightOperation.h"
-MixSoftLightOperation::MixSoftLightOperation(): MixBaseOperation()
+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, MemoryBuffer *inputBuffers[]) \
+ {
float inputColor1[4];
float inputColor2[4];
float value;
@@ -47,9 +48,9 @@ void MixSoftLightOperation::executePixel(float *outputValue, float x, float y, P
scg = 1.0f - (1.0f - inputColor2[1]) * (1.0f - inputColor1[1]);
scb = 1.0f - (1.0f - inputColor2[2]) * (1.0f - inputColor1[2]);
- outputValue[0] = valuem*(inputColor1[0]) + value*(((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) + (inputColor1[0] * scr));
- 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[0] = valuem * (inputColor1[0]) + value * (((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) + (inputColor1[0] * scr));
+ 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];
-}
+ }
diff --git a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp
index 57320dcd611..80086053872 100644
--- a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp
@@ -22,8 +22,9 @@
#include "COM_MixSubtractOperation.h"
-MixSubtractOperation::MixSubtractOperation(): MixBaseOperation()
+MixSubtractOperation::MixSubtractOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -39,9 +40,9 @@ void MixSubtractOperation::executePixel(float *outputValue, float x, float y, Pi
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
}
- outputValue[0] = inputColor1[0]-value*(inputColor2[0]);
- outputValue[1] = inputColor1[1]-value*(inputColor2[1]);
- outputValue[2] = inputColor1[2]-value*(inputColor2[2]);
+ outputValue[0] = inputColor1[0] - value * (inputColor2[0]);
+ outputValue[1] = inputColor1[1] - value * (inputColor2[1]);
+ outputValue[2] = inputColor1[2] - value * (inputColor2[2]);
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MixValueOperation.cpp b/source/blender/compositor/operations/COM_MixValueOperation.cpp
index 8c43bb6af8c..cd79c54318d 100644
--- a/source/blender/compositor/operations/COM_MixValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixValueOperation.cpp
@@ -26,8 +26,9 @@ extern "C" {
#include "BLI_math.h"
}
-MixValueOperation::MixValueOperation(): MixBaseOperation()
+MixValueOperation::MixValueOperation() : MixBaseOperation()
{
+ /* pass */
}
void MixValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -45,10 +46,10 @@ void MixValueOperation::executePixel(float *outputValue, float x, float y, Pixel
}
float valuem = 1.0f - value;
- float rH,rS,rV;
- float colH,colS,colV;
+ float rH, rS, rV;
+ float colH, colS, colV;
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
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]);
+ hsv_to_rgb(rH, rS, (valuem * rV + value * colV), &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
index d9f9801e2e1..662212567de 100644
--- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
@@ -25,7 +25,7 @@ extern "C" {
#include "BKE_tracking.h"
#include "BKE_movieclip.h"
}
-MovieClipAttributeOperation::MovieClipAttributeOperation(): NodeOperation()
+MovieClipAttributeOperation::MovieClipAttributeOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_VALUE);
this->valueSet = false;
@@ -46,18 +46,18 @@ void MovieClipAttributeOperation::executePixel(float *outputValue, float x, floa
BKE_tracking_stabilization_data_get(&clip->tracking, clip_framenr, getWidth(), getHeight(), loc, &scale, &angle);
}
switch (this->attribute) {
- case MCA_SCALE:
- this->value = scale;
- break;
- case MCA_ANGLE:
- this->value = angle;
- break;
- case MCA_X:
- this->value = loc[0];
- break;
- case MCA_Y:
- this->value = loc[1];
- break;
+ case MCA_SCALE:
+ this->value = scale;
+ break;
+ case MCA_ANGLE:
+ this->value = angle;
+ break;
+ case MCA_X:
+ this->value = loc[0];
+ break;
+ case MCA_Y:
+ this->value = loc[1];
+ break;
}
valueSet = true;
}
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
index 6019ab879be..b8bda12c626 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
@@ -31,7 +31,7 @@ extern "C" {
}
#include "BKE_image.h"
-MovieClipOperation::MovieClipOperation(): NodeOperation()
+MovieClipOperation::MovieClipOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_COLOR);
this->movieClip = NULL;
@@ -51,9 +51,9 @@ void MovieClipOperation::initExecution()
ibuf = BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser);
if (ibuf) {
this->movieClipBuffer = ibuf;
- if (ibuf->rect_float == NULL || ibuf->userflags&IB_RECT_INVALID) {
+ if (ibuf->rect_float == NULL || ibuf->userflags & IB_RECT_INVALID) {
IMB_float_from_rect(ibuf);
- ibuf->userflags&= ~IB_RECT_INVALID;
+ ibuf->userflags &= ~IB_RECT_INVALID;
}
}
}
@@ -93,15 +93,15 @@ void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampl
}
else {
switch (sampler) {
- case COM_PS_NEAREST:
- neareast_interpolation_color(this->movieClipBuffer, NULL, color, x, y);
- break;
- case COM_PS_BILINEAR:
- bilinear_interpolation_color(this->movieClipBuffer, NULL, color, x, y);
- break;
- case COM_PS_BICUBIC:
- bicubic_interpolation_color(this->movieClipBuffer, NULL, color, x, y);
- break;
+ case COM_PS_NEAREST:
+ neareast_interpolation_color(this->movieClipBuffer, NULL, color, x, y);
+ break;
+ case COM_PS_BILINEAR:
+ bilinear_interpolation_color(this->movieClipBuffer, NULL, color, x, y);
+ break;
+ case COM_PS_BICUBIC:
+ bicubic_interpolation_color(this->movieClipBuffer, NULL, color, x, y);
+ break;
}
}
}
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
index d9e8977871f..5320f901747 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
@@ -29,7 +29,7 @@ extern "C" {
}
-vector<DistortionCache*> s_cache;
+vector<DistortionCache *> s_cache;
MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperation()
@@ -52,8 +52,8 @@ void MovieDistortionOperation::initExecution()
BKE_movieclip_user_set_frame(&clipUser, this->framenumber);
BKE_movieclip_get_size(this->movieClip, &clipUser, &calibration_width, &calibration_height);
- for (unsigned int i = 0 ; i < s_cache.size() ; i ++) {
- DistortionCache *c = (DistortionCache*)s_cache[i];
+ for (unsigned int i = 0; i < s_cache.size(); i++) {
+ DistortionCache *c = (DistortionCache *)s_cache[i];
if (c->isCacheFor(this->movieClip, this->width, this->height,
calibration_width, calibration_height, this->distortion))
{
@@ -78,7 +78,7 @@ 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, MemoryBuffer *inputBuffers[])
{
if (this->cache != NULL) {
diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
index 5e81cd639dd..1bd21f6e712 100644
--- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
@@ -27,7 +27,7 @@ extern "C" {
#include "IMB_imbuf_types.h"
}
-MultilayerBaseOperation::MultilayerBaseOperation(int pass): BaseImageOperation()
+MultilayerBaseOperation::MultilayerBaseOperation(int pass) : BaseImageOperation()
{
this->passId = pass;
}
@@ -56,22 +56,22 @@ void MultilayerColorOperation::executePixel(float *color, float x, float y, Pixe
else {
if (this->numberOfChannels == 4) {
switch (sampler) {
- case COM_PS_NEAREST:
- neareast_interpolation_color(this->buffer, NULL, color, x, y);
- break;
- case COM_PS_BILINEAR:
- bilinear_interpolation_color(this->buffer, NULL, color, x, y);
- break;
- case COM_PS_BICUBIC:
- bicubic_interpolation_color(this->buffer, NULL, color, x, y);
- break;
+ case COM_PS_NEAREST:
+ neareast_interpolation_color(this->buffer, NULL, color, x, y);
+ break;
+ case COM_PS_BILINEAR:
+ bilinear_interpolation_color(this->buffer, NULL, color, x, y);
+ break;
+ case COM_PS_BICUBIC:
+ bicubic_interpolation_color(this->buffer, NULL, color, x, y);
+ break;
}
}
else {
- int offset = (yi*this->getWidth()+xi)*3;
+ int offset = (yi * this->getWidth() + xi) * 3;
color[0] = this->imageBuffer[offset];
- color[1] = this->imageBuffer[offset+1];
- color[2] = this->imageBuffer[offset+2];
+ color[1] = this->imageBuffer[offset + 1];
+ color[2] = this->imageBuffer[offset + 2];
}
}
}
@@ -84,7 +84,7 @@ void MultilayerValueOperation::executePixel(float *color, float x, float y, Pixe
color[0] = 0.0f;
}
else {
- float result = this->imageBuffer[yi*this->getWidth()+xi];
+ float result = this->imageBuffer[yi * this->getWidth() + xi];
color[0] = result;
}
}
@@ -97,9 +97,9 @@ void MultilayerVectorOperation::executePixel(float *color, float x, float y, Pix
color[0] = 0.0f;
}
else {
- int offset = (yi*this->getWidth()+xi)*3;
+ int offset = (yi * this->getWidth() + xi) * 3;
color[0] = this->imageBuffer[offset];
- color[1] = this->imageBuffer[offset+1];
- color[2] = this->imageBuffer[offset+2];
+ color[1] = this->imageBuffer[offset + 1];
+ color[2] = this->imageBuffer[offset + 2];
}
}
diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
index 4dd94943f4e..6d12141a455 100644
--- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp
+++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
@@ -21,7 +21,7 @@
#include "COM_NormalizeOperation.h"
-NormalizeOperation::NormalizeOperation(): NodeOperation()
+NormalizeOperation::NormalizeOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -35,7 +35,7 @@ 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, MemoryBuffer *inputBuffers[], void *data)
{
/* using generic two floats struct to store x: min y: mult */
NodeTwoFloats *minmult = (NodeTwoFloats *)data;
@@ -78,7 +78,7 @@ void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
{
lockMutex();
if (this->cachedInstance == NULL) {
- MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)imageReader->initializeTileData(rect, memoryBuffers);
/* using generic two floats struct to store x: min y: mult */
NodeTwoFloats *minmult = new NodeTwoFloats();
@@ -86,20 +86,20 @@ void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
int p = tile->getWidth() * tile->getHeight();
float *bc = buffer;
- float minv = 1.0f+BLENDER_ZMAX;
- float maxv = -1.0f-BLENDER_ZMAX;
+ float minv = 1.0f + BLENDER_ZMAX;
+ float maxv = -1.0f - BLENDER_ZMAX;
float value;
while (p--) {
- value=bc[0];
+ value = bc[0];
maxv = max(value, maxv);
minv = min(value, minv);
- bc+=4;
+ bc += 4;
}
minmult->x = minv;
/* The rare case of flat buffer would cause a divide by 0 */
- minmult->y = ((maxv!=minv)? 1.0f/(maxv-minv):0.f);
+ minmult->y = ((maxv != minv) ? 1.0f / (maxv - minv) : 0.f);
this->cachedInstance = minmult;
}
@@ -110,4 +110,5 @@ void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
void NormalizeOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
{
+ /* pass */
}
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl
index e1f175b318a..0f8e543de7f 100644
--- a/source/blender/compositor/operations/COM_OpenCLKernels.cl
+++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl
@@ -68,9 +68,9 @@ __kernel void dilateKernel(__read_only image2d_t inputImage, __write_only image
int2 inputXy;
for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny ++, inputXy.y++) {
+ const float deltaY = (realCoordinate.y - ny);
for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx ++, inputXy.x++) {
const float deltaX = (realCoordinate.x - nx);
- const float deltaY = (realCoordinate.y - ny);
const float measuredDistance = deltaX*deltaX+deltaY*deltaY;
if (measuredDistance <= distanceSquared) {
value = max(value, read_imagef(inputImage, SAMPLER_NEAREST, inputXy).s0);
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h
index ef8668f6f21..e064b7511cb 100644
--- a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h
+++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h
@@ -16,7 +16,7 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope
" coords += offset;\n" \
" float tempBoundingBox;\n" \
" float4 color = {0.0f,0.0f,0.0f,0.0f};\n" \
-" float4 multiplyer = {0.0f,0.0f,0.0f,0.0f};\n" \
+" float4 multiplier = {0.0f,0.0f,0.0f,0.0f};\n" \
" float4 bokeh;\n" \
" const float radius2 = radius*2.0f;\n" \
" const int2 realCoordinate = coords + offsetOutput;\n" \
@@ -40,10 +40,10 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope
" uv.x = ((realCoordinate.x-nx)/radius2)*bokehImageDim.x+bokehImageCenter.x;\n" \
" bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);\n" \
" color += bokeh * read_imagef(inputImage, SAMPLER_NEAREST, inputXy);\n" \
-" multiplyer += bokeh;\n" \
+" multiplier += bokeh;\n" \
" }\n" \
" }\n" \
-" color /= multiplyer;\n" \
+" color /= multiplier;\n" \
"\n" \
" } else {\n" \
" int2 imageCoordinates = realCoordinate - offsetInput;\n" \
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index 1438116f313..e71178a811d 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -41,10 +41,10 @@ extern "C" {
static int get_datatype_size(DataType datatype)
{
switch (datatype) {
- case COM_DT_VALUE: return 1;
- case COM_DT_VECTOR: return 3;
- case COM_DT_COLOR: return 4;
- default: return 0;
+ case COM_DT_VALUE: return 1;
+ case COM_DT_VECTOR: return 3;
+ case COM_DT_COLOR: return 4;
+ default: return 0;
}
}
@@ -53,13 +53,13 @@ static float *init_buffer(unsigned int width, unsigned int height, DataType data
// When initializing the tree during initial load the width and height can be zero.
if (width != 0 && height != 0) {
int size = get_datatype_size(datatype);
- return (float *)MEM_callocN(width*height*size*sizeof(float), "OutputFile buffer");
+ return (float *)MEM_callocN(width * height * size * sizeof(float), "OutputFile buffer");
}
else
return NULL;
}
-static void write_buffer_rect(rcti *rect, MemoryBuffer** memoryBuffers, const bNodeTree *tree,
+static void write_buffer_rect(rcti *rect, MemoryBuffer **memoryBuffers, const bNodeTree *tree,
SocketReader *reader, float *buffer, unsigned int width, DataType datatype)
{
float color[4];
@@ -70,29 +70,29 @@ static void write_buffer_rect(rcti *rect, MemoryBuffer** memoryBuffers, const bN
int y1 = rect->ymin;
int x2 = rect->xmax;
int y2 = rect->ymax;
- int offset = (y1*width + x1 ) * size;
+ int offset = (y1 * width + x1) * size;
int x;
int y;
bool breaked = false;
- for (y = y1 ; y < y2 && (!breaked); y++) {
- for (x = x1 ; x < x2 && (!breaked) ; x++) {
+ for (y = y1; y < y2 && (!breaked); y++) {
+ for (x = x1; x < x2 && (!breaked); x++) {
reader->read(color, x, y, COM_PS_NEAREST, memoryBuffers);
- for (i=0; i < size; ++i)
- buffer[offset+i] = color[i];
+ for (i = 0; i < size; ++i)
+ buffer[offset + i] = color[i];
offset += size;
if (tree->test_break && tree->test_break(tree->tbh))
breaked = true;
}
- offset += (width-(x2-x1)) * size;
+ offset += (width - (x2 - x1)) * size;
}
}
OutputSingleLayerOperation::OutputSingleLayerOperation(
- const Scene *scene, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path)
+ const Scene *scene, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path)
{
this->scene = scene;
this->tree = tree;
@@ -113,7 +113,7 @@ void OutputSingleLayerOperation::initExecution()
this->outputBuffer = init_buffer(this->getWidth(), this->getHeight(), this->datatype);
}
-void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
+void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
{
write_buffer_rect(rect, memoryBuffers, this->tree, imageInput, this->outputBuffer, this->getWidth(), this->datatype);
}
@@ -123,7 +123,7 @@ void OutputSingleLayerOperation::deinitExecution()
if (this->getWidth() * this->getHeight() != 0) {
int size = get_datatype_size(this->datatype);
- ImBuf *ibuf = IMB_allocImBuf(this->getWidth(), this->getHeight(), size*8, 0);
+ ImBuf *ibuf = IMB_allocImBuf(this->getWidth(), this->getHeight(), size * 8, 0);
Main *bmain = G.main; /* TODO, have this passed along */
char filename[FILE_MAX];
@@ -160,7 +160,7 @@ OutputOpenExrLayer::OutputOpenExrLayer(const char *name, DataType datatype)
}
OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation(
- const Scene *scene, const bNodeTree *tree, const char *path, char exr_codec)
+ const Scene *scene, const bNodeTree *tree, const char *path, char exr_codec)
{
this->scene = scene;
this->tree = tree;
@@ -177,15 +177,15 @@ void OutputOpenExrMultiLayerOperation::add_layer(const char *name, DataType data
void OutputOpenExrMultiLayerOperation::initExecution()
{
- for (unsigned int i=0; i < layers.size(); ++i) {
+ for (unsigned int i = 0; i < layers.size(); ++i) {
layers[i].imageInput = getInputSocketReader(i);
layers[i].outputBuffer = init_buffer(this->getWidth(), this->getHeight(), layers[i].datatype);
}
}
-void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
+void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
{
- for (unsigned int i=0; i < layers.size(); ++i) {
+ for (unsigned int i = 0; i < layers.size(); ++i) {
write_buffer_rect(rect, memoryBuffers, this->tree, layers[i].imageInput, layers[i].outputBuffer, this->getWidth(), layers[i].datatype);
}
}
@@ -203,39 +203,39 @@ void OutputOpenExrMultiLayerOperation::deinitExecution()
(this->scene->r.scemode & R_EXTENSION), true);
BLI_make_existing_file(filename);
- for (unsigned int i=0; i < layers.size(); ++i) {
+ for (unsigned int i = 0; i < layers.size(); ++i) {
char channelname[EXR_TOT_MAXNAME];
- BLI_strncpy(channelname, layers[i].name, sizeof(channelname)-2);
+ BLI_strncpy(channelname, layers[i].name, sizeof(channelname) - 2);
char *channelname_ext = channelname + strlen(channelname);
float *buf = layers[i].outputBuffer;
/* create channels */
switch (layers[i].datatype) {
- case COM_DT_VALUE:
- strcpy(channelname_ext, ".V");
- IMB_exr_add_channel(exrhandle, 0, channelname, 1, width, buf);
- break;
- case COM_DT_VECTOR:
- strcpy(channelname_ext, ".X");
- IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3*width, buf);
- strcpy(channelname_ext, ".Y");
- IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3*width, buf+1);
- strcpy(channelname_ext, ".Z");
- IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3*width, buf+2);
- break;
- case COM_DT_COLOR:
- strcpy(channelname_ext, ".R");
- IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4*width, buf);
- strcpy(channelname_ext, ".G");
- IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4*width, buf+1);
- strcpy(channelname_ext, ".B");
- IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4*width, buf+2);
- strcpy(channelname_ext, ".A");
- IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4*width, buf+3);
- break;
- default:
- break;
+ case COM_DT_VALUE:
+ strcpy(channelname_ext, ".V");
+ IMB_exr_add_channel(exrhandle, 0, channelname, 1, width, buf);
+ break;
+ case COM_DT_VECTOR:
+ strcpy(channelname_ext, ".X");
+ IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3 * width, buf);
+ strcpy(channelname_ext, ".Y");
+ IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3 * width, buf + 1);
+ strcpy(channelname_ext, ".Z");
+ IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3 * width, buf + 2);
+ break;
+ case COM_DT_COLOR:
+ strcpy(channelname_ext, ".R");
+ IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4 * width, buf);
+ strcpy(channelname_ext, ".G");
+ IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4 * width, buf + 1);
+ strcpy(channelname_ext, ".B");
+ IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4 * width, buf + 2);
+ strcpy(channelname_ext, ".A");
+ IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4 * width, buf + 3);
+ break;
+ default:
+ break;
}
}
@@ -251,7 +251,7 @@ void OutputOpenExrMultiLayerOperation::deinitExecution()
}
IMB_exr_close(exrhandle);
- for (unsigned int i=0; i < layers.size(); ++i) {
+ for (unsigned int i = 0; i < layers.size(); ++i) {
if (layers[i].outputBuffer) {
MEM_freeN(layers[i].outputBuffer);
layers[i].outputBuffer = NULL;
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp
index 4975f13a285..54a95af33b9 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.cpp
+++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp
@@ -52,7 +52,7 @@ void PreviewOperation::initExecution()
{
this->input = getInputSocketReader(0);
if (!this->node->preview) {
- this->node->preview = (bNodePreview*)MEM_callocN(sizeof(bNodePreview), "node preview");
+ this->node->preview = (bNodePreview *)MEM_callocN(sizeof(bNodePreview), "node preview");
}
else {
if (this->getWidth() == (unsigned int)this->node->preview->xsize && this->getHeight() == (unsigned int)this->node->preview->ysize) {
@@ -61,9 +61,9 @@ void PreviewOperation::initExecution()
}
if (this->outputBuffer == NULL) {
- this->outputBuffer = (unsigned char*)MEM_callocN(sizeof(unsigned char)*4*getWidth()*getHeight(), "PreviewOperation");
+ this->outputBuffer = (unsigned char *)MEM_callocN(sizeof(unsigned char) * 4 * getWidth() * getHeight(), "PreviewOperation");
if (this->node->preview->rect) {
- MEM_freeN(this->node->preview->rect);
+ MEM_freeN(this->node->preview->rect);
}
this->node->preview->xsize = getWidth();
this->node->preview->ysize = getHeight();
@@ -81,11 +81,11 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, Memory
{
int offset;
float color[4];
- for (int y = rect->ymin ; y < rect->ymax ; y++) {
- offset = (y * getWidth() + rect->xmin)*4;
- for (int x = rect->xmin ; x < rect->xmax ; x++) {
- float rx = floor(x/divider);
- float ry = floor(y/divider);
+ for (int y = rect->ymin; y < rect->ymax; y++) {
+ offset = (y * getWidth() + rect->xmin) * 4;
+ for (int x = rect->xmin; x < rect->xmax; x++) {
+ float rx = floor(x / divider);
+ float ry = floor(y / divider);
color[0] = 0.0f;
color[1] = 0.0f;
@@ -93,8 +93,8 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, Memory
color[3] = 1.0f;
input->read(color, rx, ry, COM_PS_NEAREST, memoryBuffers);
linearrgb_to_srgb_v4(color, color);
- F4TOCHAR4(color, outputBuffer+offset);
- offset +=4;
+ F4TOCHAR4(color, outputBuffer + offset);
+ offset += 4;
}
}
}
@@ -102,10 +102,10 @@ bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferO
{
rcti newInput;
- newInput.xmin = input->xmin/divider;
- newInput.xmax = input->xmax/divider;
- newInput.ymin = input->ymin/divider;
- newInput.ymax = input->ymax/divider;
+ newInput.xmin = input->xmin / divider;
+ newInput.xmax = input->xmax / divider;
+ newInput.ymin = input->ymin / divider;
+ newInput.ymax = input->ymax / divider;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
@@ -116,10 +116,10 @@ void PreviewOperation::determineResolution(unsigned int resolution[], unsigned i
int height = resolution[1];
this->divider = 0.0f;
if (width > height) {
- divider = COM_PREVIEW_SIZE / (width-1);
+ divider = COM_PREVIEW_SIZE / (width - 1);
}
else {
- divider = COM_PREVIEW_SIZE / (height-1);
+ divider = COM_PREVIEW_SIZE / (height - 1);
}
width = width * divider;
height = height * divider;
diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
index 7695e0f63c2..77f2a06b29b 100644
--- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
@@ -24,7 +24,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-ProjectorLensDistortionOperation::ProjectorLensDistortionOperation(): NodeOperation()
+ProjectorLensDistortionOperation::ProjectorLensDistortionOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
@@ -34,7 +34,7 @@ ProjectorLensDistortionOperation::ProjectorLensDistortionOperation(): NodeOperat
void ProjectorLensDistortionOperation::initExecution()
{
this->inputProgram = this->getInputSocketReader(0);
- kr = 0.25f*MAX2(MIN2(this->dispersion, 1.f), 0.f);
+ kr = 0.25f * MAX2(MIN2(this->dispersion, 1.f), 0.f);
kr2 = kr * 20;
}
@@ -49,14 +49,14 @@ void ProjectorLensDistortionOperation::executePixel(float *color, int x, int y,
float inputValue[4];
const float height = this->getHeight();
const float width = this->getWidth();
- const float v = (y + 0.5f)/height;
- const float u = (x + 0.5f)/width;
- MemoryBuffer * inputBuffer = (MemoryBuffer*)data;
- inputBuffer->readCubic(inputValue, (u*width + kr2) - 0.5f, v*height - 0.5f);
+ const float v = (y + 0.5f) / height;
+ const float u = (x + 0.5f) / width;
+ MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
+ inputBuffer->readCubic(inputValue, (u * width + kr2) - 0.5f, v * height - 0.5f);
color[0] = inputValue[0];
inputBuffer->read(inputValue, x, y);
color[1] = inputValue[1];
- inputBuffer->readCubic(inputValue, (u*width - kr2) - 0.5f, v*height - 0.5f);
+ inputBuffer->readCubic(inputValue, (u * width - kr2) - 0.5f, v * height - 0.5f);
color[2] = inputValue[2];
color[3] = 1.0f;
}
@@ -71,7 +71,7 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *in
rcti newInput;
newInput.ymax = input->ymax;
newInput.ymin = input->ymin;
- newInput.xmin = input->xmin-kr2-2;
- newInput.xmax = input->xmax+kr2+2;
+ newInput.xmin = input->xmin - kr2 - 2;
+ newInput.xmax = input->xmax + kr2 + 2;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.cpp b/source/blender/compositor/operations/COM_QualityStepHelper.cpp
index f2d700292a4..18b3b106138 100644
--- a/source/blender/compositor/operations/COM_QualityStepHelper.cpp
+++ b/source/blender/compositor/operations/COM_QualityStepHelper.cpp
@@ -32,40 +32,40 @@ QualityStepHelper::QualityStepHelper()
void QualityStepHelper::initExecution(QualityHelper helper)
{
switch (helper) {
- case COM_QH_INCREASE:
- switch (this->quality) {
- case COM_QUALITY_HIGH:
- default:
- this->step = 1;
- this->offsetadd = 4;
+ case COM_QH_INCREASE:
+ switch (this->quality) {
+ case COM_QUALITY_HIGH:
+ default:
+ this->step = 1;
+ this->offsetadd = 4;
+ break;
+ case COM_QUALITY_MEDIUM:
+ this->step = 2;
+ this->offsetadd = 8;
+ break;
+ case COM_QUALITY_LOW:
+ this->step = 3;
+ this->offsetadd = 12;
+ break;
+ }
break;
- case COM_QUALITY_MEDIUM:
- this->step = 2;
- this->offsetadd = 8;
+ case COM_QH_MULTIPLY:
+ switch (this->quality) {
+ case COM_QUALITY_HIGH:
+ default:
+ this->step = 1;
+ this->offsetadd = 4;
+ break;
+ case COM_QUALITY_MEDIUM:
+ this->step = 2;
+ this->offsetadd = 8;
+ break;
+ case COM_QUALITY_LOW:
+ this->step = 4;
+ this->offsetadd = 16;
+ break;
+ }
break;
- case COM_QUALITY_LOW:
- this->step = 3;
- this->offsetadd = 12;
- break;
- }
- break;
- case COM_QH_MULTIPLY:
- switch (this->quality) {
- case COM_QUALITY_HIGH:
- default:
- this->step = 1;
- this->offsetadd = 4;
- break;
- case COM_QUALITY_MEDIUM:
- this->step = 2;
- this->offsetadd = 8;
- break;
- case COM_QUALITY_LOW:
- this->step = 4;
- this->offsetadd = 16;
- break;
- }
- break;
}
}
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
index 14b6db9037b..fa1f0280207 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
@@ -24,7 +24,7 @@
#include "COM_WriteBufferOperation.h"
#include "COM_defines.h"
-ReadBufferOperation::ReadBufferOperation():NodeOperation()
+ReadBufferOperation::ReadBufferOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_COLOR);
this->offset = 0;
@@ -38,7 +38,7 @@ void *ReadBufferOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB
void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
if (this->memoryProxy != NULL) {
- WriteBufferOperation * operation = memoryProxy->getWriteBufferOperation();
+ WriteBufferOperation *operation = memoryProxy->getWriteBufferOperation();
operation->determineResolution(resolution, preferredResolution);
operation->setResolution(resolution);
@@ -67,9 +67,9 @@ void ReadBufferOperation::executePixel(float *color, float x, float y, float dx,
}
}
-bool ReadBufferOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
+bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
- if (this==readOperation) {
+ if (this == readOperation) {
BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
return true;
}
@@ -78,7 +78,7 @@ bool ReadBufferOperation::determineDependingAreaOfInterest(rcti * input, ReadBuf
void ReadBufferOperation::readResolutionFromWriteBuffer() {
if (this->memoryProxy != NULL) {
- WriteBufferOperation * operation = memoryProxy->getWriteBufferOperation();
+ WriteBufferOperation *operation = memoryProxy->getWriteBufferOperation();
this->setWidth(operation->getWidth());
this->setHeight(operation->getHeight());
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp
index dad082cf0ca..bb165c2fe1c 100644
--- a/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersAOOperation.h"
-RenderLayersAOOperation::RenderLayersAOOperation() :RenderLayersBaseProg(SCE_PASS_AO, 3)
+RenderLayersAOOperation::RenderLayersAOOperation() : RenderLayersBaseProg(SCE_PASS_AO, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp
index ccb7dd91c04..35f787cb59f 100644
--- a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersAlphaProg.h"
-RenderLayersAlphaProg::RenderLayersAlphaProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
+RenderLayersAlphaProg::RenderLayersAlphaProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
{
this->addOutputSocket(COM_DT_VALUE);
}
@@ -31,7 +31,7 @@ void RenderLayersAlphaProg::executePixel(float *output, float x, float y, PixelS
{
int ix = x;
int iy = y;
- float * inputBuffer = this->getInputBuffer();
+ float *inputBuffer = this->getInputBuffer();
if (inputBuffer == NULL || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || iy >= (int)this->getHeight() ) {
output[0] = 0.0f;
@@ -40,8 +40,8 @@ void RenderLayersAlphaProg::executePixel(float *output, float x, float y, PixelS
output[3] = 0.0f;
}
else {
- unsigned int offset = (iy*this->getWidth()+ix) * 4;
- output[0] = inputBuffer[offset+3];
+ unsigned int offset = (iy * this->getWidth() + ix) * 4;
+ output[0] = inputBuffer[offset + 3];
output[1] = 0.0f;
output[2] = 0.0f;
output[3] = 0.0f;
diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
index 35c8753ded6..f27af3c25f5 100644
--- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp
@@ -31,7 +31,7 @@ extern "C" {
#include "RE_render_ext.h"
}
-RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize): NodeOperation()
+RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize) : NodeOperation()
{
this->renderpass = renderpass;
this->setScene(NULL);
@@ -42,15 +42,15 @@ RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize): Nod
void RenderLayersBaseProg::initExecution()
{
- Scene * scene = this->getScene();
- Render *re = (scene)? RE_GetRender(scene->id.name): NULL;
+ Scene *scene = this->getScene();
+ Render *re = (scene) ? RE_GetRender(scene->id.name) : NULL;
RenderResult *rr = NULL;
if (re)
rr = RE_AcquireResultRead(re);
if (rr) {
- SceneRenderLayer *srl = (SceneRenderLayer*)BLI_findlink(&scene->r.layers, getLayerId());
+ SceneRenderLayer *srl = (SceneRenderLayer *)BLI_findlink(&scene->r.layers, getLayerId());
if (srl) {
RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
@@ -81,7 +81,7 @@ void RenderLayersBaseProg::executePixel(float *output, float x, float y, PixelSa
output[3] = 0.0f;
}
else {
- unsigned int offset = (iy*this->getWidth()+ix) * elementsize;
+ unsigned int offset = (iy * this->getWidth() + ix) * elementsize;
if (elementsize == 1) {
output[0] = inputBuffer[offset];
output[1] = 0.0f;
@@ -90,15 +90,15 @@ void RenderLayersBaseProg::executePixel(float *output, float x, float y, PixelSa
}
else if (elementsize == 3) {
output[0] = inputBuffer[offset];
- output[1] = inputBuffer[offset+1];
- output[2] = inputBuffer[offset+2];
+ output[1] = inputBuffer[offset + 1];
+ output[2] = inputBuffer[offset + 2];
output[3] = 1.0f;
}
else {
output[0] = inputBuffer[offset];
- output[1] = inputBuffer[offset+1];
- output[2] = inputBuffer[offset+2];
- output[3] = inputBuffer[offset+3];
+ output[1] = inputBuffer[offset + 1];
+ output[2] = inputBuffer[offset + 2];
+ output[3] = inputBuffer[offset + 3];
}
}
}
@@ -121,12 +121,12 @@ void RenderLayersBaseProg::determineResolution(unsigned int resolution[], unsign
rr = RE_AcquireResultRead(re);
if (rr) {
- SceneRenderLayer *srl = (SceneRenderLayer*)BLI_findlink(&sce->r.layers, getLayerId());
+ SceneRenderLayer *srl = (SceneRenderLayer *)BLI_findlink(&sce->r.layers, getLayerId());
if (srl) {
RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
if (rl && rl->rectf) {
- resolution[0]=rl->rectx;
- resolution[1]=rl->recty;
+ resolution[0] = rl->rectx;
+ resolution[1] = rl->recty;
}
}
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp
index aee68afe55d..3083c37c2bb 100644
--- a/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersColorOperation.h"
-RenderLayersColorOperation::RenderLayersColorOperation() :RenderLayersBaseProg(SCE_PASS_RGBA, 4)
+RenderLayersColorOperation::RenderLayersColorOperation() : RenderLayersBaseProg(SCE_PASS_RGBA, 4)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp
index fc1df884181..b056896994e 100644
--- a/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersCyclesOperation.h"
-RenderLayersCyclesOperation::RenderLayersCyclesOperation(int pass) :RenderLayersBaseProg(pass, 3)
+RenderLayersCyclesOperation::RenderLayersCyclesOperation(int pass) : RenderLayersBaseProg(pass, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp b/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp
index 985b1c1bee8..ae5fc3b2254 100644
--- a/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersDepthProg.h"
-RenderLayersDepthProg::RenderLayersDepthProg() :RenderLayersBaseProg(SCE_PASS_Z, 1)
+RenderLayersDepthProg::RenderLayersDepthProg() : RenderLayersBaseProg(SCE_PASS_Z, 1)
{
this->addOutputSocket(COM_DT_VALUE);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp
index ad73490b92d..6baa25e5600 100644
--- a/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersDiffuseOperation.h"
-RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() :RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3)
+RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() : RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp
index 7537e2d10fc..1b03a4e169f 100644
--- a/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersEmitOperation.h"
-RenderLayersEmitOperation::RenderLayersEmitOperation() :RenderLayersBaseProg(SCE_PASS_EMIT, 3)
+RenderLayersEmitOperation::RenderLayersEmitOperation() : RenderLayersBaseProg(SCE_PASS_EMIT, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp
index 0ace9a7c58f..f4d6dc7353b 100644
--- a/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersEnvironmentOperation.h"
-RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() :RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3)
+RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() : RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp b/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp
index 264e2f0fd79..14c3d652c42 100644
--- a/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersImageProg.h"
-RenderLayersColourProg::RenderLayersColourProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
+RenderLayersColourProg::RenderLayersColourProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp
index 645f9768eb2..4258cb94a26 100644
--- a/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersIndirectOperation.h"
-RenderLayersIndirectOperation::RenderLayersIndirectOperation() :RenderLayersBaseProg(SCE_PASS_INDIRECT, 3)
+RenderLayersIndirectOperation::RenderLayersIndirectOperation() : RenderLayersBaseProg(SCE_PASS_INDIRECT, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp
index e5cef7753f2..aab7e0089e4 100644
--- a/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersMaterialIndexOperation.h"
-RenderLayersMaterialIndexOperation::RenderLayersMaterialIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXMA, 1)
+RenderLayersMaterialIndexOperation::RenderLayersMaterialIndexOperation() : RenderLayersBaseProg(SCE_PASS_INDEXMA, 1)
{
this->addOutputSocket(COM_DT_VALUE);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp
index fae6c73f747..c64ddc6e9d8 100644
--- a/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersMistOperation.h"
-RenderLayersMistOperation::RenderLayersMistOperation() :RenderLayersBaseProg(SCE_PASS_MIST, 1)
+RenderLayersMistOperation::RenderLayersMistOperation() : RenderLayersBaseProg(SCE_PASS_MIST, 1)
{
this->addOutputSocket(COM_DT_VALUE);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp
index 67ea4d68204..9d8e7d6272c 100644
--- a/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersNormalOperation.h"
-RenderLayersNormalOperation::RenderLayersNormalOperation() :RenderLayersBaseProg(SCE_PASS_NORMAL, 3)
+RenderLayersNormalOperation::RenderLayersNormalOperation() : RenderLayersBaseProg(SCE_PASS_NORMAL, 3)
{
this->addOutputSocket(COM_DT_VECTOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp
index 821ff447112..430ea698263 100644
--- a/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersObjectIndexOperation.h"
-RenderLayersObjectIndexOperation::RenderLayersObjectIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXOB, 1)
+RenderLayersObjectIndexOperation::RenderLayersObjectIndexOperation() : RenderLayersBaseProg(SCE_PASS_INDEXOB, 1)
{
this->addOutputSocket(COM_DT_VALUE);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp
index e53144d3501..1fbd599235b 100644
--- a/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersReflectionOperation.h"
-RenderLayersReflectionOperation::RenderLayersReflectionOperation() :RenderLayersBaseProg(SCE_PASS_REFLECT, 3)
+RenderLayersReflectionOperation::RenderLayersReflectionOperation() : RenderLayersBaseProg(SCE_PASS_REFLECT, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp
index 6e333175220..2ec9be46059 100644
--- a/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersRefractionOperation.h"
-RenderLayersRefractionOperation::RenderLayersRefractionOperation() :RenderLayersBaseProg(SCE_PASS_REFRACT, 3)
+RenderLayersRefractionOperation::RenderLayersRefractionOperation() : RenderLayersBaseProg(SCE_PASS_REFRACT, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp
index ce492d54a79..7582e010e2c 100644
--- a/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersShadowOperation.h"
-RenderLayersShadowOperation::RenderLayersShadowOperation() :RenderLayersBaseProg(SCE_PASS_SHADOW, 3)
+RenderLayersShadowOperation::RenderLayersShadowOperation() : RenderLayersBaseProg(SCE_PASS_SHADOW, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp
index 7b7d223680c..60c1636dcda 100644
--- a/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersSpecularOperation.h"
-RenderLayersSpecularOperation::RenderLayersSpecularOperation() :RenderLayersBaseProg(SCE_PASS_SPEC, 3)
+RenderLayersSpecularOperation::RenderLayersSpecularOperation() : RenderLayersBaseProg(SCE_PASS_SPEC, 3)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp
index 213d044a9bd..5a0662d13eb 100644
--- a/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersSpeedOperation.h"
-RenderLayersSpeedOperation::RenderLayersSpeedOperation() :RenderLayersBaseProg(SCE_PASS_VECTOR, 4)
+RenderLayersSpeedOperation::RenderLayersSpeedOperation() : RenderLayersBaseProg(SCE_PASS_VECTOR, 4)
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp
index e3917d7796b..b966f98632c 100644
--- a/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_RenderLayersUVOperation.h"
-RenderLayersUVOperation::RenderLayersUVOperation() :RenderLayersBaseProg(SCE_PASS_UV, 3)
+RenderLayersUVOperation::RenderLayersUVOperation() : RenderLayersBaseProg(SCE_PASS_UV, 3)
{
this->addOutputSocket(COM_DT_VECTOR);
}
diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp
index a391a26b89c..ac06048faf3 100644
--- a/source/blender/compositor/operations/COM_RotateOperation.cpp
+++ b/source/blender/compositor/operations/COM_RotateOperation.cpp
@@ -38,8 +38,8 @@ void RotateOperation::initExecution()
{
this->imageSocket = this->getInputSocketReader(0);
this->degreeSocket = this->getInputSocketReader(1);
- this->centerX = this->getWidth()/2.0;
- this->centerY = this->getHeight()/2.0;
+ this->centerX = this->getWidth() / 2.0;
+ this->centerY = this->getHeight() / 2.0;
}
void RotateOperation::deinitExecution()
@@ -54,10 +54,10 @@ inline void RotateOperation::ensureDegree() {
this->degreeSocket->read(degree, 0, 0, COM_PS_NEAREST, NULL);
double rad;
if (this->doDegree2RadConversion) {
- rad = DEG2RAD((double)degree[0]);
+ rad = DEG2RAD((double)degree[0]);
}
else {
- rad = degree[0];
+ rad = degree[0];
}
this->cosine = cos(rad);
this->sine = sin(rad);
@@ -67,13 +67,13 @@ 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, MemoryBuffer *inputBuffers[])
{
ensureDegree();
const float dy = y - this->centerY;
const float dx = x - this->centerX;
- const float nx = this->centerX+(this->cosine*dx + this->sine*dy);
- const float ny = this->centerY+(-this->sine*dx + this->cosine*dy);
+ const float nx = this->centerX + (this->cosine * dx + this->sine * dy);
+ const float ny = this->centerY + (-this->sine * dx + this->cosine * dy);
this->imageSocket->read(color, nx, ny, sampler, inputBuffers);
}
@@ -87,23 +87,23 @@ bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOp
const float dxmax = input->xmax - this->centerX;
const float dymax = input->ymax - this->centerY;
- const float x1 = this->centerX+(this->cosine*dxmin + this->sine*dymin);
- const float x2 = this->centerX+(this->cosine*dxmax + this->sine*dymin);
- const float x3 = this->centerX+(this->cosine*dxmin + this->sine*dymax);
- const float x4 = this->centerX+(this->cosine*dxmax + this->sine*dymax);
- const float y1 = this->centerY+(-this->sine*dxmin + this->cosine*dymin);
- const float y2 = this->centerY+(-this->sine*dxmax + this->cosine*dymin);
- const float y3 = this->centerY+(-this->sine*dxmin + this->cosine*dymax);
- const float y4 = this->centerY+(-this->sine*dxmax + this->cosine*dymax);
+ const float x1 = this->centerX + (this->cosine * dxmin + this->sine * dymin);
+ const float x2 = this->centerX + (this->cosine * dxmax + this->sine * dymin);
+ const float x3 = this->centerX + (this->cosine * dxmin + this->sine * dymax);
+ const float x4 = this->centerX + (this->cosine * dxmax + this->sine * dymax);
+ const float y1 = this->centerY + (-this->sine * dxmin + this->cosine * dymin);
+ const float y2 = this->centerY + (-this->sine * dxmax + this->cosine * dymin);
+ const float y3 = this->centerY + (-this->sine * dxmin + this->cosine * dymax);
+ const float y4 = this->centerY + (-this->sine * dxmax + this->cosine * dymax);
const float minx = min(x1, min(x2, min(x3, x4)));
const float maxx = max(x1, max(x2, max(x3, x4)));
const float miny = min(y1, min(y2, min(y3, y4)));
const float maxy = max(y1, max(y2, max(y3, y4)));
- newInput.xmax = ceil(maxx)+1;
- newInput.xmin = floor(minx)-1;
- newInput.ymax = ceil(maxy)+1;
- newInput.ymin = floor(miny)-1;
+ newInput.xmax = ceil(maxx) + 1;
+ newInput.xmin = floor(minx) - 1;
+ newInput.ymax = ceil(maxy) + 1;
+ newInput.ymin = floor(miny) - 1;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
index 4442fd9075e..3299434a02e 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
@@ -27,7 +27,7 @@ extern "C" {
#include "BLI_rand.h"
}
-ScreenLensDistortionOperation::ScreenLensDistortionOperation(): NodeOperation()
+ScreenLensDistortionOperation::ScreenLensDistortionOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
@@ -39,19 +39,19 @@ void ScreenLensDistortionOperation::initExecution()
this->inputProgram = this->getInputSocketReader(0);
kg = MAX2(MIN2(this->distortion, 1.f), -0.999f);
// smaller dispersion range for somewhat more control
- const float d = 0.25f*MAX2(MIN2(this->dispersion, 1.f), 0.f);
- kr = MAX2(MIN2((kg+d), 1.f), -0.999f);
- kb = MAX2(MIN2((kg-d), 1.f), -0.999f);
+ const float d = 0.25f * MAX2(MIN2(this->dispersion, 1.f), 0.f);
+ kr = MAX2(MIN2((kg + d), 1.f), -0.999f);
+ kb = MAX2(MIN2((kg - d), 1.f), -0.999f);
maxk = MAX3(kr, kg, kb);
- sc = (this->data->fit && (maxk > 0.f)) ? (1.f/(1.f + 2.f*maxk)) : (1.f/(1.f + maxk));
- drg = 4.f*(kg - kr);
- dgb = 4.f*(kb - kg);
+ sc = (this->data->fit && (maxk > 0.f)) ? (1.f / (1.f + 2.f * maxk)) : (1.f / (1.f + maxk));
+ drg = 4.f * (kg - kr);
+ dgb = 4.f * (kb - kg);
- kr4 = kr*4;
- kg4 = kg*4.f;
- kb4 *= kb*4.f;
- cx = 0.5f*(float)getWidth();
- cy = 0.5f*(float)getHeight();
+ kr4 = kr * 4;
+ kg4 = kg * 4.f;
+ kb4 *= kb * 4.f;
+ cx = 0.5f * (float)getWidth();
+ cy = 0.5f * (float)getHeight();
}
@@ -65,28 +65,28 @@ void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int
{
const float height = this->getHeight();
const float width = this->getWidth();
- MemoryBuffer *buffer = (MemoryBuffer*)data;
+ MemoryBuffer *buffer = (MemoryBuffer *)data;
int dr = 0, dg = 0, db = 0;
float d, t, ln[6] = {0, 0, 0, 0, 0, 0};
float tc[4] = {0, 0, 0, 0};
- const float v = sc*((y + 0.5f) - cy)/cy;
- const float u = sc*((x + 0.5f) - cx)/cx;
+ const float v = sc * ((y + 0.5f) - cy) / cy;
+ const float u = sc * ((x + 0.5f) - cx) / cx;
int sta = 0, mid = 0, end = 0;
- if ((t = 1.f - kr4*(u*u + v*v)) >= 0.f) {
- d = 1.f/(1.f + sqrtf(t));
- ln[0] = (u*d + 0.5f)*width - 0.5f, ln[1] = (v*d + 0.5f)*height - 0.5f;
+ if ((t = 1.f - kr4 * (u * u + v * v)) >= 0.f) {
+ d = 1.f / (1.f + sqrtf(t));
+ ln[0] = (u * d + 0.5f) * width - 0.5f, ln[1] = (v * d + 0.5f) * height - 0.5f;
sta = 1;
}
- if ((t = 1.f - kg4*(u*u + v*v)) >= 0.f) {
- d = 1.f/(1.f + sqrtf(t));
- ln[2] = (u*d + 0.5f)*width - 0.5f, ln[3] = (v*d + 0.5f)*height - 0.5f;
+ if ((t = 1.f - kg4 * (u * u + v * v)) >= 0.f) {
+ d = 1.f / (1.f + sqrtf(t));
+ ln[2] = (u * d + 0.5f) * width - 0.5f, ln[3] = (v * d + 0.5f) * height - 0.5f;
mid = 1;
}
- if ((t = 1.f - kb4*(u*u + v*v)) >= 0.f) {
- d = 1.f/(1.f + sqrtf(t));
- ln[4] = (u*d + 0.5f)*width - 0.5f, ln[5] = (v*d + 0.5f)*height - 0.5f;
+ if ((t = 1.f - kb4 * (u * u + v * v)) >= 0.f) {
+ d = 1.f / (1.f + sqrtf(t));
+ ln[4] = (u * d + 0.5f) * width - 0.5f, ln[5] = (v * d + 0.5f) * height - 0.5f;
end = 1;
}
@@ -97,43 +97,43 @@ void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int
{
// RG
const int dx = ln[2] - ln[0], dy = ln[3] - ln[1];
- const float dsf = sqrtf((float)dx*dx + dy*dy) + 1.f;
+ const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f;
const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf);
- const float sd = 1.f/(float)ds;
+ const float sd = 1.f / (float)ds;
- for (z=0; z<ds; ++z) {
- const float tz = ((float)z + (jit ? BLI_frand() : 0.5f))*sd;
- t = 1.f - (kr4 + tz*drg)*(u*u + v*v);
+ for (z = 0; z < ds; ++z) {
+ const float tz = ((float)z + (jit ? BLI_frand() : 0.5f)) * sd;
+ t = 1.f - (kr4 + tz * drg) * (u * u + v * v);
d = 1.f / (1.f + sqrtf(t));
- const float nx = (u*d + 0.5f)*getWidth() - 0.5f;
- const float ny = (v*d + 0.5f)*getHeight() - 0.5f;
+ const float nx = (u * d + 0.5f) * getWidth() - 0.5f;
+ const float ny = (v * d + 0.5f) * getHeight() - 0.5f;
buffer->readCubic(color, nx, ny);
- tc[0] += (1.f-tz)*color[0], tc[1] += tz*color[1];
+ tc[0] += (1.f - tz) * color[0], tc[1] += tz * color[1];
dr++, dg++;
}
}
{
// GB
const int dx = ln[4] - ln[2], dy = ln[5] - ln[3];
- const float dsf = sqrtf((float)dx*dx + dy*dy) + 1.f;
+ const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f;
const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf);
- const float sd = 1.f/(float)ds;
+ const float sd = 1.f / (float)ds;
- for (z=0; z<ds; ++z) {
- const float tz = ((float)z + (jit ? BLI_frand() : 0.5f))*sd;
- t = 1.f - (kg4 + tz*dgb)*(u*u + v*v);
+ for (z = 0; z < ds; ++z) {
+ const float tz = ((float)z + (jit ? BLI_frand() : 0.5f)) * sd;
+ t = 1.f - (kg4 + tz * dgb) * (u * u + v * v);
d = 1.f / (1.f + sqrtf(t));
- const float nx = (u*d + 0.5f)*getWidth() - 0.5f;
- const float ny = (v*d + 0.5f)*getHeight() - 0.5f;
+ const float nx = (u * d + 0.5f) * getWidth() - 0.5f;
+ const float ny = (v * d + 0.5f) * getHeight() - 0.5f;
buffer->readCubic(color, nx, ny);
- tc[1] += (1.f-tz)*color[1], tc[2] += tz*color[2];
+ tc[1] += (1.f - tz) * color[1], tc[2] += tz * color[2];
dg++, db++;
}
}
- if (dr) outputColor[0] = 2.f*tc[0] / (float)dr;
- if (dg) outputColor[1] = 2.f*tc[1] / (float)dg;
- if (db) outputColor[2] = 2.f*tc[2] / (float)db;
+ if (dr) outputColor[0] = 2.f * tc[0] / (float)dr;
+ if (dg) outputColor[1] = 2.f * tc[1] / (float)dg;
+ if (db) outputColor[2] = 2.f * tc[2] / (float)db;
/* set alpha */
outputColor[3] = 1.0f;
@@ -153,12 +153,12 @@ void ScreenLensDistortionOperation::deinitExecution()
void ScreenLensDistortionOperation::determineUV(float result[2], float x, float y) const
{
- const float v = sc*((y + 0.5f) - cy)/cy;
- const float u = sc*((x + 0.5f) - cx)/cx;
- const float t = ABS(MIN3(kr, kg, kb)*4);
- float d = 1.f/(1.f + sqrtf(t));
- result[0] = (u*d + 0.5f)*getWidth() - 0.5f;
- result[1] = (v*d + 0.5f)*getHeight() - 0.5f;
+ const float v = sc * ((y + 0.5f) - cy) / cy;
+ const float u = sc * ((x + 0.5f) - cx) / cx;
+ const float t = ABS(MIN3(kr, kg, kb) * 4);
+ float d = 1.f / (1.f + sqrtf(t));
+ result[0] = (u * d + 0.5f) * getWidth() - 0.5f;
+ result[1] = (v * d + 0.5f) * getHeight() - 0.5f;
}
bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
diff --git a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp b/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp
index 680e1648ebd..caa1387da2a 100644
--- a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp
+++ b/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp
@@ -39,7 +39,7 @@ 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, MemoryBuffer *inputBuffers[])
{
float input[4];
this->inputOperation->read(input, x, y, sampler, inputBuffers);
diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
index 0aefb075b64..5924108ed86 100644
--- a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_SetAlphaOperation.h"
-SetAlphaOperation::SetAlphaOperation(): NodeOperation()
+SetAlphaOperation::SetAlphaOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VALUE);
diff --git a/source/blender/compositor/operations/COM_SetColorOperation.cpp b/source/blender/compositor/operations/COM_SetColorOperation.cpp
index 50ff2a87a72..5307d7abc24 100644
--- a/source/blender/compositor/operations/COM_SetColorOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetColorOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_SetColorOperation.h"
-SetColorOperation::SetColorOperation(): NodeOperation()
+SetColorOperation::SetColorOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_COLOR);
}
diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp
index 8974554e700..dfe7fe91bf8 100644
--- a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_SetSamplerOperation.h"
-SetSamplerOperation::SetSamplerOperation(): NodeOperation()
+SetSamplerOperation::SetSamplerOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addOutputSocket(COM_DT_COLOR);
diff --git a/source/blender/compositor/operations/COM_SetValueOperation.cpp b/source/blender/compositor/operations/COM_SetValueOperation.cpp
index abd4acafea6..483fcc97a1f 100644
--- a/source/blender/compositor/operations/COM_SetValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetValueOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_SetValueOperation.h"
-SetValueOperation::SetValueOperation(): NodeOperation()
+SetValueOperation::SetValueOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_VALUE);
}
diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cpp b/source/blender/compositor/operations/COM_SetVectorOperation.cpp
index 79c0201733e..3d15a184c4e 100644
--- a/source/blender/compositor/operations/COM_SetVectorOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetVectorOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_SetVectorOperation.h"
#include "COM_defines.h"
-SetVectorOperation::SetVectorOperation(): NodeOperation()
+SetVectorOperation::SetVectorOperation() : NodeOperation()
{
this->addOutputSocket(COM_DT_VECTOR);
}
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
index 5f86d6bd7c7..55c4b68ee57 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
@@ -39,7 +39,7 @@ void SocketProxyOperation::deinitExecution()
this->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, MemoryBuffer *inputBuffers[])
{
if (this->inputOperation) {
this->inputOperation->read(color, x, y, sampler, inputBuffers);
diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp
index 0d85f71c691..072528f3fc6 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.cpp
+++ b/source/blender/compositor/operations/COM_TextureOperation.cpp
@@ -25,10 +25,10 @@
#include "BLI_listbase.h"
#include "DNA_scene_types.h"
-TextureBaseOperation::TextureBaseOperation(): NodeOperation()
+TextureBaseOperation::TextureBaseOperation() : NodeOperation()
{
- this->addInputSocket(COM_DT_VECTOR);//offset
- this->addInputSocket(COM_DT_VECTOR);//size
+ this->addInputSocket(COM_DT_VECTOR); //offset
+ this->addInputSocket(COM_DT_VECTOR); //size
this->texture = NULL;
this->inputSize = NULL;
this->inputOffset = NULL;
@@ -57,8 +57,8 @@ void TextureBaseOperation::deinitExecution()
void TextureBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
if (preferredResolution[0] == 0 || preferredResolution[1] == 0) {
- int width = this->scene->r.xsch*this->scene->r.size/100;
- int height = this->scene->r.ysch*this->scene->r.size/100;
+ int width = this->scene->r.xsch * this->scene->r.size / 100;
+ int height = this->scene->r.ysch * this->scene->r.size / 100;
resolution[0] = width;
resolution[1] = height;
}
@@ -79,22 +79,22 @@ void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSa
void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
{
- TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
+ TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
float textureSize[4];
float textureOffset[4];
float vec[3];
int retval;
- const float cx = this->getWidth()/2;
- const float cy = this->getHeight()/2;
- const float u = (cx-x)/this->getWidth()*2;
- const float v = (cy-y)/this->getHeight()*2;
+ const float cx = this->getWidth() / 2;
+ const float cy = this->getHeight() / 2;
+ const float u = (cx - x) / this->getWidth() * 2;
+ const float v = (cy - y) / this->getHeight() * 2;
this->inputSize->read(textureSize, x, y, sampler, inputBuffers);
this->inputOffset->read(textureOffset, x, y, sampler, inputBuffers);
- vec[0] = textureSize[0]*(u + textureOffset[0]);
- vec[1] = textureSize[1]*(v + textureOffset[1]);
- vec[2] = textureSize[2]*textureOffset[2];
+ vec[0] = textureSize[0] * (u + textureOffset[0]);
+ vec[1] = textureSize[1] * (v + textureOffset[1]);
+ vec[2] = textureSize[2] * textureOffset[2];
retval = multitex_ext(this->texture, vec, NULL, NULL, 0, &texres);
diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp
index b281fb938fd..7b978e0f87c 100644
--- a/source/blender/compositor/operations/COM_TonemapOperation.cpp
+++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp
@@ -26,7 +26,7 @@
-TonemapOperation::TonemapOperation(): NodeOperation()
+TonemapOperation::TonemapOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
this->addOutputSocket(COM_DT_COLOR);
@@ -41,9 +41,9 @@ 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, MemoryBuffer *inputBuffers[], void *data)
{
- AvgLogLum * avg = (AvgLogLum*)data;
+ AvgLogLum *avg = (AvgLogLum *)data;
float output[4];
this->imageReader->read(output, x, y, inputBuffers, NULL);
@@ -120,10 +120,10 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff
{
lockMutex();
if (this->cachedInstance == NULL) {
- MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *tile = (MemoryBuffer *)imageReader->initializeTileData(rect, memoryBuffers);
AvgLogLum *data = new AvgLogLum();
- float * buffer = tile->getBuffer();
+ float *buffer = tile->getBuffer();
float lsum = 0.0f;
int p = tile->getWidth() * tile->getHeight();
@@ -131,7 +131,7 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff
float avl, maxl = -1e10f, minl = 1e10f;
const float sc = 1.0f / p;
float Lav = 0.f;
- float cav[4] = {0.0f,0.0f,0.0f,0.0f};
+ float cav[4] = {0.0f, 0.0f, 0.0f, 0.0f};
while (p--) {
float L = rgb_to_luma_y(bc);
Lav += L;
@@ -139,7 +139,7 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff
lsum += logf(MAX2(L, 0.0f) + 1e-5f);
maxl = (L > maxl) ? L : maxl;
minl = (L < minl) ? L : minl;
- bc+=4;
+ bc += 4;
}
data->lav = Lav * sc;
mul_v3_v3fl(data->cav, cav, sc);
@@ -147,7 +147,7 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff
data->auto_key = (maxl > minl) ? ((maxl - avl) / (maxl - minl)) : 1.f;
float al = exp((double)avl);
data->al = (al == 0.f) ? 0.f : (this->data->key / al);
- data->igm = (this->data->gamma==0.f) ? 1 : (1.f / this->data->gamma);
+ data->igm = (this->data->gamma == 0.f) ? 1 : (1.f / this->data->gamma);
this->cachedInstance = data;
}
unlockMutex();
@@ -156,4 +156,5 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff
void TonemapOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
{
+ /* pass */
}
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp
index b9b06d6d356..c41e2c7f156 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, MemoryBuffer *inputBuffers[])
{
ensureDelta();
- this->inputOperation->read(color, x-this->getDeltaX(), y-this->getDeltaY(), sampler, inputBuffers);
+ this->inputOperation->read(color, x - this->getDeltaX(), y - this->getDeltaY(), sampler, inputBuffers);
}
bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
index 7c9b0c75518..b3cc5ece3b8 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
@@ -53,15 +53,11 @@ void VariableSizeBokehBlurOperation::initExecution()
void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
- float tempColor[4];
float readColor[4];
float bokeh[4];
- tempColor[0] = 0;
- tempColor[1] = 0;
- tempColor[2] = 0;
- tempColor[3] = 0;
float tempSize[4];
- float overallmultiplyer[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
int miny = y - maxBlur;
int maxy = y + maxBlur;
@@ -69,12 +65,12 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
int maxx = x + maxBlur;
{
inputProgram->read(readColor, x, y, COM_PS_NEAREST, inputBuffers);
- tempColor[0] += readColor[0];
- tempColor[1] += readColor[1];
- tempColor[2] += readColor[2];
- tempColor[3] += readColor[3];
- add_v4_v4(tempColor, readColor);
- add_v3_fl(overallmultiplyer, 1.0f);
+ color_accum[0] += readColor[0];
+ color_accum[1] += readColor[1];
+ color_accum[2] += readColor[2];
+ color_accum[3] += readColor[3];
+ add_v4_v4(color_accum, readColor);
+ add_v3_fl(multiplier_accum, 1.0f);
for (int ny = miny; ny < maxy; ny += QualityStepHelper::getStep()) {
for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
@@ -92,17 +88,17 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
float v = 256 + dy * 256 / size;
inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers);
inputProgram->read(readColor, nx, ny, COM_PS_NEAREST, inputBuffers);
- madd_v4_v4v4(tempColor, bokeh, readColor);
- add_v4_v4(overallmultiplyer, bokeh);
+ madd_v4_v4v4(color_accum, bokeh, readColor);
+ add_v4_v4(multiplier_accum, bokeh);
}
}
}
}
- color[0] = tempColor[0] * (1.0f / overallmultiplyer[0]);
- color[1] = tempColor[1] * (1.0f / overallmultiplyer[1]);
- color[2] = tempColor[2] * (1.0f / overallmultiplyer[2]);
- color[3] = tempColor[3] * (1.0f / overallmultiplyer[3]);
+ color[0] = color_accum[0] * (1.0f / multiplier_accum[0]);
+ color[1] = color_accum[1] * (1.0f / multiplier_accum[1]);
+ color[2] = color_accum[2] * (1.0f / multiplier_accum[2]);
+ color[3] = color_accum[3] * (1.0f / multiplier_accum[3]);
}
}
diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
index e9045b126e2..3173599ece6 100644
--- a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
@@ -30,7 +30,7 @@ extern "C" {
}
#endif
-VectorCurveOperation::VectorCurveOperation(): CurveBaseOperation()
+VectorCurveOperation::VectorCurveOperation() : CurveBaseOperation()
{
this->addInputSocket(COM_DT_VECTOR);
this->addOutputSocket(COM_DT_VECTOR);
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
index 087ab50cf47..e1018e0d037 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
@@ -24,7 +24,7 @@
#include "COM_defines.h"
#include <stdio.h>
-WriteBufferOperation::WriteBufferOperation() :NodeOperation()
+WriteBufferOperation::WriteBufferOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->memoryProxy = new MemoryProxy();
@@ -56,7 +56,7 @@ void WriteBufferOperation::deinitExecution()
this->memoryProxy->free();
}
-void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
+void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
{
//MemoryBuffer *memoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), tileNumber);
MemoryBuffer *memoryBuffer = this->memoryProxy->getBuffer();
@@ -70,11 +70,11 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
int x;
int y;
bool breaked = false;
- for (y = y1 ; y < y2 && (!breaked) ; y++) {
- int offset4 = (y*memoryBuffer->getWidth()+x1)*COM_NUMBER_OF_CHANNELS;
- for (x = x1 ; x < x2; x++) {
+ for (y = y1; y < y2 && (!breaked); y++) {
+ int offset4 = (y * memoryBuffer->getWidth() + x1) * COM_NUMBER_OF_CHANNELS;
+ for (x = x1; x < x2; x++) {
input->read(&(buffer[offset4]), x, y, memoryBuffers, data);
- offset4 +=COM_NUMBER_OF_CHANNELS;
+ offset4 += COM_NUMBER_OF_CHANNELS;
}
if (isBreaked()) {
@@ -96,11 +96,11 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
int x;
int y;
bool breaked = false;
- for (y = y1 ; y < y2 && (!breaked) ; y++) {
- int offset4 = (y*memoryBuffer->getWidth()+x1)*COM_NUMBER_OF_CHANNELS;
- for (x = x1 ; x < x2 ; x++) {
+ for (y = y1; y < y2 && (!breaked); y++) {
+ int offset4 = (y * memoryBuffer->getWidth() + x1) * COM_NUMBER_OF_CHANNELS;
+ for (x = x1; x < x2; x++) {
input->read(&(buffer[offset4]), x, y, COM_PS_NEAREST, memoryBuffers);
- offset4 +=COM_NUMBER_OF_CHANNELS;
+ offset4 += COM_NUMBER_OF_CHANNELS;
}
if (isBreaked()) {
breaked = true;
@@ -110,7 +110,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
memoryBuffer->setCreatedState();
}
-void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** inputMemoryBuffers, MemoryBuffer* outputBuffer)
+void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer **inputMemoryBuffers, MemoryBuffer *outputBuffer)
{
float *outputFloatBuffer = outputBuffer->getBuffer();
cl_int error;
@@ -131,11 +131,11 @@ void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program pr
CL_FLOAT
};
- cl_mem clOutputBuffer = clCreateImage2D(context, CL_MEM_WRITE_ONLY|CL_MEM_USE_HOST_PTR, &imageFormat, outputBufferWidth, outputBufferHeight, 0, outputFloatBuffer, &error);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ cl_mem clOutputBuffer = clCreateImage2D(context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR, &imageFormat, outputBufferWidth, outputBufferHeight, 0, outputFloatBuffer, &error);
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
// STEP 2
- list<cl_mem> * clMemToCleanUp = new list<cl_mem>();
+ list<cl_mem> *clMemToCleanUp = new list<cl_mem>();
clMemToCleanUp->push_back(clOutputBuffer);
list<cl_kernel> *clKernelsToCleanUp = new list<cl_kernel>();
@@ -143,40 +143,40 @@ void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program pr
// STEP 3
- size_t origin[3] = {0,0,0};
- size_t region[3] = {outputBufferWidth,outputBufferHeight,1};
+ size_t origin[3] = {0, 0, 0};
+ size_t region[3] = {outputBufferWidth, outputBufferHeight, 1};
// clFlush(queue);
// clFinish(queue);
error = clEnqueueBarrier(queue);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
error = clEnqueueReadImage(queue, clOutputBuffer, CL_TRUE, origin, region, 0, 0, outputFloatBuffer, 0, NULL, NULL);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
this->getMemoryProxy()->getBuffer()->copyContentFrom(outputBuffer);
// STEP 4
- while (clMemToCleanUp->size()>0) {
+ while (clMemToCleanUp->size() > 0) {
cl_mem mem = clMemToCleanUp->front();
error = clReleaseMemObject(mem);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
clMemToCleanUp->pop_front();
}
- while (clKernelsToCleanUp->size()>0) {
+ while (clKernelsToCleanUp->size() > 0) {
cl_kernel kernel = clKernelsToCleanUp->front();
error = clReleaseKernel(kernel);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
clKernelsToCleanUp->pop_front();
}
delete clKernelsToCleanUp;
}
void WriteBufferOperation::readResolutionFromInputSocket() {
- NodeOperation* inputOperation = this->getInputOperation(0);
+ NodeOperation *inputOperation = this->getInputOperation(0);
this->setWidth(inputOperation->getWidth());
this->setHeight(inputOperation->getHeight());
}
diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp
index 7f32bac2e64..eb02b150fa4 100644
--- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp
+++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp
@@ -23,7 +23,7 @@
#include "COM_ZCombineOperation.h"
#include "BLI_utildefines.h"
-ZCombineOperation::ZCombineOperation(): NodeOperation()
+ZCombineOperation::ZCombineOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VALUE);
@@ -53,7 +53,7 @@ void ZCombineOperation::executePixel(float *color, float x, float y, PixelSample
this->depth1Reader->read(depth1, x, y, sampler, inputBuffers);
this->depth2Reader->read(depth2, x, y, sampler, inputBuffers);
- if (depth1[0]<depth2[0]) {
+ if (depth1[0] < depth2[0]) {
this->image1Reader->read(color, x, y, sampler, inputBuffers);
}
else {
@@ -69,7 +69,7 @@ void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelS
this->depth1Reader->read(depth1, x, y, sampler, inputBuffers);
this->depth2Reader->read(depth2, x, y, sampler, inputBuffers);
- if (depth1[0]<depth2[0]) {
+ if (depth1[0] < depth2[0]) {
this->image1Reader->read(color1, x, y, sampler, inputBuffers);
this->image2Reader->read(color2, x, y, sampler, inputBuffers);
}
@@ -78,10 +78,10 @@ void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelS
this->image2Reader->read(color1, x, y, sampler, inputBuffers);
}
float fac = color1[3];
- float ifac = 1.0f-fac;
- color[0] = color1[0]+ifac*color2[0];
- color[1] = color1[1]+ifac*color2[1];
- color[2] = color1[2]+ifac*color2[2];
+ float ifac = 1.0f - fac;
+ color[0] = color1[0] + ifac * color2[0];
+ color[1] = color1[1] + ifac * color2[1];
+ color[2] = color1[2] + ifac * color2[2];
color[3] = MAX2(color1[3], color2[3]);
}
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 67ed77bcc4b..084006ce277 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -24,6 +24,7 @@ if(WITH_BLENDER)
add_subdirectory(curve)
add_subdirectory(gpencil)
add_subdirectory(interface)
+ add_subdirectory(io)
add_subdirectory(mask)
add_subdirectory(mesh)
add_subdirectory(metaball)
diff --git a/source/blender/editors/SConscript b/source/blender/editors/SConscript
index d08b496f0ef..6233ea0dc39 100644
--- a/source/blender/editors/SConscript
+++ b/source/blender/editors/SConscript
@@ -6,6 +6,7 @@ SConscript(['datafiles/SConscript',
'space_api/SConscript',
'util/SConscript',
'interface/SConscript',
+ 'io/SConscript',
'animation/SConscript',
'armature/SConscript',
'mask/SConscript',
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 752e458ef78..46e1eb98dae 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -183,7 +183,7 @@ static short actedit_get_context(bAnimContext *ac, SpaceAction *saction)
//MovieClip *clip = ac->scene->clip;
// struct Mask *mask = seq ? seq->mask : NULL;
- saction->ads.source = (ID *)ac->scene;;
+ saction->ads.source = (ID *)ac->scene;
ac->datatype = ANIMCONT_MASK;
ac->data = &saction->ads;
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index a8f8d2974e5..3883dce7671 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -156,7 +156,7 @@ void duplicate_fcurve_keys(FCurve *fcu)
memcpy(newbezt, fcu->bezt, sizeof(BezTriple) * (i + 1));
memcpy(newbezt + i + 1, fcu->bezt + i, sizeof(BezTriple));
- memcpy(newbezt + i + 2, fcu->bezt + i + 1, sizeof (BezTriple) * (fcu->totvert - (i + 1)));
+ memcpy(newbezt + i + 2, fcu->bezt + i + 1, sizeof(BezTriple) * (fcu->totvert - (i + 1)));
fcu->totvert++;
/* reassign pointers... (free old, and add new) */
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index b8601419d51..6250424d655 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -559,7 +559,6 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
const char *identifier = NULL;
/* validate data */
- // TODO: this check is probably not needed, but it won't hurt
if (ELEM3(NULL, ptr, ptr->data, prop))
return 0;
@@ -635,6 +634,9 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
case CONSTRAINT_TYPE_TRACKTO:
if (searchtype == VISUALKEY_ROT) return 1;
break;
+ case CONSTRAINT_TYPE_DAMPTRACK:
+ if (searchtype == VISUALKEY_ROT) return 1;
+ break;
case CONSTRAINT_TYPE_ROTLIMIT:
if (searchtype == VISUALKEY_ROT) return 1;
break;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 3c802020747..0007facdf8f 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -878,7 +878,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
glPopMatrix();
/* min max */
- glColor3f(.5f, .5f, .5f);
+ glColor3f(0.5f, 0.5f, 0.5f);
min = yofs + scopes->minmax[0][0] * h;
max = yofs + scopes->minmax[0][1] * h;
CLAMP(min, rect.ymin, rect.ymax);
@@ -1012,7 +1012,9 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
int i, j;
float w, h, centerx, centery, diam;
float alpha;
- const float colors[6][3] = {{.75, 0, 0}, {.75, .75, 0}, {0, .75, 0}, {0, .75, .75}, {0, 0, .75}, {.75, 0, .75}};
+ const float colors[6][3] = {
+ {0.75, 0.0, 0.0}, {0.75, 0.75, 0.0}, {0.0, 0.75, 0.0},
+ {0.0, 0.75, 0.75}, {0.0, 0.0, 0.75}, {0.75, 0.0, 0.75}};
GLint scissor[4];
rect.xmin = (float)recti->xmin + 1;
@@ -1375,7 +1377,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}
- /* grid, every .25 step */
+ /* grid, every 0.25 step */
gl_shaded_color((unsigned char *)wcol->inner, -16);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
/* grid, every 1.0 step */
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 385f74acbd2..737c0377f27 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -347,7 +347,7 @@ static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float UNUSED(a
glColor4f(0.0f, 0.0f, 0.0f, 1);
viconutil_draw_lineloop_smooth(pts, 3);
- glColor3f(.9f, .9f, .9f);
+ glColor3f(0.9f, 0.9f, 0.9f);
viconutil_draw_points(pts, 3, 1);
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 02f34873ea7..fe46a5dc9c5 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -737,7 +737,8 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
rgba_char_args_set(btheme->tv3d.bone_solid, 200, 200, 200, 255);
- rgba_char_args_set(btheme->tv3d.bone_pose, 80, 200, 255, 80); // alpha 80 is not meant editable, used for wire+action draw
+ /* alpha 80 is not meant editable, used for wire+action draw */
+ rgba_char_args_set(btheme->tv3d.bone_pose, 80, 200, 255, 80);
rgba_char_args_set(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
rgba_char_args_set(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt
new file mode 100644
index 00000000000..0c417c5dfb9
--- /dev/null
+++ b/source/blender/editors/io/CMakeLists.txt
@@ -0,0 +1,46 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributor(s): Blender Foundation
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+ ../include
+ ../../blenfont
+ ../../blenkernel
+ ../../blenlib
+ ../../blenloader
+ ../../bmesh
+ ../../makesdna
+ ../../makesrna
+ ../../windowmanager
+ ../../collada
+)
+
+set(SRC
+ io_collada.c
+ io_ops.c
+
+ io_collada.h
+ io_ops.h
+)
+
+if(WITH_OPENCOLLADA)
+ add_definitions(-DWITH_COLLADA)
+endif()
+
+blender_add_lib(bf_editor_io "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/io/SConscript b/source/blender/editors/io/SConscript
new file mode 100644
index 00000000000..d012576637c
--- /dev/null
+++ b/source/blender/editors/io/SConscript
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+Import ('env')
+
+sources = env.Glob('*.c')
+defs = []
+
+incs = '../include ../../blenfont ../../blenkernel ../../blenlib ../../blenloader ../../bmesh'
+incs += '../../makesdna ../../makesrna ../../windowmanager ../../collada'
+
+if env['WITH_BF_COLLADA']:
+ defs += ['WITH_COLLADA']
+
+env.BlenderLib ( 'bf_editor_io', sources, Split(incs), defines=defs, libtype=['core','player'], priority=[330,210] )
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
new file mode 100644
index 00000000000..cf649207ff3
--- /dev/null
+++ b/source/blender/editors/io/io_collada.c
@@ -0,0 +1,281 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/io/collada.c
+ * \ingroup collada
+ */
+#ifdef WITH_COLLADA
+#include "DNA_scene_types.h"
+
+#include "BLF_translation.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_report.h"
+
+#include "ED_screen.h"
+#include "ED_object.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "../../collada/collada.h"
+
+static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+ if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+ char filepath[FILE_MAX];
+
+ if (G.main->name[0] == 0)
+ BLI_strncpy(filepath, "untitled", sizeof(filepath));
+ else
+ BLI_strncpy(filepath, G.main->name, sizeof(filepath));
+
+ BLI_replace_extension(filepath, sizeof(filepath), ".dae");
+ RNA_string_set(op->ptr, "filepath", filepath);
+ }
+
+ WM_event_add_fileselect(C, op);
+
+ return OPERATOR_RUNNING_MODAL;
+}
+
+/* function used for WM_OT_save_mainfile too */
+static int wm_collada_export_exec(bContext *C, wmOperator *op)
+{
+ char filepath[FILE_MAX];
+ int apply_modifiers;
+ int export_mesh_type;
+ int selected;
+ int include_children;
+ int include_armatures;
+ int deform_bones_only;
+ int use_object_instantiation;
+ int sort_by_name;
+ int second_life;
+
+ if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+ BKE_report(op->reports, RPT_ERROR, "No filename given");
+ return OPERATOR_CANCELLED;
+ }
+
+ RNA_string_get(op->ptr, "filepath", filepath);
+ BLI_ensure_extension(filepath, sizeof(filepath), ".dae");
+
+ /* Options panel */
+ apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
+ export_mesh_type = RNA_enum_get(op->ptr, "export_mesh_type_selection");
+ selected = RNA_boolean_get(op->ptr, "selected");
+ include_children = RNA_boolean_get(op->ptr, "include_children");
+ include_armatures = RNA_boolean_get(op->ptr, "include_armatures");
+ deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only");
+ use_object_instantiation = RNA_boolean_get(op->ptr, "use_object_instantiation");
+ sort_by_name = RNA_boolean_get(op->ptr, "sort_by_name");
+ second_life = RNA_boolean_get(op->ptr, "second_life");
+
+ /* get editmode results */
+ ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
+
+ if (collada_export(
+ CTX_data_scene(C),
+ filepath,
+ apply_modifiers,
+ export_mesh_type,
+ selected,
+ include_children,
+ include_armatures,
+ deform_bones_only,
+ use_object_instantiation,
+ sort_by_name,
+ second_life)) {
+ return OPERATOR_FINISHED;
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
+}
+
+void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
+{
+ uiLayout *box, *row, *col, *sub, *split;
+
+ /* Export Options: */
+ box = uiLayoutBox(layout);
+ row = uiLayoutRow(box, 0);
+ uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA);
+
+ row = uiLayoutRow(box, 0);
+ col = uiLayoutColumn(row, 0);
+ split = uiLayoutSplit(col, 0.5f, 0);
+ uiItemR(split, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
+ sub = uiLayoutRow(split, 0);
+ uiItemR(sub, imfptr, "export_mesh_type_selection", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE);
+ uiLayoutSetEnabled(sub, RNA_boolean_get(imfptr, "apply_modifiers"));
+
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, imfptr, "selected", 0, NULL, ICON_NONE);
+
+ row = uiLayoutRow(box, 0);
+ col = uiLayoutColumn(row, 0);
+ split = uiLayoutSplit(col, 0.1f, 0);
+ sub = uiLayoutRow(split, 0);
+ uiItemR(split, imfptr, "include_children", 0, NULL, ICON_NONE);
+ uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
+
+ row = uiLayoutRow(box, 0);
+ col = uiLayoutColumn(row, 0);
+ split = uiLayoutSplit(col, 0.1f, 0);
+ sub = uiLayoutRow(split, 0);
+ uiItemR(split, imfptr, "include_armatures", 0, NULL, ICON_NONE);
+ uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
+
+
+ // Armature options
+ box = uiLayoutBox(layout);
+ row = uiLayoutRow(box, 0);
+ uiItemL(row, IFACE_("Armature Options:"), ICON_ARMATURE_DATA);
+
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, imfptr, "deform_bones_only", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, imfptr, "second_life", 0, NULL, ICON_NONE);
+
+ /* Collada options: */
+ box = uiLayoutBox(layout);
+ row = uiLayoutRow(box, 0);
+ uiItemL(row, IFACE_("Collada Options:"), ICON_MODIFIER);
+
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, imfptr, "use_object_instantiation", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(box, 0);
+ uiItemR(row, imfptr, "sort_by_name", 0, NULL, ICON_NONE);
+
+}
+
+static void wm_collada_export_draw(bContext *UNUSED(C), wmOperator *op)
+{
+ PointerRNA ptr;
+
+ RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
+ uiCollada_exportSettings(op->layout, &ptr);
+}
+
+void WM_OT_collada_export(wmOperatorType *ot)
+{
+ static EnumPropertyItem prop_bc_export_mesh_type[] = {
+ {BC_MESH_TYPE_VIEW, "view", 0, "View", "Apply modifier's view settings"},
+ {BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ ot->name = "Export COLLADA";
+ ot->description = "Save a Collada file";
+ ot->idname = "WM_OT_collada_export";
+
+ ot->invoke = wm_collada_export_invoke;
+ ot->exec = wm_collada_export_exec;
+ ot->poll = WM_operator_winactive;
+
+ ot->flag |= OPTYPE_PRESET;
+
+ ot->ui = wm_collada_export_draw;
+
+ WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+
+ RNA_def_boolean(ot->srna, "apply_modifiers", 0, "Apply Modifiers",
+ "Apply modifiers");
+
+ RNA_def_int(ot->srna, "export_mesh_type", 0, INT_MIN, INT_MAX,
+ "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX);
+
+ RNA_def_enum(ot->srna, "export_mesh_type_selection", prop_bc_export_mesh_type, 0,
+ "Resolution", "Modifier resolution for export");
+
+ RNA_def_boolean(ot->srna, "selected", 0, "Selection Only",
+ "Export only selected elements");
+
+ RNA_def_boolean(ot->srna, "include_children", 0, "Include Children",
+ "Export all children of selected objects (even if not selected)");
+
+ RNA_def_boolean(ot->srna, "include_armatures", 0, "Include Armatures",
+ "Export related armatures (even if not selected)");
+
+ RNA_def_boolean(ot->srna, "deform_bones_only", 0, "Deform Bones only",
+ "Only export deforming bones with armatures");
+
+
+ RNA_def_boolean(ot->srna, "use_object_instantiation", 1, "Use Object Instances",
+ "Instantiate multiple Objects from same Data");
+
+ RNA_def_boolean(ot->srna, "sort_by_name", 0, "Sort by Object name",
+ "Sort exported data by Object name");
+
+ RNA_def_boolean(ot->srna, "second_life", 0, "Export for Second Life",
+ "Compatibility mode for Second Life");
+}
+
+
+/* function used for WM_OT_save_mainfile too */
+static int wm_collada_import_exec(bContext *C, wmOperator *op)
+{
+ char filename[FILE_MAX];
+
+ if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+ BKE_report(op->reports, RPT_ERROR, "No filename given");
+ return OPERATOR_CANCELLED;
+ }
+
+ RNA_string_get(op->ptr, "filepath", filename);
+ if (collada_import(C, filename)) return OPERATOR_FINISHED;
+
+ BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document. Please see console for error log.");
+
+ return OPERATOR_FINISHED;
+}
+
+void WM_OT_collada_import(wmOperatorType *ot)
+{
+ ot->name = "Import COLLADA";
+ ot->description = "Load a Collada file";
+ ot->idname = "WM_OT_collada_import";
+
+ ot->invoke = WM_operator_filesel;
+ ot->exec = wm_collada_import_exec;
+ ot->poll = WM_operator_winactive;
+
+ WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+}
+#endif
diff --git a/source/blender/editors/io/io_collada.h b/source/blender/editors/io/io_collada.h
new file mode 100644
index 00000000000..5cb255e1b7c
--- /dev/null
+++ b/source/blender/editors/io/io_collada.h
@@ -0,0 +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) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editor/io/io_collada.h
+ * \ingroup editor/io
+ */
+
+#ifndef __IO_COLLADA_H__
+#define __IO_COLLADA_H__
+
+struct wmOperatorType;
+
+void WM_OT_collada_export(struct wmOperatorType *ot);
+void WM_OT_collada_import(struct wmOperatorType *ot);
+
+#endif
diff --git a/source/blender/editors/io/io_ops.c b/source/blender/editors/io/io_ops.c
new file mode 100644
index 00000000000..b724db6e737
--- /dev/null
+++ b/source/blender/editors/io/io_ops.c
@@ -0,0 +1,44 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/io/io_ops.c
+ * \ingroup collada
+ */
+
+
+#include "io_collada.h"
+
+#include "WM_types.h"
+#include "WM_api.h"
+
+void ED_operatortypes_io(void)
+{
+#ifdef WITH_COLLADA
+ // Collada operators:
+ WM_operatortype_append(WM_OT_collada_export);
+ WM_operatortype_append(WM_OT_collada_import);
+#endif
+}
diff --git a/source/blender/editors/io/io_ops.h b/source/blender/editors/io/io_ops.h
new file mode 100644
index 00000000000..1e2c4443e43
--- /dev/null
+++ b/source/blender/editors/io/io_ops.h
@@ -0,0 +1,36 @@
+/*
+ * ***** 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) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editor/io/io_collada.h
+ * \ingroup editor/io
+ */
+
+#ifndef __IO_OPS_H__
+#define __IO_OPS_H__
+
+void ED_operatortypes_io(void);
+
+#endif
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 5ad663b92d3..908c0a6f4f2 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1752,6 +1752,7 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot)
RNA_def_enum(ot->srna, "operation", game_properties_copy_operations, 3, "Operation", "");
prop = RNA_def_enum(ot->srna, "property", gameprops_items, 0, "Property", "Properties to copy");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_enum_funcs(prop, gameprops_itemf);
ot->prop = prop;
}
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 0a9944debe1..e85f47837ef 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -102,7 +102,7 @@ void make_editLatt(Object *obedit)
if (lt->dvert) {
int tot = lt->pntsu * lt->pntsv * lt->pntsw;
- lt->editlatt->latt->dvert = MEM_mallocN(sizeof (MDeformVert) * tot, "Lattice MDeformVert");
+ lt->editlatt->latt->dvert = MEM_mallocN(sizeof(MDeformVert) * tot, "Lattice MDeformVert");
copy_dverts(lt->editlatt->latt->dvert, lt->dvert, tot);
}
@@ -162,7 +162,7 @@ void load_editLatt(Object *obedit)
if (editlt->dvert) {
tot = lt->pntsu * lt->pntsv * lt->pntsw;
- lt->dvert = MEM_mallocN(sizeof (MDeformVert) * tot, "Lattice MDeformVert");
+ lt->dvert = MEM_mallocN(sizeof(MDeformVert) * tot, "Lattice MDeformVert");
copy_dverts(lt->dvert, editlt->dvert, tot);
}
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 4e98d2ae967..55fb130e2c0 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1175,7 +1175,7 @@ static int area_split_menu_init(bContext *C, wmOperator *op)
sAreaSplitData *sd;
/* custom data */
- sd = (sAreaSplitData *)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
+ sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split");
op->customdata = sd;
sd->sarea = CTX_wm_area(C);
@@ -1210,7 +1210,7 @@ static int area_split_init(bContext *C, wmOperator *op)
if (dir == 'h' && sa->winy < 2 * areaminy) return 0;
/* custom data */
- sd = (sAreaSplitData *)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
+ sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split");
op->customdata = sd;
sd->sarea = sa;
@@ -2180,7 +2180,7 @@ static int area_join_init(bContext *C, wmOperator *op)
return 0;
}
- jd = (sAreaJoinData *)MEM_callocN(sizeof (sAreaJoinData), "op_area_join");
+ jd = (sAreaJoinData *)MEM_callocN(sizeof(sAreaJoinData), "op_area_join");
jd->sa1 = sa1;
jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 4dee83dbb82..b0867608840 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5096,8 +5096,8 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event)
/* This can be removed once fixed properly in
* BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user)
- * at zero pressure we should do nothing 1/2^12 is .0002 which is the sensitivity of the most sensitive pen tablet available */
- if (tablet && (pressure < .0002f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || BKE_brush_use_alpha_pressure(scene, pop->s.brush) || BKE_brush_use_size_pressure(scene, pop->s.brush)))
+ * at zero pressure we should do nothing 1/2^12 is 0.0002 which is the sensitivity of the most sensitive pen tablet available */
+ if (tablet && (pressure < 0.0002f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || BKE_brush_use_alpha_pressure(scene, pop->s.brush) || BKE_brush_use_size_pressure(scene, pop->s.brush)))
return;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index d233c45a230..f327f67be33 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -269,7 +269,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
SculptSession *ss = ob->sculpt;
SculptUndoNode *unode;
MultiresModifierData *mmd;
- int update = 0, rebuild = 1;
+ int update = FALSE, rebuild = FALSE;
sculpt_update_mesh_elements(scene, sd, ob, 0);
@@ -297,15 +297,15 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
switch (unode->type) {
case SCULPT_UNDO_COORDS:
if (sculpt_undo_restore_coords(C, dm, unode))
- update = 1;
+ update = TRUE;
break;
case SCULPT_UNDO_HIDDEN:
if (sculpt_undo_restore_hidden(C, dm, unode))
- rebuild = 1;
+ rebuild = TRUE;
break;
case SCULPT_UNDO_MASK:
if (sculpt_undo_restore_mask(C, dm, unode))
- update = 1;
+ update = TRUE;
break;
}
}
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt
index 137cda9c285..0abdd134046 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_api/CMakeLists.txt
@@ -20,6 +20,7 @@
set(INC
../include
+ ../io
../../blenkernel
../../blenlib
../../blenloader
diff --git a/source/blender/editors/space_api/SConscript b/source/blender/editors/space_api/SConscript
index 6bf901cf8ad..9b818b074ba 100644
--- a/source/blender/editors/space_api/SConscript
+++ b/source/blender/editors/space_api/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../blenloader ../../makesdna'
+incs = '../include ../io ../../blenlib ../../blenkernel ../../blenloader ../../makesdna'
incs += ' ../../windowmanager ../../python ../../makesrna ../../bmesh'
incs += ' #/intern/guardedalloc #/extern/glew/include'
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index fa77249a7a1..d8d664eea22 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -64,6 +64,8 @@
#include "ED_clip.h"
#include "ED_mask.h"
+#include "io_ops.h"
+
/* only call once on startup, storage is global in BKE kernel listbase */
void ED_spacetypes_init(void)
{
@@ -113,6 +115,7 @@ void ED_spacetypes_init(void)
ED_operatortypes_render();
ED_operatortypes_logic();
ED_operatortypes_mask();
+ ED_operatortypes_io();
UI_view2d_operatortypes();
UI_buttons_operatortypes();
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index e102abeecf0..33229496d0b 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -333,6 +333,9 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
buttons_area_redraw(sa, BCONTEXT_DATA);
sbuts->preview = 1;
break;
+ case NC_GROUP:
+ buttons_area_redraw(sa, BCONTEXT_OBJECT);
+ break;
case NC_BRUSH:
buttons_area_redraw(sa, BCONTEXT_TEXTURE);
break;
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index ec709443cfb..f5d1f132b56 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -811,6 +811,11 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
}
if ((sc->flag & SC_SHOW_MARKER_PATTERN) && ((track->pat_flag & SELECT) == sel || outline)) {
+ int i;
+ float pat_min[2], pat_max[2];
+/* float dx = 12.0f / width, dy = 12.0f / height;*/ /* XXX UNUSED */
+ float tilt_ctrl[2];
+
if (!outline) {
if (track->pat_flag & SELECT)
glColor3fv(scol);
@@ -818,26 +823,47 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
glColor3fv(col);
}
- /* XXX: need to be real check if affine tracking is enabled, but for now not
- * sure how to do this, so assume affine tracker is always enabled */
- if (TRUE) {
- int i;
-
- /* pattern's corners sliding squares */
- for (i = 0; i < 4; i++) {
- draw_marker_slide_square(marker->pattern_corners[i][0], marker->pattern_corners[i][1],
- patdx / 1.5f, patdy / 1.5f, outline, px);
- }
+ /* pattern's corners sliding squares */
+ for (i = 0; i < 4; i++) {
+ draw_marker_slide_square(marker->pattern_corners[i][0], marker->pattern_corners[i][1],
+ patdx / 1.5f, patdy / 1.5f, outline, px);
}
- else {
- /* pattern offset square */
- draw_marker_slide_square(marker->pattern_corners[3][0], marker->pattern_corners[3][1],
- patdx, patdy, outline, px);
- /* pattern re-sizing triangle */
- draw_marker_slide_triangle(marker->pattern_corners[1][0], marker->pattern_corners[1][1],
- patdx, patdy, outline, px);
- }
+ /* ** sliders to control overall pattern ** */
+ add_v2_v2v2(tilt_ctrl, marker->pattern_corners[1], marker->pattern_corners[2]);
+
+ BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max);
+
+ glEnable(GL_LINE_STIPPLE);
+ glLineStipple(3, 0xaaaa);
+
+#if 0
+ /* TODO: disable for now, needs better approach visualizing this */
+
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(pat_min[0] - dx, pat_min[1] - dy);
+ glVertex2f(pat_max[0] + dx, pat_min[1] - dy);
+ glVertex2f(pat_max[0] + dx, pat_max[1] + dy);
+ glVertex2f(pat_min[0] - dx, pat_max[1] + dy);
+ glEnd();
+
+ /* marker's offset slider */
+ draw_marker_slide_square(pat_min[0] - dx, pat_max[1] + dy, patdx, patdy, outline, px);
+
+ /* pattern re-sizing triangle */
+ draw_marker_slide_triangle(pat_max[0] + dx, pat_min[1] - dy, patdx, patdy, outline, px);
+#endif
+
+ glBegin(GL_LINES);
+ glVertex2f(0.0f, 0.0f);
+ glVertex2fv(tilt_ctrl);
+ glEnd();
+
+ glDisable(GL_LINE_STIPPLE);
+
+
+ /* slider to control pattern tilt */
+ draw_marker_slide_square(tilt_ctrl[0], tilt_ctrl[1], patdx, patdy, outline, px);
}
glPopMatrix();
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 69c2101d0f7..e4af24040a5 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -249,24 +249,35 @@ void CLIP_OT_delete_marker(wmOperatorType *ot)
/********************** slide marker operator *********************/
-#define SLIDE_ACTION_POS 0
-#define SLIDE_ACTION_SIZE 1
-#define SLIDE_ACTION_OFFSET 2
+#define SLIDE_ACTION_POS 0
+#define SLIDE_ACTION_SIZE 1
+#define SLIDE_ACTION_OFFSET 2
+#define SLIDE_ACTION_TILT_SIZE 3
typedef struct {
- int area, action;
+ short area, action;
MovieTrackingTrack *track;
MovieTrackingMarker *marker;
int mval[2];
int width, height;
float *min, *max, *pos, *offset, (*corners)[2];
- float smin[2], smax[2], spos[2], soff[2], scorners[4][2];
- float (*smarkers)[2];
+ float spos[2];
- int lock, accurate, scale;
+ short lock, accurate;
+
+ /* data to restore on cancel */
+ float old_search_min[2], old_search_max[2], old_pos[2], old_offset[2];
+ float old_corners[4][2];
+ float (*old_markers)[2];
} SlideMarkerData;
+static void slide_marker_tilt_slider(MovieTrackingMarker *marker, float slider[2])
+{
+ add_v2_v2v2(slider, marker->pattern_corners[1], marker->pattern_corners[2]);
+ add_v2_v2(slider, marker->pos);
+}
+
static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTrack *track,
MovieTrackingMarker *marker, wmEvent *event,
int area, int corner, int action, int width, int height)
@@ -284,8 +295,6 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra
if (area == TRACK_AREA_POINT) {
data->pos = marker->pos;
data->offset = track->offset;
- copy_v2_v2(data->spos, marker->pos);
- copy_v2_v2(data->soff, track->offset);
}
else if (area == TRACK_AREA_PAT) {
if (action == SLIDE_ACTION_SIZE) {
@@ -297,36 +306,25 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra
data->pos = marker->pos;
data->offset = track->offset;
- copy_v2_v2(data->soff, track->offset);
-
- data->smarkers = MEM_callocN(sizeof(*data->smarkers) * track->markersnr, "slide marekrs");
+ data->old_markers = MEM_callocN(sizeof(*data->old_markers) * track->markersnr, "slide marekrs");
for (a = 0; a < track->markersnr; a++)
- copy_v2_v2(data->smarkers[a], track->markers[a].pos);
+ copy_v2_v2(data->old_markers[a], track->markers[a].pos);
}
else if (action == SLIDE_ACTION_POS) {
data->corners = marker->pattern_corners;
data->pos = marker->pattern_corners[corner];
-
copy_v2_v2(data->spos, data->pos);
}
+ else if (action == SLIDE_ACTION_TILT_SIZE) {
+ data->corners = marker->pattern_corners;
+ slide_marker_tilt_slider(marker, data->spos);
+ }
}
else if (area == TRACK_AREA_SEARCH) {
data->min = marker->search_min;
data->max = marker->search_max;
}
- if ((area == TRACK_AREA_SEARCH) ||
- (area == TRACK_AREA_PAT && action != SLIDE_ACTION_OFFSET))
- {
- if (data->corners) {
- memcpy(data->scorners, data->corners, sizeof(data->scorners));
- }
- else {
- copy_v2_v2(data->smin, data->min);
- copy_v2_v2(data->smax, data->max);
- }
- }
-
data->mval[0] = event->mval[0];
data->mval[1] = event->mval[1];
@@ -336,16 +334,24 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra
if (action == SLIDE_ACTION_SIZE)
data->lock = 1;
+ /* backup marker's settings */
+ memcpy(data->old_corners, marker->pattern_corners, sizeof(data->old_corners));
+ copy_v2_v2(data->old_search_min, marker->search_min);
+ copy_v2_v2(data->old_search_max, marker->search_max);
+ copy_v2_v2(data->old_pos, marker->pos);
+ copy_v2_v2(data->old_offset, track->offset);
+
return data;
}
-static int mouse_on_corner(SpaceClip *sc, MovieTrackingMarker *marker,
- int area, float co[2], int corner, int width, int height)
+static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker,
+ int area, float co[2], float slide_zone[2],
+ float padding, int width, int height)
{
+ const float size = 12.0f;
int inside = 0;
- float size = 12.0f;
float min[2], max[2];
- float crn[2], dx, dy, tdx, tdy;
+ float dx, dy;
if (area == TRACK_AREA_SEARCH) {
copy_v2_v2(min, marker->search_min);
@@ -355,29 +361,52 @@ static int mouse_on_corner(SpaceClip *sc, MovieTrackingMarker *marker,
BKE_tracking_marker_pattern_minmax(marker, min, max);
}
+ min[0] -= padding / width;
+ min[1] -= padding / height;
+ max[0] += padding / width;
+ max[1] += padding / height;
+
dx = size / width / sc->zoom;
dy = size / height / sc->zoom;
- tdx = 5.0f / width / sc->zoom;
- tdy = 5.0f / height / sc->zoom;
+ dx = MIN2(dx, (max[0] - min[0]) / 6.0f);
+ dy = MIN2(dy, (max[1] - min[1]) / 6.0f);
+
+ return IN_RANGE_INCL(co[0], slide_zone[0] - dx, slide_zone[0] + dx) &&
+ IN_RANGE_INCL(co[1], slide_zone[1] - dy, slide_zone[1] + dy);
+
+ return inside;
+}
+
+static int mouse_on_corner(SpaceClip *sc, MovieTrackingMarker *marker,
+ int area, float co[2], int corner, float padding,
+ int width, int height)
+{
+ float min[2], max[2], crn[2];
+
+ if (area == TRACK_AREA_SEARCH) {
+ copy_v2_v2(min, marker->search_min);
+ copy_v2_v2(max, marker->search_max);
+ }
+ else {
+ BKE_tracking_marker_pattern_minmax(marker, min, max);
+ }
- dx = MIN2(dx, (max[0] - min[0]) / 6.0f) + tdx;
- dy = MIN2(dy, (max[1] - min[1]) / 6.0f) + tdy;
+ min[0] -= padding / width;
+ min[1] -= padding / height;
+ max[0] += padding / width;
+ max[1] += padding / height;
if (corner == 0) {
crn[0] = marker->pos[0] + max[0];
crn[1] = marker->pos[1] + min[1];
-
- inside = co[0] >= crn[0] - dx && co[0] <= crn[0] + tdx && co[1] >= crn[1] - tdy && co[1] <= crn[1] + dy;
}
else {
crn[0] = marker->pos[0] + min[0];
crn[1] = marker->pos[1] + max[1];
-
- inside = co[0] >= crn[0] - dx && co[0] <= crn[0] + dx && co[1] >= crn[1] - dy && co[1] <= crn[1] + dy;
}
- return inside;
+ return mouse_on_slide_zone(sc, marker, area, co, crn, padding, width, height);
}
static int get_mouse_pattern_corner(SpaceClip *sc, MovieTrackingMarker *marker, float co[2], int width, int height)
@@ -395,11 +424,11 @@ static int get_mouse_pattern_corner(SpaceClip *sc, MovieTrackingMarker *marker,
len = MIN2(cur_len, len);
}
- dx = 6.0f / width / sc->zoom;
- dy = 6.0f / height / sc->zoom;
+ dx = 12.0f / width / sc->zoom;
+ dy = 12.0f / height / sc->zoom;
- dx = MIN2(dx * 2.0f / 3.0f, len / 6.0f);
- dy = MIN2(dy * 2.0f / 3.0f, len * width / height / 6.0f);
+ dx = MIN2(dx, len * 2.0f / 3.0f);
+ dy = MIN2(dy, len * width / height * 2.0f / 3.0f);
for (i = 0; i < 4; i++) {
float crn[2];
@@ -436,6 +465,15 @@ static int mouse_on_offset(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki
return co[0] >= pos[0] - dx && co[0] <= pos[0] + dx && co[1] >= pos[1] - dy && co[1] <= pos[1] + dy;
}
+static int mouse_on_tilt(SpaceClip *sc, MovieTrackingMarker *marker, float co[2], int width, int height)
+{
+ float slider[2];
+
+ slide_marker_tilt_slider(marker, slider);
+
+ return mouse_on_slide_zone(sc, marker, TRACK_AREA_PAT, co, slider, 0.0f, width, height);
+}
+
static int slide_check_corners(float (*corners)[2])
{
int i, next, prev;
@@ -515,12 +553,12 @@ MovieTrackingTrack *tracking_marker_check_slide(bContext *C, wmEvent *event, int
}
if (!ok && (sc->flag & SC_SHOW_MARKER_SEARCH)) {
- if (mouse_on_corner(sc, marker, TRACK_AREA_SEARCH, co, 1, width, height)) {
+ if (mouse_on_corner(sc, marker, TRACK_AREA_SEARCH, co, 1, 0.0f, width, height)) {
area = TRACK_AREA_SEARCH;
action = SLIDE_ACTION_OFFSET;
ok = TRUE;
}
- else if (mouse_on_corner(sc, marker, TRACK_AREA_SEARCH, co, 0, width, height)) {
+ else if (mouse_on_corner(sc, marker, TRACK_AREA_SEARCH, co, 0, 0.0f, width, height)) {
area = TRACK_AREA_SEARCH;
action = SLIDE_ACTION_SIZE;
ok = TRUE;
@@ -528,30 +566,34 @@ MovieTrackingTrack *tracking_marker_check_slide(bContext *C, wmEvent *event, int
}
if (!ok && (sc->flag & SC_SHOW_MARKER_PATTERN)) {
- /* XXX: need to be real check if affine tracking is enabled, but for now not
- * sure how to do this, so assume affine tracker is always enabled */
- if (TRUE) {
- int current_corner = get_mouse_pattern_corner(sc, marker, co, width, height);
+ int current_corner = get_mouse_pattern_corner(sc, marker, co, width, height);
- if (current_corner != -1) {
- area = TRACK_AREA_PAT;
- action = SLIDE_ACTION_POS;
- corner = current_corner;
- ok = TRUE;
- }
+ if (current_corner != -1) {
+ area = TRACK_AREA_PAT;
+ action = SLIDE_ACTION_POS;
+ corner = current_corner;
+ ok = TRUE;
}
else {
- if (mouse_on_corner(sc, marker, TRACK_AREA_PAT, co, 1, width, height)) {
+#if 0
+ /* TODO: disable for now, needs better approaches for visualization */
+
+ if (mouse_on_corner(sc, marker, TRACK_AREA_PAT, co, 1, 12.0f, width, height)) {
area = TRACK_AREA_PAT;
action = SLIDE_ACTION_OFFSET;
ok = TRUE;
}
-
- if (!ok && mouse_on_corner(sc, marker, TRACK_AREA_PAT, co, 0, width, height)) {
+ if (!ok && mouse_on_corner(sc, marker, TRACK_AREA_PAT, co, 0, 12.0f, width, height)) {
area = TRACK_AREA_PAT;
action = SLIDE_ACTION_SIZE;
ok = TRUE;
}
+#endif
+ if (!ok && mouse_on_tilt(sc, marker, co, width, height)) {
+ area = TRACK_AREA_PAT;
+ action = SLIDE_ACTION_TILT_SIZE;
+ ok = TRUE;
+ }
}
}
@@ -629,40 +671,27 @@ static int slide_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
static void cancel_mouse_slide(SlideMarkerData *data)
{
- /* cancel sliding */
- if (data->area == TRACK_AREA_POINT) {
- if (data->action == SLIDE_ACTION_OFFSET)
- copy_v2_v2(data->offset, data->soff);
- else
- copy_v2_v2(data->pos, data->spos);
- }
- else {
- if ((data->action == SLIDE_ACTION_SIZE) ||
- (data->action == SLIDE_ACTION_POS && data->area == TRACK_AREA_PAT))
- {
- if (data->corners) {
- memcpy(data->corners, data->scorners, sizeof(data->scorners));
- }
- else {
- copy_v2_v2(data->min, data->smin);
- copy_v2_v2(data->max, data->smax);
- }
- }
- else {
- int a;
+ MovieTrackingTrack *track = data->track;
+ MovieTrackingMarker *marker = data->marker;
- for (a = 0; a < data->track->markersnr; a++)
- copy_v2_v2(data->track->markers[a].pos, data->smarkers[a]);
+ memcpy(marker->pattern_corners, data->old_corners, sizeof(marker->pattern_corners));
+ copy_v2_v2(marker->search_min, data->old_search_min);
+ copy_v2_v2(marker->search_max, data->old_search_max);
+ copy_v2_v2(marker->pos, data->old_pos);
+ copy_v2_v2(track->offset, data->old_offset);
- copy_v2_v2(data->offset, data->soff);
- }
+ if (data->old_markers) {
+ int a;
+
+ for (a = 0; a < data->track->markersnr; a++)
+ copy_v2_v2(data->track->markers[a].pos, data->old_markers[a]);
}
}
static void free_slide_data(SlideMarkerData *data)
{
- if (data->smarkers)
- MEM_freeN(data->smarkers);
+ if (data->old_markers)
+ MEM_freeN(data->old_markers);
MEM_freeN(data);
}
@@ -682,10 +711,6 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
if (ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY))
data->lock = event->val == KM_RELEASE;
- if (data->action == SLIDE_ACTION_POS)
- if (ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY))
- data->scale = event->val == KM_PRESS;
-
if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY))
data->accurate = event->val == KM_PRESS;
@@ -709,95 +734,144 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
if (data->area == TRACK_AREA_POINT) {
if (data->action == SLIDE_ACTION_OFFSET) {
- data->offset[0] = data->soff[0] + dx;
- data->offset[1] = data->soff[1] + dy;
+ data->offset[0] = data->old_offset[0] + dx;
+ data->offset[1] = data->old_offset[1] + dy;
}
else {
- data->pos[0] = data->spos[0] + dx;
- data->pos[1] = data->spos[1] + dy;
+ data->pos[0] = data->old_pos[0] + dx;
+ data->pos[1] = data->old_pos[1] + dy;
}
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
DAG_id_tag_update(&sc->clip->id, 0);
}
- else {
+ else if (data->area == TRACK_AREA_PAT) {
if (data->action == SLIDE_ACTION_SIZE) {
- if (data->corners) {
- data->corners[0][0] = data->scorners[0][0] - dx;
- data->corners[0][1] = data->scorners[0][1] + dy;
+ float start[2], end[2];
+ float scale;
- data->corners[1][0] = data->scorners[1][0] + dx;
- data->corners[1][1] = data->scorners[1][1] + dy;
+ ED_clip_point_stable_pos(C, data->mval[0], data->mval[1], &start[0], &start[1]);
- data->corners[2][0] = data->scorners[2][0] + dx;
- data->corners[2][1] = data->scorners[2][1] - dy;
+ sub_v2_v2(start, data->old_pos);
- data->corners[3][0] = data->scorners[3][0] - dx;
- data->corners[3][1] = data->scorners[3][1] - dy;
- }
- else {
- data->min[0] = data->smin[0] - dx;
- data->max[0] = data->smax[0] + dx;
+ if (len_v2(start) > 0.0f) {
+ float mval[2];
+
+ if (data->accurate) {
+ mval[0] = data->mval[0] + (event->mval[0] - data->mval[0]) / 5.0f;
+ mval[1] = data->mval[1] + (event->mval[1] - data->mval[1]) / 5.0f;
+ }
+ else {
+ mval[0] = event->mval[0];
+ mval[1] = event->mval[1];
+ }
+
+ ED_clip_point_stable_pos(C, mval[0], mval[1], &end[0], &end[1]);
+
+ sub_v2_v2(end, data->old_pos);
- data->min[1] = data->smin[1] + dy;
- data->max[1] = data->smax[1] - dy;
+ scale = len_v2(end) / len_v2(start);
+
+ if (scale > 0.0f) {
+ int a;
+
+ for (a = 0; a < 4; a++) {
+ mul_v2_v2fl(data->corners[a], data->old_corners[a], scale);
+ }
+ }
}
- if (data->area == TRACK_AREA_SEARCH)
- BKE_tracking_marker_clamp(data->marker, CLAMP_SEARCH_DIM);
- else
- BKE_tracking_marker_clamp(data->marker, CLAMP_PAT_DIM);
+ BKE_tracking_marker_clamp(data->marker, CLAMP_PAT_DIM);
}
else if (data->action == SLIDE_ACTION_OFFSET) {
float d[2] = {dx, dy};
+ int a;
- if (data->area == TRACK_AREA_SEARCH) {
- add_v2_v2v2(data->min, data->smin, d);
- add_v2_v2v2(data->max, data->smax, d);
- }
- else {
- int a;
+ for (a = 0; a < data->track->markersnr; a++)
+ add_v2_v2v2(data->track->markers[a].pos, data->old_markers[a], d);
+
+ sub_v2_v2v2(data->offset, data->old_offset, d);
+ }
+ else if (data->action == SLIDE_ACTION_POS) {
+ float spos[2];
- for (a = 0; a < data->track->markersnr; a++)
- add_v2_v2v2(data->track->markers[a].pos, data->smarkers[a], d);
+ copy_v2_v2(spos, data->pos);
- sub_v2_v2v2(data->offset, data->soff, d);
+ data->pos[0] = data->spos[0] + dx;
+ data->pos[1] = data->spos[1] + dy;
+
+ if (!slide_check_corners(data->corners)) {
+ copy_v2_v2(data->pos, spos);
}
- if (data->area == TRACK_AREA_SEARCH)
- BKE_tracking_marker_clamp(data->marker, CLAMP_SEARCH_POS);
+ /* currently only patterns are allowed to have such combination of event and data */
+ BKE_tracking_marker_clamp(data->marker, CLAMP_PAT_DIM);
}
- else if (data->action == SLIDE_ACTION_POS) {
- if (data->scale) {
- float scale = 1.0f + 10.0f * (dx - dy);
+ else if (data->action == SLIDE_ACTION_TILT_SIZE) {
+ float start[2], end[2];
+ float scale = 1.0f, angle = 0.0f;
+ int a;
+ float mval[2];
+
+ if (data->accurate) {
+ mval[0] = data->mval[0] + (event->mval[0] - data->mval[0]) / 5.0f;
+ mval[1] = data->mval[1] + (event->mval[1] - data->mval[1]) / 5.0f;
+ }
+ else {
+ mval[0] = event->mval[0];
+ mval[1] = event->mval[1];
+ }
- if (scale > 0.0f) {
- int a;
+ sub_v2_v2v2(start, data->spos, data->old_pos);
- for (a = 0; a < 4; a++) {
- mul_v2_v2fl(data->corners[a], data->scorners[a], scale);
- }
+ ED_clip_point_stable_pos(C, mval[0], mval[1], &end[0], &end[1]);
+ sub_v2_v2(end, data->old_pos);
+
+ if (len_v2(start) > 0.0f) {
+ scale = len_v2(end) / len_v2(start);
+
+ if (scale < 0.0f) {
+ scale = 0.0;
}
}
- else {
- float spos[2];
- copy_v2_v2(spos, data->pos);
+ angle = -angle_signed_v2v2(start, end);
- /* corners might've been scaled before, restore their original position */
- memcpy(data->corners, data->scorners, sizeof(data->scorners));
+ for (a = 0; a < 4; a++) {
+ float vec[2];
- data->pos[0] = data->spos[0] + dx;
- data->pos[1] = data->spos[1] + dy;
+ mul_v2_v2fl(data->corners[a], data->old_corners[a], scale);
- if (!slide_check_corners(data->corners)) {
- copy_v2_v2(data->pos, spos);
- }
+ copy_v2_v2(vec, data->corners[a]);
+ vec[0] *= data->width;
+ vec[1] *= data->height;
+
+ data->corners[a][0] = (vec[0] * cos(angle) - vec[1] * sin(angle)) / data->width;
+ data->corners[a][1] = (vec[1] * cos(angle) + vec[0] * sin(angle)) / data->height;
}
- /* currently only patterns are allowed to have such combination of event and data */
BKE_tracking_marker_clamp(data->marker, CLAMP_PAT_DIM);
+
+ }
+ }
+ else if (data->area == TRACK_AREA_SEARCH) {
+ if (data->action == SLIDE_ACTION_SIZE) {
+ data->min[0] = data->old_search_min[0] - dx;
+ data->max[0] = data->old_search_max[0] + dx;
+
+ data->min[1] = data->old_search_min[1] + dy;
+ data->max[1] = data->old_search_max[1] - dy;
+
+ BKE_tracking_marker_clamp(data->marker, CLAMP_SEARCH_DIM);
}
+ else if (data->area == TRACK_AREA_SEARCH) {
+ float d[2] = {dx, dy};
+
+ add_v2_v2v2(data->min, data->old_search_min, d);
+ add_v2_v2v2(data->max, data->old_search_max, d);
+ }
+
+ BKE_tracking_marker_clamp(data->marker, CLAMP_SEARCH_POS);
}
data->marker->flag &= ~MARKER_TRACKED;
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 10db1bb1f12..55e75992b89 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -71,7 +71,7 @@
#include "fsmenu.h"
#include "filelist.h"
-#include "file_intern.h" // own include
+#include "file_intern.h" // own include
/* button events */
enum {
@@ -109,8 +109,8 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
{
/* Button layout. */
const int max_x = ar->winx - 10;
- const int line1_y = ar->winy - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN);
- const int line2_y = line1_y - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN);
+ const int line1_y = ar->winy - (IMASEL_BUTTONS_HEIGHT / 2 + IMASEL_BUTTONS_MARGIN);
+ const int line2_y = line1_y - (IMASEL_BUTTONS_HEIGHT / 2 + IMASEL_BUTTONS_MARGIN);
const int input_minw = 20;
const int btn_h = UI_UNIT_Y;
const int btn_fn_w = UI_UNIT_X;
@@ -123,16 +123,16 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
int loadbutton;
int fnumbuttons;
int min_x = 10;
- int chan_offs = 0;
+ int chan_offs = 0;
int available_w = max_x - min_x;
int line1_w = available_w;
int line2_w = available_w;
- uiBut* but;
- uiBlock* block;
- SpaceFile* sfile = CTX_wm_space_file(C);
- FileSelectParams* params = ED_fileselect_get_params(sfile);
- ARegion* artmp;
+ uiBut *but;
+ uiBlock *block;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ FileSelectParams *params = ED_fileselect_get_params(sfile);
+ ARegion *artmp;
/* Initialize UI block. */
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
@@ -140,7 +140,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
uiBlockSetHandleFunc(block, do_file_buttons, NULL);
/* exception to make space for collapsed region icon */
- for (artmp=CTX_wm_area(C)->regionbase.first; artmp; artmp=artmp->next) {
+ for (artmp = CTX_wm_area(C)->regionbase.first; artmp; artmp = artmp->next) {
if (artmp->regiontype == RGN_TYPE_CHANNELS && artmp->flag & RGN_FLAG_HIDDEN) {
chan_offs = 16;
min_x += chan_offs;
@@ -152,7 +152,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
loadbutton = UI_GetStringWidth(sfile->params->title) + btn_margin;
if (loadbutton < btn_minw) {
loadbutton = MAX2(btn_minw,
- btn_margin + UI_GetStringWidth(params->title));
+ btn_margin + UI_GetStringWidth(params->title));
}
if (available_w <= loadbutton + separator + input_minw || params->title[0] == 0) {
@@ -174,12 +174,12 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
/* Text input fields for directory and file. */
if (available_w > 0) {
- int overwrite_alert= file_draw_check_exists(sfile);
+ int overwrite_alert = file_draw_check_exists(sfile);
/* callbacks for operator check functions */
uiBlockSetFunc(block, file_draw_check_cb, NULL, NULL);
but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "",
- min_x, line1_y, line1_w-chan_offs, btn_h,
+ min_x, line1_y, line1_w - chan_offs, btn_h,
params->dir, 0.0, (float)FILE_MAX, 0, 0,
TIP_("File path"));
uiButSetCompleteFunc(but, autocomplete_directory, NULL);
@@ -187,9 +187,9 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
if ((params->flag & FILE_DIRSEL_ONLY) == 0) {
but = uiDefBut(block, TEX, B_FS_FILENAME, "",
- min_x, line2_y, line2_w-chan_offs, btn_h,
+ min_x, line2_y, line2_w - chan_offs, btn_h,
params->file, 0.0, (float)FILE_MAXFILE, 0, 0,
- TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name")));
+ TIP_(overwrite_alert ? N_("File name, overwrite existing") : N_("File name")));
uiButSetCompleteFunc(but, autocomplete_file, NULL);
uiButSetFlag(but, UI_BUT_NO_UTF8);
uiButClearFlag(but, UI_BUT_UNDO); /* operator button above does this automatic */
@@ -246,8 +246,8 @@ static void draw_tile(int sx, int sy, int width, int height, int colorid, int sh
static int get_file_icon(struct direntry *file)
{
if (file->type & S_IFDIR) {
- if ( strcmp(file->relname, "..") == 0) {
- return ICON_FILE_PARENT;
+ if (strcmp(file->relname, "..") == 0) {
+ return ICON_FILE_PARENT;
}
if (file->flags & BLENDERFILE) {
return ICON_FILE_BLEND;
@@ -283,7 +283,7 @@ static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon,
/*float alpha=1.0f;*/
x = sx;
- y = sy-height;
+ y = sy - height;
/*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/
@@ -292,9 +292,9 @@ static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon,
}
-static void file_draw_string(int sx, int sy, const char* string, float width, int height, short align)
+static void file_draw_string(int sx, int sy, const char *string, float width, int height, short align)
{
- uiStyle *style= UI_GetStyle();
+ uiStyle *style = UI_GetStyle();
uiFontStyle fs = style->widgetlabel;
rcti rect;
char fname[FILE_MAXFILE];
@@ -306,7 +306,7 @@ static void file_draw_string(int sx, int sy, const char* string, float width, in
/* no text clipping needed, uiStyleFontDraw does it but is a bit too strict (for buttons it works) */
rect.xmin = sx;
- rect.xmax = (int)(sx + ceil(width+4.0f));
+ rect.xmax = (int)(sx + ceil(width + 4.0f));
rect.ymin = sy - height;
rect.ymax = sy;
@@ -315,12 +315,12 @@ static void file_draw_string(int sx, int sy, const char* string, float width, in
void file_calc_previews(const bContext *C, ARegion *ar)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
- View2D *v2d= &ar->v2d;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ View2D *v2d = &ar->v2d;
ED_fileselect_init_layout(sfile, ar);
/* +SCROLL_HEIGHT is bad hack to work around issue in UI_view2d_totRect_set */
- UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height+V2D_SCROLL_HEIGHT);
+ UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height + V2D_SCROLL_HEIGHT);
}
static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int sy, ImBuf *imb, FileLayout *layout, short dropshadow)
@@ -337,13 +337,13 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
if ( (imb->x > layout->prv_w) || (imb->y > layout->prv_h) ) {
if (imb->x > imb->y) {
scaledx = (float)layout->prv_w;
- scaledy = ( (float)imb->y/(float)imb->x )*layout->prv_w;
- scale = scaledx/imb->x;
+ scaledy = ( (float)imb->y / (float)imb->x) * layout->prv_w;
+ scale = scaledx / imb->x;
}
else {
scaledy = (float)layout->prv_h;
- scaledx = ( (float)imb->x/(float)imb->y )*layout->prv_h;
- scale = scaledy/imb->y;
+ scaledx = ( (float)imb->x / (float)imb->y) * layout->prv_h;
+ scale = scaledy / imb->y;
}
}
else {
@@ -353,8 +353,8 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
}
ex = (int)scaledx;
ey = (int)scaledy;
- fx = ((float)layout->prv_w - (float)ex)/2.0f;
- fy = ((float)layout->prv_h - (float)ey)/2.0f;
+ fx = ((float)layout->prv_w - (float)ex) / 2.0f;
+ fy = ((float)layout->prv_h - (float)ey) / 2.0f;
dx = (fx + 0.5f + layout->prv_border_x);
dy = (fy + 0.5f - layout->prv_border_y);
xco = sx + (int)dx;
@@ -389,17 +389,17 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
{
- char newname[FILE_MAX+12];
- char orgname[FILE_MAX+12];
- char filename[FILE_MAX+12];
- SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
- ARegion* ar = CTX_wm_region(C);
+ char newname[FILE_MAX + 12];
+ char orgname[FILE_MAX + 12];
+ char filename[FILE_MAX + 12];
+ SpaceFile *sfile = (SpaceFile *)CTX_wm_space_data(C);
+ ARegion *ar = CTX_wm_region(C);
BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname);
BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
- if ( strcmp(orgname, newname) != 0 ) {
+ if (strcmp(orgname, newname) != 0) {
if (!BLI_exists(newname)) {
BLI_rename(orgname, newname);
/* to make sure we show what is on disk */
@@ -417,11 +417,11 @@ static void draw_background(FileLayout *layout, View2D *v2d)
int sy;
/* alternating flat shade background */
- for (i=0; (i <= layout->rows); i+=2) {
- sy = (int)v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y;
+ for (i = 0; (i <= layout->rows); i += 2) {
+ sy = (int)v2d->cur.ymax - i * (layout->tile_h + 2 * layout->tile_border_y) - layout->tile_border_y;
UI_ThemeColorShade(TH_BACK, -7);
- glRectf(v2d->cur.xmin, (float)sy, v2d->cur.xmax, (float)(sy+layout->tile_h+2*layout->tile_border_y));
+ glRectf(v2d->cur.xmin, (float)sy, v2d->cur.xmax, (float)(sy + layout->tile_h + 2 * layout->tile_border_y));
}
}
@@ -433,10 +433,10 @@ static void draw_dividers(FileLayout *layout, View2D *v2d)
/* vertical column dividers */
sx = (int)v2d->tot.xmin;
while (sx < v2d->cur.xmax) {
- sx += (layout->tile_w+2*layout->tile_border_x);
+ sx += (layout->tile_w + 2 * layout->tile_border_x);
UI_ThemeColorShade(TH_BACK, 30);
- sdrawline(sx+1, (short)(v2d->cur.ymax - layout->tile_border_y), sx+1, (short)v2d->cur.ymin);
+ sdrawline(sx + 1, (short)(v2d->cur.ymax - layout->tile_border_y), sx + 1, (short)v2d->cur.ymin);
UI_ThemeColorShade(TH_BACK, -30);
sdrawline(sx, (short)(v2d->cur.ymax - layout->tile_border_y), sx, (short)v2d->cur.ymin);
}
@@ -444,11 +444,11 @@ static void draw_dividers(FileLayout *layout, View2D *v2d)
void file_draw_list(const bContext *C, ARegion *ar)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
- FileSelectParams* params = ED_fileselect_get_params(sfile);
- FileLayout* layout= ED_fileselect_get_layout(sfile, ar);
- View2D *v2d= &ar->v2d;
- struct FileList* files = sfile->files;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ FileSelectParams *params = ED_fileselect_get_params(sfile);
+ FileLayout *layout = ED_fileselect_get_layout(sfile, ar);
+ View2D *v2d = &ar->v2d;
+ struct FileList *files = sfile->files;
struct direntry *file;
ImBuf *imb;
uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
@@ -472,7 +472,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
offset = ED_fileselect_layout_offset(layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax);
- if (offset<0) offset=0;
+ if (offset < 0) offset = 0;
numfiles_layout = ED_fileselect_layout_numfiles(layout, ar);
@@ -484,14 +484,14 @@ void file_draw_list(const bContext *C, ARegion *ar)
numfiles_layout += layout->columns;
}
- textwidth =( FILE_IMGDISPLAY == params->display) ? layout->tile_w : (int)layout->column_widths[COLUMN_NAME];
- textheight = (int)(layout->textheight*3.0/2.0 + 0.5);
+ textwidth = (FILE_IMGDISPLAY == params->display) ? layout->tile_w : (int)layout->column_widths[COLUMN_NAME];
+ textheight = (int)(layout->textheight * 3.0 / 2.0 + 0.5);
- align = ( FILE_IMGDISPLAY == params->display) ? UI_STYLE_TEXT_CENTER : UI_STYLE_TEXT_LEFT;
+ align = (FILE_IMGDISPLAY == params->display) ? UI_STYLE_TEXT_CENTER : UI_STYLE_TEXT_LEFT;
- for (i = offset; (i < numfiles) && (i<offset+numfiles_layout); i++) {
+ for (i = offset; (i < numfiles) && (i < offset + numfiles_layout); i++) {
ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
- sx += (int)(v2d->tot.xmin+2.0f);
+ sx += (int)(v2d->tot.xmin + 2.0f);
sy = (int)(v2d->tot.ymax - sy);
file = filelist_file(files, i);
@@ -503,12 +503,12 @@ void file_draw_list(const bContext *C, ARegion *ar)
if ((params->active_file == i) || (file->selflag & HILITED_FILE) || (file->selflag & SELECTED_FILE)) {
int colorid = (file->selflag & SELECTED_FILE) ? TH_HILITE : TH_BACK;
int shade = (params->active_file == i) || (file->selflag & HILITED_FILE) ? 20 : 0;
- draw_tile(sx, sy-1, layout->tile_w+4, sfile->layout->tile_h+layout->tile_border_y, colorid, shade);
+ draw_tile(sx, sy - 1, layout->tile_w + 4, sfile->layout->tile_h + layout->tile_border_y, colorid, shade);
}
}
uiSetRoundBox(UI_CNR_NONE);
- if ( FILE_IMGDISPLAY == params->display ) {
+ if (FILE_IMGDISPLAY == params->display) {
is_icon = 0;
imb = filelist_getimage(files, i);
if (!imb) {
@@ -519,26 +519,26 @@ void file_draw_list(const bContext *C, ARegion *ar)
file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE));
}
else {
- file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
+ file_draw_icon(block, file->path, sx, sy - (UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
sx += ICON_DEFAULT_WIDTH_SCALE + 4;
}
UI_ThemeColor4(TH_TEXT);
if (file->selflag & EDITING_FILE) {
- uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy-layout->tile_h-3,
- textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, "");
+ uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy - layout->tile_h - 3,
+ textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, "");
uiButSetRenameFunc(but, renamebutton_cb, file);
uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
uiButClearFlag(but, UI_BUT_UNDO);
- if ( 0 == uiButActiveOnly(C, block, but)) {
+ if (0 == uiButActiveOnly(C, block, but)) {
file->selflag &= ~EDITING_FILE;
}
}
if (!(file->selflag & EDITING_FILE)) {
int tpos = (FILE_IMGDISPLAY == params->display) ? sy - layout->tile_h + layout->textheight : sy;
- file_draw_string(sx+1, tpos, file->relname, (float)textwidth, textheight, align);
+ file_draw_string(sx + 1, tpos, file->relname, (float)textwidth, textheight, align);
}
if (params->display == FILE_SHORTDISPLAY) {
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index d3598ffd4e7..3ad6614d356 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -41,12 +41,12 @@ struct SpaceFile;
struct ARegion *file_buttons_region(struct ScrArea *sa);
/* file_draw.c */
-#define TILE_BORDER_X (UI_UNIT_X/4)
-#define TILE_BORDER_Y (UI_UNIT_Y/4)
+#define TILE_BORDER_X (UI_UNIT_X / 4)
+#define TILE_BORDER_Y (UI_UNIT_Y / 4)
/* ui geometry */
-#define IMASEL_BUTTONS_HEIGHT (UI_UNIT_Y*2)
-#define IMASEL_BUTTONS_MARGIN (UI_UNIT_Y/6)
+#define IMASEL_BUTTONS_HEIGHT (UI_UNIT_Y * 2)
+#define IMASEL_BUTTONS_MARGIN (UI_UNIT_Y / 6)
void file_draw_buttons(const bContext *C, ARegion *ar);
void file_calc_previews(const bContext *C, ARegion *ar);
@@ -98,12 +98,12 @@ void file_operator_to_sfile(struct SpaceFile *sfile, struct wmOperator *op);
/* filesel.c */
-float file_shorten_string(char* string, float w, int front);
-float file_string_width(const char* str);
+float file_shorten_string(char *string, float w, int front);
+float file_string_width(const char *str);
float file_font_pointsize(void);
void file_change_dir(bContext *C, int checkdir);
-int file_select_match(struct SpaceFile *sfile, const char *pattern);
+int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matched_file);
void autocomplete_directory(struct bContext *C, char *str, void *arg_v);
void autocomplete_file(struct bContext *C, char *str, void *arg_v);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 4bb5a21cb3d..e2fc1b64223 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -65,17 +65,17 @@
#include <ctype.h>
/* for events */
-#define NOTACTIVEFILE 0
-#define ACTIVATE 1
-#define INACTIVATE 2
+#define NOTACTIVEFILE 0
+#define ACTIVATE 1
+#define INACTIVATE 2
/* ---------- FILE SELECTION ------------ */
-static FileSelection find_file_mouse_rect(SpaceFile *sfile, struct ARegion* ar, const rcti* rect)
+static FileSelection find_file_mouse_rect(SpaceFile *sfile, struct ARegion *ar, const rcti *rect)
{
FileSelection sel;
float fxmin, fymin, fxmax, fymax;
- View2D* v2d = &ar->v2d;
+ View2D *v2d = &ar->v2d;
rcti rect_view;
UI_view2d_region_to_view(v2d, rect->xmin, rect->ymin, &fxmin, &fymin);
@@ -88,11 +88,11 @@ static FileSelection find_file_mouse_rect(SpaceFile *sfile, struct ARegion* ar,
return sel;
}
-static void file_deselect_all(SpaceFile* sfile, unsigned int flag)
+static void file_deselect_all(SpaceFile *sfile, unsigned int flag)
{
FileSelection sel;
sel.first = 0;
- sel.last = filelist_numfiles(sfile->files)-1;
+ sel.last = filelist_numfiles(sfile->files) - 1;
filelist_select(sfile->files, &sel, FILE_SEL_REMOVE, flag, CHECK_ALL);
}
@@ -103,10 +103,10 @@ typedef enum FileSelect {
FILE_SELECT_FILE = 2
} FileSelect;
-static void clamp_to_filelist(int numfiles, FileSelection* sel)
+static void clamp_to_filelist(int numfiles, FileSelection *sel)
{
/* border select before the first file */
- if ( (sel->first < 0) && (sel->last >=0 ) ) {
+ if ( (sel->first < 0) && (sel->last >= 0) ) {
sel->first = 0;
}
/* don't select if everything is outside filelist */
@@ -117,67 +117,67 @@ static void clamp_to_filelist(int numfiles, FileSelection* sel)
/* fix if last file invalid */
if ( (sel->first > 0) && (sel->last < 0) )
- sel->last = numfiles-1;
+ sel->last = numfiles - 1;
/* clamp */
if ( (sel->first >= numfiles) ) {
- sel->first = numfiles-1;
+ sel->first = numfiles - 1;
}
if ( (sel->last >= numfiles) ) {
- sel->last = numfiles-1;
+ sel->last = numfiles - 1;
}
}
-static FileSelection file_selection_get(bContext* C, const rcti* rect, short fill)
+static FileSelection file_selection_get(bContext *C, const rcti *rect, short fill)
{
- ARegion *ar= CTX_wm_region(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
+ ARegion *ar = CTX_wm_region(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
int numfiles = filelist_numfiles(sfile->files);
FileSelection sel;
sel = find_file_mouse_rect(sfile, ar, rect);
- if ( !((sel.first == -1) && (sel.last == -1)) ) {
+ if (!((sel.first == -1) && (sel.last == -1)) ) {
clamp_to_filelist(numfiles, &sel);
}
/* if desired, fill the selection up from the last selected file to the current one */
if (fill && (sel.last >= 0) && (sel.last < numfiles) ) {
- int f= sel.last;
+ int f = sel.last;
while (f >= 0) {
- if ( filelist_is_selected(sfile->files, f, CHECK_ALL) )
+ if (filelist_is_selected(sfile->files, f, CHECK_ALL) )
break;
f--;
}
if (f >= 0) {
- sel.first = f+1;
+ sel.first = f + 1;
}
}
return sel;
}
-static FileSelect file_select_do(bContext* C, int selected_idx)
+static FileSelect file_select_do(bContext *C, int selected_idx)
{
FileSelect retval = FILE_SELECT_NOTHING;
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
int numfiles = filelist_numfiles(sfile->files);
- struct direntry* file;
+ struct direntry *file;
/* make the selected file active */
- if ( (selected_idx >= 0) &&
- (selected_idx < numfiles) &&
- (file= filelist_file(sfile->files, selected_idx)))
+ if ((selected_idx >= 0) &&
+ (selected_idx < numfiles) &&
+ (file = filelist_file(sfile->files, selected_idx)))
{
params->active_file = selected_idx;
if (S_ISDIR(file->type)) {
/* the path is too long and we are not going up! */
- if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) {
+ if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX) {
// XXX error("Path too long, cannot enter this directory");
}
else {
- if (strcmp(file->relname, "..")==0) {
+ if (strcmp(file->relname, "..") == 0) {
/* avoids /../../ */
BLI_parent_dir(params->dir);
}
@@ -202,12 +202,12 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
}
-static FileSelect file_select(bContext* C, const rcti* rect, FileSelType select, short fill)
+static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select, short fill)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
FileSelect retval = FILE_SELECT_NOTHING;
- FileSelection sel= file_selection_get(C, rect, fill); /* get the selection */
- const FileCheckType check_type= (sfile->params->flag & FILE_DIRSEL_ONLY) ? CHECK_DIRS : CHECK_ALL;
+ FileSelection sel = file_selection_get(C, rect, fill); /* get the selection */
+ const FileCheckType check_type = (sfile->params->flag & FILE_DIRSEL_ONLY) ? CHECK_DIRS : CHECK_ALL;
/* flag the files as selected in the filelist */
filelist_select(sfile->files, &sel, select, SELECTED_FILE, check_type);
@@ -231,15 +231,15 @@ static FileSelect file_select(bContext* C, const rcti* rect, FileSelType select,
static int file_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
+ ARegion *ar = CTX_wm_region(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
FileSelection sel;
rcti rect;
int result;
- result= WM_border_select_modal(C, op, event);
+ result = WM_border_select_modal(C, op, event);
if (result == OPERATOR_RUNNING_MODAL) {
@@ -254,7 +254,7 @@ static int file_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
if ( (sel.first != params->sel_first) || (sel.last != params->sel_last) ) {
file_deselect_all(sfile, HILITED_FILE);
filelist_select(sfile->files, &sel, FILE_SEL_ADD, HILITED_FILE, CHECK_ALL);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
}
params->sel_first = sel.first; params->sel_last = sel.last;
@@ -263,7 +263,7 @@ static int file_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
params->active_file = -1;
params->sel_first = params->sel_last = -1;
file_deselect_all(sfile, HILITED_FILE);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
}
return result;
@@ -271,11 +271,11 @@ static int file_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
static int file_border_select_exec(bContext *C, wmOperator *op)
{
- ARegion *ar= CTX_wm_region(C);
+ ARegion *ar = CTX_wm_region(C);
rcti rect;
FileSelect ret;
- int extend= RNA_boolean_get(op->ptr, "extend");
- short select= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
+ int extend = RNA_boolean_get(op->ptr, "extend");
+ short select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
rect.xmin = RNA_int_get(op->ptr, "xmin");
rect.ymin = RNA_int_get(op->ptr, "ymin");
@@ -283,7 +283,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
rect.ymax = RNA_int_get(op->ptr, "ymax");
if (!extend) {
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
file_deselect_all(sfile, SELECTED_FILE);
}
@@ -292,10 +292,10 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, 0);
if (FILE_SELECT_DIR == ret) {
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
}
else if (FILE_SELECT_FILE == ret) {
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
}
return OPERATOR_FINISHED;
}
@@ -320,8 +320,8 @@ void FILE_OT_select_border(wmOperatorType *ot)
static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
+ ARegion *ar = CTX_wm_region(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
FileSelect ret;
rcti rect;
int extend = RNA_boolean_get(op->ptr, "extend");
@@ -341,12 +341,12 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
ret = file_select(C, &rect, extend ? FILE_SEL_TOGGLE : FILE_SEL_ADD, fill);
if (FILE_SELECT_DIR == ret)
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
else if (FILE_SELECT_FILE == ret)
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
WM_event_add_mousemove(C); /* for directory changes */
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
return OPERATOR_FINISHED;
}
@@ -369,18 +369,18 @@ void FILE_OT_select(wmOperatorType *ot)
static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op))
{
- ScrArea *sa= CTX_wm_area(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
+ ScrArea *sa = CTX_wm_area(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
FileSelection sel;
int numfiles = filelist_numfiles(sfile->files);
int i;
int is_selected = 0;
sel.first = 0;
- sel.last = numfiles-1;
+ sel.last = numfiles - 1;
/* Is any file selected ? */
- for ( i=0; i < numfiles; ++i) {
+ for (i = 0; i < numfiles; ++i) {
if (filelist_is_selected(sfile->files, i, CHECK_ALL)) {
is_selected = 1;
break;
@@ -391,7 +391,7 @@ static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op))
filelist_select(sfile->files, &sel, FILE_SEL_REMOVE, SELECTED_FILE, CHECK_ALL);
}
else {
- const FileCheckType check_type= (sfile->params->flag & FILE_DIRSEL_ONLY) ? CHECK_DIRS : CHECK_FILES;
+ const FileCheckType check_type = (sfile->params->flag & FILE_DIRSEL_ONLY) ? CHECK_DIRS : CHECK_FILES;
filelist_select(sfile->files, &sel, FILE_SEL_ADD, SELECTED_FILE, check_type);
}
ED_area_tag_redraw(sa);
@@ -418,18 +418,18 @@ void FILE_OT_select_all_toggle(wmOperatorType *ot)
static int bookmark_select_exec(bContext *C, wmOperator *op)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (RNA_struct_find_property(op->ptr, "dir")) {
char entry[256];
- FileSelectParams* params = sfile->params;
+ FileSelectParams *params = sfile->params;
RNA_string_get(op->ptr, "dir", entry);
BLI_strncpy(params->dir, entry, sizeof(params->dir));
BLI_cleanup_dir(G.main->name, params->dir);
file_change_dir(C, 1);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
}
return OPERATOR_FINISHED;
@@ -451,10 +451,10 @@ void FILE_OT_select_bookmark(wmOperatorType *ot)
static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- ScrArea *sa= CTX_wm_area(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
- struct FSMenu* fsmenu = fsmenu_get();
- struct FileSelectParams* params= ED_fileselect_get_params(sfile);
+ ScrArea *sa = CTX_wm_area(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ struct FSMenu *fsmenu = fsmenu_get();
+ struct FileSelectParams *params = ED_fileselect_get_params(sfile);
if (params->dir[0] != '\0') {
char name[FILE_MAX];
@@ -482,13 +482,13 @@ void FILE_OT_bookmark_add(wmOperatorType *ot)
static int bookmark_delete_exec(bContext *C, wmOperator *op)
{
- ScrArea *sa= CTX_wm_area(C);
- struct FSMenu* fsmenu = fsmenu_get();
+ ScrArea *sa = CTX_wm_area(C);
+ struct FSMenu *fsmenu = fsmenu_get();
int nentries = fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
if (RNA_struct_find_property(op->ptr, "index")) {
int index = RNA_int_get(op->ptr, "index");
- if ( (index >-1) && (index < nentries)) {
+ if ( (index > -1) && (index < nentries)) {
char name[FILE_MAX];
fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index);
@@ -517,16 +517,16 @@ void FILE_OT_delete_bookmark(wmOperatorType *ot)
int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
{
- View2D* v2d = &ar->v2d;
- FileSelectParams* params;
+ View2D *v2d = &ar->v2d;
+ FileSelectParams *params;
int numfiles, origfile;
- if (sfile==NULL || sfile->files==NULL) return 0;
+ if (sfile == NULL || sfile->files == NULL) return 0;
numfiles = filelist_numfiles(sfile->files);
params = ED_fileselect_get_params(sfile);
- origfile= params->active_file;
+ origfile = params->active_file;
mx -= ar->winrct.xmin;
my -= ar->winrct.ymin;
@@ -540,20 +540,20 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
active_file = ED_fileselect_layout_offset(sfile->layout, (int)(v2d->tot.xmin + fx), (int)(v2d->tot.ymax - fy));
if ((active_file >= 0) && (active_file < numfiles))
- params->active_file=active_file;
+ params->active_file = active_file;
else
- params->active_file= -1;
+ params->active_file = -1;
}
else
- params->active_file= -1;
+ params->active_file = -1;
return (params->active_file != origfile);
}
static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
+ ARegion *ar = CTX_wm_region(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (!file_hilight_set(sfile, ar, event->x, event->y))
return OPERATOR_CANCELLED;
@@ -577,7 +577,7 @@ void FILE_OT_highlight(struct wmOperatorType *ot)
int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
wmOperator *op = sfile->op;
sfile->op = NULL;
@@ -590,9 +590,9 @@ int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused))
static int file_operator_poll(bContext *C)
{
int poll = ED_operator_file_active(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
- if (!sfile || !sfile->op) poll= 0;
+ if (!sfile || !sfile->op) poll = 0;
return poll;
}
@@ -634,30 +634,45 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
* they may be already set. */
{
PointerRNA itemptr;
- PropertyRNA *prop_files= RNA_struct_find_property(op->ptr, "files");
- PropertyRNA *prop_dirs= RNA_struct_find_property(op->ptr, "dirs");
+ PropertyRNA *prop_files = RNA_struct_find_property(op->ptr, "files");
+ PropertyRNA *prop_dirs = RNA_struct_find_property(op->ptr, "dirs");
int i, numfiles = filelist_numfiles(sfile->files);
if (prop_files) {
+ int num_files = 0;
RNA_property_collection_clear(op->ptr, prop_files);
- for (i=0; i<numfiles; i++) {
+ for (i = 0; i < numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_FILES)) {
- struct direntry *file= filelist_file(sfile->files, i);
+ struct direntry *file = filelist_file(sfile->files, i);
RNA_property_collection_add(op->ptr, prop_files, &itemptr);
RNA_string_set(&itemptr, "name", file->relname);
+ num_files++;
}
}
+ /* make sure the file specified in the filename button is added even if no files selected */
+ if (0 == num_files) {
+ RNA_property_collection_add(op->ptr, prop_files, &itemptr);
+ RNA_string_set(&itemptr, "name", sfile->params->file);
+ }
}
if (prop_dirs) {
+ int num_dirs = 0;
RNA_property_collection_clear(op->ptr, prop_dirs);
- for (i=0; i<numfiles; i++) {
+ for (i = 0; i < numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_DIRS)) {
- struct direntry *file= filelist_file(sfile->files, i);
+ struct direntry *file = filelist_file(sfile->files, i);
RNA_property_collection_add(op->ptr, prop_dirs, &itemptr);
RNA_string_set(&itemptr, "name", file->relname);
+ num_dirs++;
}
}
+
+ /* make sure the directory specified in the button is added even if no directory selected */
+ if (0 == num_dirs) {
+ RNA_property_collection_add(op->ptr, prop_dirs, &itemptr);
+ RNA_string_set(&itemptr, "name", sfile->params->dir);
+ }
}
@@ -669,16 +684,16 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op)
PropertyRNA *prop;
/* If neither of the above are set, split the filepath back */
- if ((prop= RNA_struct_find_property(op->ptr, "filepath"))) {
+ if ((prop = RNA_struct_find_property(op->ptr, "filepath"))) {
char filepath[FILE_MAX];
RNA_property_string_get(op->ptr, prop, filepath);
BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file));
}
else {
- if ((prop= RNA_struct_find_property(op->ptr, "filename"))) {
+ if ((prop = RNA_struct_find_property(op->ptr, "filename"))) {
RNA_property_string_get(op->ptr, prop, sfile->params->file);
}
- if ((prop= RNA_struct_find_property(op->ptr, "directory"))) {
+ if ((prop = RNA_struct_find_property(op->ptr, "directory"))) {
RNA_property_string_get(op->ptr, prop, sfile->params->dir);
}
}
@@ -692,8 +707,8 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op)
void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
- wmOperator *op= sfile->op;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ wmOperator *op = sfile->op;
if (op) { /* fail on reload */
if (op->type->check) {
char filepath[FILE_MAX];
@@ -730,20 +745,20 @@ int file_draw_check_exists(SpaceFile *sfile)
/* sends events now, so things get handled on windowqueue level */
int file_exec(bContext *C, wmOperator *exec_op)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
char filepath[FILE_MAX];
if (sfile->op) {
- wmOperator *op= sfile->op;
+ wmOperator *op = sfile->op;
/* when used as a macro, for doubleclick,
* to prevent closing when doubleclicking on .. item */
if (RNA_boolean_get(exec_op->ptr, "need_active")) {
- int i, active=0;
+ int i, active = 0;
- for (i=0; i<filelist_numfiles(sfile->files); i++) {
+ for (i = 0; i < filelist_numfiles(sfile->files); i++) {
if (filelist_is_selected(sfile->files, i, CHECK_ALL)) {
- active=1;
+ active = 1;
break;
}
}
@@ -788,14 +803,14 @@ void FILE_OT_execute(struct wmOperatorType *ot)
int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
if (BLI_has_parent(sfile->params->dir)) {
BLI_parent_dir(sfile->params->dir);
BLI_cleanup_dir(G.main->name, sfile->params->dir);
file_change_dir(C, 0);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
}
}
@@ -819,15 +834,15 @@ void FILE_OT_parent(struct wmOperatorType *ot)
static int file_refresh_exec(bContext *C, wmOperator *UNUSED(unused))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
- struct FSMenu* fsmenu = fsmenu_get();
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ struct FSMenu *fsmenu = fsmenu_get();
ED_fileselect_clear(C, sfile);
/* refresh system directory menu */
fsmenu_refresh_system_category(fsmenu);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED;
@@ -847,7 +862,7 @@ void FILE_OT_previous(struct wmOperatorType *ot)
int file_previous_exec(bContext *C, wmOperator *UNUSED(unused))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
if (!sfile->folders_next)
@@ -859,7 +874,7 @@ int file_previous_exec(bContext *C, wmOperator *UNUSED(unused))
file_change_dir(C, 1);
}
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED;
}
@@ -878,7 +893,7 @@ void FILE_OT_next(struct wmOperatorType *ot)
int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
if (!sfile->folders_next)
sfile->folders_next = folderlist_new();
@@ -891,7 +906,7 @@ int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
file_change_dir(C, 1);
}
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED;
}
@@ -901,31 +916,31 @@ int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
- ARegion *ar, *oldar= CTX_wm_region(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ ARegion *ar, *oldar = CTX_wm_region(C);
int offset;
int numfiles, numfiles_layout;
int edit_idx = 0;
int i;
/* escape if not our timer */
- if (sfile->smoothscroll_timer==NULL || sfile->smoothscroll_timer!=event->customdata)
+ if (sfile->smoothscroll_timer == NULL || sfile->smoothscroll_timer != event->customdata)
return OPERATOR_PASS_THROUGH;
numfiles = filelist_numfiles(sfile->files);
/* check if we are editing a name */
- for (i=0; i < numfiles; ++i) {
+ for (i = 0; i < numfiles; ++i) {
if (filelist_is_selected(sfile->files, i, CHECK_ALL) ) {
- edit_idx=i;
+ edit_idx = i;
break;
}
}
/* if we are not editing, we are done */
- if (0==edit_idx) {
+ if (0 == edit_idx) {
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
- sfile->smoothscroll_timer=NULL;
+ sfile->smoothscroll_timer = NULL;
return OPERATOR_PASS_THROUGH;
}
@@ -933,21 +948,21 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
if (!ar || ar->regiontype != RGN_TYPE_WINDOW) {
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
- sfile->smoothscroll_timer=NULL;
+ sfile->smoothscroll_timer = NULL;
return OPERATOR_PASS_THROUGH;
}
offset = ED_fileselect_layout_offset(sfile->layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax);
- if (offset<0) offset=0;
+ if (offset < 0) offset = 0;
/* scroll offset is the first file in the row/column we are editing in */
if (sfile->scroll_offset == 0) {
if (sfile->layout->flag & FILE_LAYOUT_HOR) {
- sfile->scroll_offset = (edit_idx/sfile->layout->rows)*sfile->layout->rows;
+ sfile->scroll_offset = (edit_idx / sfile->layout->rows) * sfile->layout->rows;
if (sfile->scroll_offset <= offset) sfile->scroll_offset -= sfile->layout->rows;
}
else {
- sfile->scroll_offset = (edit_idx/sfile->layout->columns)*sfile->layout->columns;
+ sfile->scroll_offset = (edit_idx / sfile->layout->columns) * sfile->layout->columns;
if (sfile->scroll_offset <= offset) sfile->scroll_offset -= sfile->layout->columns;
}
}
@@ -957,7 +972,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
/* check if we have reached our final scroll position */
if ( (sfile->scroll_offset >= offset) && (sfile->scroll_offset < offset + numfiles_layout) ) {
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
- sfile->smoothscroll_timer=NULL;
+ sfile->smoothscroll_timer = NULL;
return OPERATOR_FINISHED;
}
@@ -1011,7 +1026,7 @@ void FILE_OT_smoothscroll(wmOperatorType *ot)
/* create a new, non-existing folder name, returns 1 if successful, 0 if name couldn't be created.
* The actual name is returned in 'name', 'folder' contains the complete path, including the new folder name.
*/
-static int new_folder_path(const char* parent, char *folder, char *name)
+static int new_folder_path(const char *parent, char *folder, char *name)
{
int i = 1;
int len = 0;
@@ -1021,22 +1036,22 @@ static int new_folder_path(const char* parent, char *folder, char *name)
/* check whether folder with the name already exists, in this case
* add number to the name. Check length of generated name to avoid
* crazy case of huge number of folders each named 'New Folder (x)' */
- while (BLI_exists(folder) && (len<FILE_MAXFILE)) {
+ while (BLI_exists(folder) && (len < FILE_MAXFILE)) {
len = BLI_snprintf(name, FILE_MAXFILE, "New Folder(%d)", i);
BLI_join_dirfile(folder, FILE_MAX, parent, name); /* XXX, not real length */
i++;
}
- return (len<FILE_MAXFILE);
+ return (len < FILE_MAXFILE);
}
int file_directory_new_exec(bContext *C, wmOperator *op)
{
char name[FILE_MAXFILE];
char path[FILE_MAX];
- int generate_name= 1;
+ int generate_name = 1;
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (!sfile->params) {
BKE_report(op->reports, RPT_WARNING, "No parent directory given");
@@ -1047,7 +1062,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
if (RNA_struct_find_property(op->ptr, "directory")) {
RNA_string_get(op->ptr, "directory", path);
- if (path[0] != '\0') generate_name= 0;
+ if (path[0] != '\0') generate_name = 0;
}
if (generate_name) {
@@ -1070,12 +1085,12 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE);
/* set timer to smoothly view newly generated file */
- sfile->smoothscroll_timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER1, 1.0/1000.0); /* max 30 frs/sec */
- sfile->scroll_offset=0;
+ sfile->smoothscroll_timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER1, 1.0 / 1000.0); /* max 30 frs/sec */
+ sfile->scroll_offset = 0;
/* reload dir to make sure we're seeing what's in the directory */
ED_fileselect_clear(C, sfile);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED;
}
@@ -1100,7 +1115,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot)
static void file_expand_directory(bContext *C)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
/* TODO, what about // when relbase isn't valid? */
@@ -1108,8 +1123,8 @@ static void file_expand_directory(bContext *C)
BLI_path_abs(sfile->params->dir, G.main->name);
}
else if (sfile->params->dir[0] == '~') {
- char tmpstr[sizeof(sfile->params->dir)-1];
- BLI_strncpy(tmpstr, sfile->params->dir+1, sizeof(tmpstr));
+ char tmpstr[sizeof(sfile->params->dir) - 1];
+ BLI_strncpy(tmpstr, sfile->params->dir + 1, sizeof(tmpstr));
BLI_join_dirfile(sfile->params->dir, sizeof(sfile->params->dir), BLI_getDefaultDocumentFolder(), tmpstr);
}
@@ -1125,12 +1140,12 @@ static void file_expand_directory(bContext *C)
}
/* change "C:" --> "C:\", [#28102] */
else if ( (isalpha(sfile->params->dir[0]) &&
- (sfile->params->dir[1] == ':')) &&
+ (sfile->params->dir[1] == ':')) &&
(sfile->params->dir[2] == '\0')
- ) {
- sfile->params->dir[2]= '\\';
- sfile->params->dir[3]= '\0';
+ ) {
+ sfile->params->dir[2] = '\\';
+ sfile->params->dir[3] = '\0';
}
#endif
}
@@ -1138,14 +1153,14 @@ static void file_expand_directory(bContext *C)
static int file_directory_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
file_expand_directory(C);
if (!BLI_exists(sfile->params->dir)) {
return WM_operator_confirm_message(C, op, "Create new directory?");
- }
+ }
return file_directory_exec(C, op);
}
@@ -1157,7 +1172,7 @@ static int file_directory_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
file_expand_directory(C);
@@ -1177,23 +1192,27 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
BLI_add_slash(sfile->params->dir);
file_change_dir(C, 1);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
- }
-
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
+ }
return OPERATOR_FINISHED;
}
int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
-
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ char matched_file[FILE_MAX];
if (sfile->params) {
- if (file_select_match(sfile, sfile->params->file)) {
+ matched_file[0] = '\0';
+ if (file_select_match(sfile, sfile->params->file, matched_file)) {
+ /* int i, numfiles = filelist_numfiles(sfile->files); */ /* XXX UNUSED */
sfile->params->file[0] = '\0';
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
+ /* replace the pattern (or filename that the user typed in, with the first selected file of the match */
+ BLI_strncpy(sfile->params->file, matched_file, sizeof(sfile->params->file));
+
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
}
- }
+ }
return OPERATOR_FINISHED;
}
@@ -1203,8 +1222,8 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
static int file_directory_poll(bContext *C)
{
/* sfile->files can be NULL on file load */
- SpaceFile *sfile= CTX_wm_space_file(C);
- return ED_operator_file_active(C) && (sfile->files==NULL || filelist_lib(sfile->files)==NULL);
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ return ED_operator_file_active(C) && (sfile->files == NULL || filelist_lib(sfile->files) == NULL);
}
void FILE_OT_directory(struct wmOperatorType *ot)
@@ -1234,12 +1253,12 @@ void FILE_OT_refresh(struct wmOperatorType *ot)
static int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
sfile->params->flag ^= FILE_HIDE_DOT;
ED_fileselect_clear(C, sfile);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
}
return OPERATOR_FINISHED;
@@ -1258,27 +1277,26 @@ void FILE_OT_hidedot(struct wmOperatorType *ot)
ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
}
-struct ARegion *file_buttons_region(struct ScrArea *sa)
-{
+struct ARegion *file_buttons_region(struct ScrArea *sa){
ARegion *ar, *arnew;
- for (ar= sa->regionbase.first; ar; ar= ar->next)
- if (ar->regiontype==RGN_TYPE_CHANNELS)
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
+ if (ar->regiontype == RGN_TYPE_CHANNELS)
return ar;
/* add subdiv level; after header */
- for (ar= sa->regionbase.first; ar; ar= ar->next)
- if (ar->regiontype==RGN_TYPE_HEADER)
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
+ if (ar->regiontype == RGN_TYPE_HEADER)
break;
/* is error! */
- if (ar==NULL) return NULL;
+ if (ar == NULL) return NULL;
- arnew= MEM_callocN(sizeof(ARegion), "buttons for file panels");
+ arnew = MEM_callocN(sizeof(ARegion), "buttons for file panels");
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
- arnew->regiontype= RGN_TYPE_CHANNELS;
- arnew->alignment= RGN_ALIGN_LEFT;
+ arnew->regiontype = RGN_TYPE_CHANNELS;
+ arnew->alignment = RGN_ALIGN_LEFT;
arnew->flag = RGN_FLAG_HIDDEN;
@@ -1287,8 +1305,8 @@ struct ARegion *file_buttons_region(struct ScrArea *sa)
static int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused))
{
- ScrArea *sa= CTX_wm_area(C);
- ARegion *ar= file_buttons_region(sa);
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = file_buttons_region(sa);
if (ar)
ED_region_toggle_hidden(C, ar);
@@ -1311,8 +1329,8 @@ void FILE_OT_bookmark_toggle(struct wmOperatorType *ot)
static int file_filenum_exec(bContext *C, wmOperator *op)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
- ScrArea *sa= CTX_wm_area(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ ScrArea *sa = CTX_wm_area(C);
int inc = RNA_int_get(op->ptr, "increment");
if (sfile->params && (inc != 0)) {
@@ -1343,17 +1361,17 @@ void FILE_OT_filenum(struct wmOperatorType *ot)
static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
{
- ScrArea *sa= CTX_wm_area(C);
- SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+ ScrArea *sa = CTX_wm_area(C);
+ SpaceFile *sfile = (SpaceFile *)CTX_wm_space_data(C);
if (sfile->params) {
int idx = sfile->params->active_file;
int numfiles = filelist_numfiles(sfile->files);
- if ( (0<=idx) && (idx<numfiles) ) {
- struct direntry *file= filelist_file(sfile->files, idx);
+ if ( (0 <= idx) && (idx < numfiles) ) {
+ struct direntry *file = filelist_file(sfile->files, idx);
filelist_select_file(sfile->files, idx, FILE_SEL_ADD, EDITING_FILE, CHECK_ALL);
BLI_strncpy(sfile->params->renameedit, file->relname, FILE_MAXFILE);
- sfile->params->renamefile[0]= '\0';
+ sfile->params->renamefile[0] = '\0';
}
ED_area_tag_redraw(sa);
}
@@ -1365,19 +1383,19 @@ static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
static int file_rename_poll(bContext *C)
{
int poll = ED_operator_file_active(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile && sfile->params) {
if (sfile->params->active_file < 0) {
- poll= 0;
+ poll = 0;
}
else {
char dir[FILE_MAX], group[FILE_MAX];
- if (filelist_islibrary(sfile->files, dir, group)) poll= 0;
+ if (filelist_islibrary(sfile->files, dir, group)) poll = 0;
}
}
else
- poll= 0;
+ poll = 0;
return poll;
}
@@ -1397,22 +1415,22 @@ void FILE_OT_rename(struct wmOperatorType *ot)
static int file_delete_poll(bContext *C)
{
int poll = ED_operator_file_active(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
- struct direntry* file;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ struct direntry *file;
if (sfile && sfile->params) {
if (sfile->params->active_file < 0) {
- poll= 0;
+ poll = 0;
}
else {
char dir[FILE_MAX], group[FILE_MAX];
- if (filelist_islibrary(sfile->files, dir, group)) poll= 0;
+ if (filelist_islibrary(sfile->files, dir, group)) poll = 0;
file = filelist_file(sfile->files, sfile->params->active_file);
- if (file && S_ISDIR(file->type)) poll= 0;
+ if (file && S_ISDIR(file->type)) poll = 0;
}
}
else
- poll= 0;
+ poll = 0;
return poll;
}
@@ -1420,15 +1438,15 @@ static int file_delete_poll(bContext *C)
int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
char str[FILE_MAX];
- SpaceFile *sfile= CTX_wm_space_file(C);
- struct direntry* file;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ struct direntry *file;
file = filelist_file(sfile->files, sfile->params->active_file);
BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname);
BLI_delete(str, 0, 0);
ED_fileselect_clear(C, sfile);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index a17a7edbd80..77e99a61b10 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -59,7 +59,7 @@
static void file_panel_cb(bContext *C, void *arg_entry, void *UNUSED(arg_v))
{
PointerRNA ptr;
- char *entry= (char*)arg_entry;
+ char *entry = (char *)arg_entry;
WM_operator_properties_create(&ptr, "FILE_OT_select_bookmark");
RNA_string_set(&ptr, "dir", entry);
@@ -69,15 +69,15 @@ static void file_panel_cb(bContext *C, void *arg_entry, void *UNUSED(arg_v))
static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory category, short *nr, int icon, int allow_delete, int reverse)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
uiBlock *block;
uiBut *but;
uiLayout *box, *col;
- struct FSMenu* fsmenu = fsmenu_get();
+ struct FSMenu *fsmenu = fsmenu_get();
int i, i_iter, nentries = fsmenu_get_nentries(fsmenu, category);
/* reset each time */
- *nr= -1;
+ *nr = -1;
/* hide if no entries */
if (nentries == 0)
@@ -85,24 +85,24 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
/* layout */
uiLayoutSetAlignment(pa->layout, UI_LAYOUT_ALIGN_LEFT);
- block= uiLayoutGetBlock(pa->layout);
- box= uiLayoutBox(pa->layout);
- col= uiLayoutColumn(box, 1);
+ block = uiLayoutGetBlock(pa->layout);
+ box = uiLayoutBox(pa->layout);
+ col = uiLayoutColumn(box, 1);
- for (i_iter=0; i_iter< nentries;++i_iter) {
+ for (i_iter = 0; i_iter < nentries; ++i_iter) {
char dir[FILE_MAX];
char temp[FILE_MAX];
- uiLayout* layout = uiLayoutRow(col, 0);
+ uiLayout *layout = uiLayoutRow(col, 0);
char *entry;
- i= reverse ? nentries-(i_iter+1) : i_iter;
+ i = reverse ? nentries - (i_iter + 1) : i_iter;
entry = fsmenu_get_entry(fsmenu, category, i);
/* set this list item as active if we have a match */
if (sfile->params) {
if (BLI_path_cmp(sfile->params->dir, entry) == 0) {
- *nr= i;
+ *nr = i;
}
}
@@ -118,7 +118,7 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
/* create list item */
but = uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, nr, 0, i, 0, 0, entry);
uiButSetFunc(but, file_panel_cb, entry, NULL);
- uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
+ uiButSetFlag(but, UI_ICON_LEFT | UI_TEXT_LEFT);
/* create delete button */
if (allow_delete && fsmenu_can_save(fsmenu, category, i)) {
@@ -131,7 +131,7 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
static void file_panel_system(const bContext *C, Panel *pa)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile)
file_panel_category(C, pa, FS_CATEGORY_SYSTEM, &sfile->systemnr, ICON_DISK_DRIVE, 0, 0);
@@ -139,11 +139,11 @@ static void file_panel_system(const bContext *C, Panel *pa)
static void file_panel_bookmarks(const bContext *C, Panel *pa)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
uiLayout *row;
if (sfile) {
- row= uiLayoutRow(pa->layout, 0);
+ row = uiLayoutRow(pa->layout, 0);
uiItemO(row, IFACE_("Add"), ICON_ZOOMIN, "file.bookmark_add");
uiItemL(row, NULL, ICON_NONE);
@@ -153,10 +153,10 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa)
static void file_panel_recent(const bContext *C, Panel *pa)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile) {
- if ( !(U.uiflag & USER_HIDE_RECENT) ) {
+ if (!(U.uiflag & USER_HIDE_RECENT) ) {
file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0, 1);
}
}
@@ -165,31 +165,31 @@ static void file_panel_recent(const bContext *C, Panel *pa)
static int file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
return (sfile && sfile->op);
}
static void file_panel_operator_header(const bContext *C, Panel *pa)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
- wmOperator *op= sfile->op;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ wmOperator *op = sfile->op;
BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname));
}
static int file_panel_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- const char *prop_id= RNA_property_identifier(prop);
- return !( strcmp(prop_id, "filepath") == 0 ||
- strcmp(prop_id, "directory") == 0 ||
- strcmp(prop_id, "filename") == 0
- );
+ const char *prop_id = RNA_property_identifier(prop);
+ return !(strcmp(prop_id, "filepath") == 0 ||
+ strcmp(prop_id, "directory") == 0 ||
+ strcmp(prop_id, "filename") == 0
+ );
}
static void file_panel_operator(const bContext *C, Panel *pa)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
- wmOperator *op= sfile->op;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ wmOperator *op = sfile->op;
// int empty= 1, flag;
uiBlockSetFunc(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL);
@@ -203,30 +203,30 @@ void file_panels_register(ARegionType *art)
{
PanelType *pt;
- pt= MEM_callocN(sizeof(PanelType), "spacetype file system directories");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype file system directories");
strcpy(pt->idname, "FILE_PT_system");
strcpy(pt->label, N_("System"));
- pt->draw= file_panel_system;
+ pt->draw = file_panel_system;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype file bookmarks");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype file bookmarks");
strcpy(pt->idname, "FILE_PT_bookmarks");
strcpy(pt->label, N_("Bookmarks"));
- pt->draw= file_panel_bookmarks;
+ pt->draw = file_panel_bookmarks;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype file recent directories");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype file recent directories");
strcpy(pt->idname, "FILE_PT_recent");
strcpy(pt->label, N_("Recent"));
- pt->draw= file_panel_recent;
+ pt->draw = file_panel_recent;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype file operator properties");
+ pt = MEM_callocN(sizeof(PanelType), "spacetype file operator properties");
strcpy(pt->idname, "FILE_PT_operator");
strcpy(pt->label, N_("Operator"));
- pt->poll= file_panel_operator_poll;
- pt->draw_header= file_panel_operator_header;
- pt->draw= file_panel_operator;
+ pt->poll = file_panel_operator_poll;
+ pt->draw_header = file_panel_operator_header;
+ pt->draw = file_panel_operator;
BLI_addtail(&art->paneltypes, pt);
}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index a535e888156..a4cf447686c 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -98,7 +98,7 @@ typedef struct ThumbnailJob {
ListBase loadimages;
short *stop;
short *do_update;
- struct FileList* filelist;
+ struct FileList *filelist;
ReportList reports;
} ThumbnailJob;
@@ -119,7 +119,7 @@ typedef struct FileList {
short hide_parent;
void (*readf)(struct FileList *);
- int (*filterf)(struct direntry* file, const char* dir, unsigned int filter, short hide_dot);
+ int (*filterf)(struct direntry *file, const char *dir, unsigned int filter, short hide_dot);
} FileList;
@@ -145,25 +145,25 @@ typedef struct FolderList {
#define SPECIAL_IMG_LOADING 10
#define SPECIAL_IMG_MAX SPECIAL_IMG_LOADING + 1
-static ImBuf* gSpecialFileImages[SPECIAL_IMG_MAX];
+static ImBuf *gSpecialFileImages[SPECIAL_IMG_MAX];
/* ******************* SORT ******************* */
static int compare_name(const void *a1, const void *a2)
{
- const struct direntry *entry1=a1, *entry2=a2;
+ const struct direntry *entry1 = a1, *entry2 = a2;
/* type is equal to stat.st_mode */
if (S_ISDIR(entry1->type)) {
- if (S_ISDIR(entry2->type)==0) return (-1);
+ if (S_ISDIR(entry2->type) == 0) return (-1);
}
else {
if (S_ISDIR(entry2->type)) return (1);
}
if (S_ISREG(entry1->type)) {
- if (S_ISREG(entry2->type)==0) return (-1);
+ if (S_ISREG(entry2->type) == 0) return (-1);
}
else {
if (S_ISREG(entry2->type)) return (1);
@@ -172,28 +172,28 @@ static int compare_name(const void *a1, const void *a2)
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
- if ( strcmp(entry1->relname, ".")==0 ) return (-1);
- if ( strcmp(entry2->relname, ".")==0 ) return (1);
- if ( strcmp(entry1->relname, "..")==0 ) return (-1);
- if ( strcmp(entry2->relname, "..")==0 ) return (1);
+ if (strcmp(entry1->relname, ".") == 0) return (-1);
+ if (strcmp(entry2->relname, ".") == 0) return (1);
+ if (strcmp(entry1->relname, "..") == 0) return (-1);
+ if (strcmp(entry2->relname, "..") == 0) return (1);
return (BLI_natstrcmp(entry1->relname, entry2->relname));
}
static int compare_date(const void *a1, const void *a2)
{
- const struct direntry *entry1=a1, *entry2=a2;
+ const struct direntry *entry1 = a1, *entry2 = a2;
/* type is equal to stat.st_mode */
if (S_ISDIR(entry1->type)) {
- if (S_ISDIR(entry2->type)==0) return (-1);
+ if (S_ISDIR(entry2->type) == 0) return (-1);
}
else {
if (S_ISDIR(entry2->type)) return (1);
}
if (S_ISREG(entry1->type)) {
- if (S_ISREG(entry2->type)==0) return (-1);
+ if (S_ISREG(entry2->type) == 0) return (-1);
}
else {
if (S_ISREG(entry2->type)) return (1);
@@ -202,31 +202,31 @@ static int compare_date(const void *a1, const void *a2)
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
- if ( strcmp(entry1->relname, ".")==0 ) return (-1);
- if ( strcmp(entry2->relname, ".")==0 ) return (1);
- if ( strcmp(entry1->relname, "..")==0 ) return (-1);
- if ( strcmp(entry2->relname, "..")==0 ) return (1);
+ if (strcmp(entry1->relname, ".") == 0) return (-1);
+ if (strcmp(entry2->relname, ".") == 0) return (1);
+ if (strcmp(entry1->relname, "..") == 0) return (-1);
+ if (strcmp(entry2->relname, "..") == 0) return (1);
- if ( entry1->s.st_mtime < entry2->s.st_mtime) return 1;
- if ( entry1->s.st_mtime > entry2->s.st_mtime) return -1;
+ if (entry1->s.st_mtime < entry2->s.st_mtime) return 1;
+ if (entry1->s.st_mtime > entry2->s.st_mtime) return -1;
else return BLI_natstrcmp(entry1->relname, entry2->relname);
}
static int compare_size(const void *a1, const void *a2)
{
- const struct direntry *entry1=a1, *entry2=a2;
+ const struct direntry *entry1 = a1, *entry2 = a2;
/* type is equal to stat.st_mode */
if (S_ISDIR(entry1->type)) {
- if (S_ISDIR(entry2->type)==0) return (-1);
+ if (S_ISDIR(entry2->type) == 0) return (-1);
}
else {
if (S_ISDIR(entry2->type)) return (1);
}
if (S_ISREG(entry1->type)) {
- if (S_ISREG(entry2->type)==0) return (-1);
+ if (S_ISREG(entry2->type) == 0) return (-1);
}
else {
if (S_ISREG(entry2->type)) return (1);
@@ -235,39 +235,39 @@ static int compare_size(const void *a1, const void *a2)
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
- if ( strcmp(entry1->relname, ".")==0 ) return (-1);
- if ( strcmp(entry2->relname, ".")==0 ) return (1);
- if ( strcmp(entry1->relname, "..")==0 ) return (-1);
- if ( strcmp(entry2->relname, "..")==0 ) return (1);
+ if (strcmp(entry1->relname, ".") == 0) return (-1);
+ if (strcmp(entry2->relname, ".") == 0) return (1);
+ if (strcmp(entry1->relname, "..") == 0) return (-1);
+ if (strcmp(entry2->relname, "..") == 0) return (1);
- if ( entry1->s.st_size < entry2->s.st_size) return 1;
- if ( entry1->s.st_size > entry2->s.st_size) return -1;
+ if (entry1->s.st_size < entry2->s.st_size) return 1;
+ if (entry1->s.st_size > entry2->s.st_size) return -1;
else return BLI_natstrcmp(entry1->relname, entry2->relname);
}
static int compare_extension(const void *a1, const void *a2)
{
- const struct direntry *entry1=a1, *entry2=a2;
+ const struct direntry *entry1 = a1, *entry2 = a2;
const char *sufix1, *sufix2;
- const char *nil="";
+ const char *nil = "";
- if (!(sufix1= strstr (entry1->relname, ".blend.gz")))
- sufix1= strrchr (entry1->relname, '.');
- if (!(sufix2= strstr (entry2->relname, ".blend.gz")))
- sufix2= strrchr (entry2->relname, '.');
- if (!sufix1) sufix1= nil;
- if (!sufix2) sufix2= nil;
+ if (!(sufix1 = strstr(entry1->relname, ".blend.gz")))
+ sufix1 = strrchr(entry1->relname, '.');
+ if (!(sufix2 = strstr(entry2->relname, ".blend.gz")))
+ sufix2 = strrchr(entry2->relname, '.');
+ if (!sufix1) sufix1 = nil;
+ if (!sufix2) sufix2 = nil;
/* type is equal to stat.st_mode */
if (S_ISDIR(entry1->type)) {
- if (S_ISDIR(entry2->type)==0) return (-1);
+ if (S_ISDIR(entry2->type) == 0) return (-1);
}
else {
if (S_ISDIR(entry2->type)) return (1);
}
if (S_ISREG(entry1->type)) {
- if (S_ISREG(entry2->type)==0) return (-1);
+ if (S_ISREG(entry2->type) == 0) return (-1);
}
else {
if (S_ISREG(entry2->type)) return (1);
@@ -276,46 +276,46 @@ static int compare_extension(const void *a1, const void *a2)
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/* make sure "." and ".." are always first */
- if ( strcmp(entry1->relname, ".")==0 ) return (-1);
- if ( strcmp(entry2->relname, ".")==0 ) return (1);
- if ( strcmp(entry1->relname, "..")==0 ) return (-1);
- if ( strcmp(entry2->relname, "..")==0 ) return (1);
+ if (strcmp(entry1->relname, ".") == 0) return (-1);
+ if (strcmp(entry2->relname, ".") == 0) return (1);
+ if (strcmp(entry1->relname, "..") == 0) return (-1);
+ if (strcmp(entry2->relname, "..") == 0) return (1);
return (BLI_strcasecmp(sufix1, sufix2));
}
-static int is_hidden_file(const char* filename, short hide_dot)
+static int is_hidden_file(const char *filename, short hide_dot)
{
- int is_hidden=0;
+ int is_hidden = 0;
if (hide_dot) {
- if (filename[0]=='.' && filename[1]!='.' && filename[1]!=0) {
- is_hidden=1; /* ignore .file */
+ if (filename[0] == '.' && filename[1] != '.' && filename[1] != 0) {
+ is_hidden = 1; /* ignore .file */
}
else if (((filename[0] == '.') && (filename[1] == 0) )) {
- is_hidden=1; /* ignore . */
+ is_hidden = 1; /* ignore . */
}
else {
- int len=strlen(filename);
- if ( (len>0) && (filename[len-1]=='~') ) {
- is_hidden=1; /* ignore file~ */
+ int len = strlen(filename);
+ if ( (len > 0) && (filename[len - 1] == '~') ) {
+ is_hidden = 1; /* ignore file~ */
}
}
}
else {
if (((filename[0] == '.') && (filename[1] == 0) )) {
- is_hidden=1; /* ignore . */
+ is_hidden = 1; /* ignore . */
}
}
return is_hidden;
}
-static int is_filtered_file(struct direntry* file, const char* UNUSED(dir), unsigned int filter, short hide_dot)
+static int is_filtered_file(struct direntry *file, const char *UNUSED(dir), unsigned int filter, short hide_dot)
{
- int is_filtered=0;
+ int is_filtered = 0;
if (filter) {
if (file->flags & filter) {
- is_filtered=1;
+ is_filtered = 1;
}
else if (file->type & S_IFDIR) {
if (filter & FOLDERFILE) {
@@ -329,9 +329,9 @@ static int is_filtered_file(struct direntry* file, const char* UNUSED(dir), unsi
return is_filtered && !is_hidden_file(file->relname, hide_dot);
}
-static int is_filtered_lib(struct direntry* file, const char* dir, unsigned int filter, short hide_dot)
+static int is_filtered_lib(struct direntry *file, const char *dir, unsigned int filter, short hide_dot)
{
- int is_filtered=0;
+ int is_filtered = 0;
char tdir[FILE_MAX], tgroup[GROUP_MAX];
if (BLO_is_a_library(dir, tdir, tgroup)) {
is_filtered = !is_hidden_file(file->relname, hide_dot);
@@ -342,12 +342,12 @@ static int is_filtered_lib(struct direntry* file, const char* dir, unsigned int
return is_filtered;
}
-static int is_filtered_main(struct direntry* file, const char* UNUSED(dir), unsigned int UNUSED(filter), short hide_dot)
+static int is_filtered_main(struct direntry *file, const char *UNUSED(dir), unsigned int UNUSED(filter), short hide_dot)
{
return !is_hidden_file(file->relname, hide_dot);
}
-void filelist_filter(FileList* filelist)
+void filelist_filter(FileList *filelist)
{
int num_filtered = 0;
int i, j;
@@ -358,7 +358,7 @@ void filelist_filter(FileList* filelist)
// How many files are left after filter ?
for (i = 0; i < filelist->numfiles; ++i) {
struct direntry *file = &filelist->filelist[i];
- if ( filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) {
+ if (filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) {
num_filtered++;
}
}
@@ -367,12 +367,12 @@ void filelist_filter(FileList* filelist)
MEM_freeN(filelist->fidx);
filelist->fidx = NULL;
}
- filelist->fidx = (int *)MEM_callocN(num_filtered*sizeof(int), "filteridx");
+ filelist->fidx = (int *)MEM_callocN(num_filtered * sizeof(int), "filteridx");
filelist->numfiltered = num_filtered;
- for (i = 0, j=0; i < filelist->numfiles; ++i) {
+ for (i = 0, j = 0; i < filelist->numfiles; ++i) {
struct direntry *file = &filelist->filelist[i];
- if ( filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) {
+ if (filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) {
filelist->fidx[j++] = i;
}
}
@@ -386,16 +386,16 @@ void filelist_init_icons(void)
#ifdef WITH_HEADLESS
bbuf = NULL;
#else
- bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_prvicons, datatoc_prvicons_size, IB_rect, "<splash>");
+ bbuf = IMB_ibImageFromMemory((unsigned char *)datatoc_prvicons, datatoc_prvicons_size, IB_rect, "<splash>");
#endif
if (bbuf) {
- for (y=0; y<SPECIAL_IMG_ROWS; y++) {
- for (x=0; x<SPECIAL_IMG_COLS; x++) {
- int tile = SPECIAL_IMG_COLS*y + x;
+ for (y = 0; y < SPECIAL_IMG_ROWS; y++) {
+ for (x = 0; x < SPECIAL_IMG_COLS; x++) {
+ int tile = SPECIAL_IMG_COLS * y + x;
if (tile < SPECIAL_IMG_MAX) {
ibuf = IMB_allocImBuf(SPECIAL_IMG_SIZE, SPECIAL_IMG_SIZE, 32, IB_rect);
- for (k=0; k<SPECIAL_IMG_SIZE; k++) {
- memcpy(&ibuf->rect[k*SPECIAL_IMG_SIZE], &bbuf->rect[(k+y*SPECIAL_IMG_SIZE)*SPECIAL_IMG_SIZE*SPECIAL_IMG_COLS+x*SPECIAL_IMG_SIZE], SPECIAL_IMG_SIZE*sizeof(int));
+ for (k = 0; k < SPECIAL_IMG_SIZE; k++) {
+ memcpy(&ibuf->rect[k * SPECIAL_IMG_SIZE], &bbuf->rect[(k + y * SPECIAL_IMG_SIZE) * SPECIAL_IMG_SIZE * SPECIAL_IMG_COLS + x * SPECIAL_IMG_SIZE], SPECIAL_IMG_SIZE * sizeof(int));
}
gSpecialFileImages[tile] = ibuf;
}
@@ -408,20 +408,20 @@ void filelist_init_icons(void)
void filelist_free_icons(void)
{
int i;
- for (i=0; i < SPECIAL_IMG_MAX; ++i) {
+ for (i = 0; i < SPECIAL_IMG_MAX; ++i) {
IMB_freeImBuf(gSpecialFileImages[i]);
gSpecialFileImages[i] = NULL;
}
}
//-----------------FOLDERLIST (previous/next) --------------//
-struct ListBase* folderlist_new(void)
+ListBase *folderlist_new(void)
{
- ListBase* p = MEM_callocN(sizeof(ListBase), "folderlist" );
+ ListBase *p = MEM_callocN(sizeof(ListBase), "folderlist");
return p;
}
-void folderlist_popdir(struct ListBase* folderlist, char *dir)
+void folderlist_popdir(struct ListBase *folderlist, char *dir)
{
const char *prev_dir;
struct FolderList *folder;
@@ -441,21 +441,21 @@ void folderlist_popdir(struct ListBase* folderlist, char *dir)
// delete the folder next or use setdir directly before PREVIOUS OP
}
-void folderlist_pushdir(ListBase* folderlist, const char *dir)
+void folderlist_pushdir(ListBase *folderlist, const char *dir)
{
struct FolderList *folder, *previous_folder;
previous_folder = folderlist->last;
// check if already exists
if (previous_folder && previous_folder->foldername) {
- if (BLI_path_cmp(previous_folder->foldername, dir)==0) {
+ if (BLI_path_cmp(previous_folder->foldername, dir) == 0) {
return;
}
}
// create next folder element
- folder = (FolderList*)MEM_mallocN(sizeof(FolderList), "FolderList");
- folder->foldername = (char*)MEM_mallocN(sizeof(char)*(strlen(dir)+1), "foldername");
+ folder = (FolderList *)MEM_mallocN(sizeof(FolderList), "FolderList");
+ folder->foldername = (char *)MEM_mallocN(sizeof(char) * (strlen(dir) + 1), "foldername");
folder->foldername[0] = '\0';
BLI_strncpy(folder->foldername, dir, FILE_MAXDIR);
@@ -474,7 +474,7 @@ int folderlist_clear_next(struct SpaceFile *sfile)
// if previous_folder, next_folder or refresh_folder operators are executed it doesn't clear folder_next
folder = sfile->folders_prev->last;
- if ((!folder) ||(BLI_path_cmp(folder->foldername, sfile->params->dir) == 0))
+ if ((!folder) || (BLI_path_cmp(folder->foldername, sfile->params->dir) == 0))
return 0;
// eventually clear flist->folders_next
@@ -482,27 +482,27 @@ int folderlist_clear_next(struct SpaceFile *sfile)
}
/* not listbase itself */
-void folderlist_free(ListBase* folderlist)
+void folderlist_free(ListBase *folderlist)
{
if (folderlist) {
FolderList *folder;
- for (folder= folderlist->first; folder; folder= folder->next)
+ for (folder = folderlist->first; folder; folder = folder->next)
MEM_freeN(folder->foldername);
BLI_freelistN(folderlist);
}
}
-ListBase *folderlist_duplicate(ListBase* folderlist)
+ListBase *folderlist_duplicate(ListBase *folderlist)
{
if (folderlist) {
- ListBase *folderlistn= MEM_callocN(sizeof(ListBase), "copy folderlist");
+ ListBase *folderlistn = MEM_callocN(sizeof(ListBase), "copy folderlist");
FolderList *folder;
BLI_duplicatelist(folderlistn, folderlist);
- for (folder= folderlistn->first; folder; folder= folder->next) {
- folder->foldername= MEM_dupallocN(folder->foldername);
+ for (folder = folderlistn->first; folder; folder = folder->next) {
+ folder->foldername = MEM_dupallocN(folder->foldername);
}
return folderlistn;
}
@@ -510,14 +510,14 @@ ListBase *folderlist_duplicate(ListBase* folderlist)
}
-static void filelist_read_main(struct FileList* filelist);
-static void filelist_read_library(struct FileList* filelist);
-static void filelist_read_dir(struct FileList* filelist);
+static void filelist_read_main(struct FileList *filelist);
+static void filelist_read_library(struct FileList *filelist);
+static void filelist_read_dir(struct FileList *filelist);
//------------------FILELIST------------------------//
-struct FileList* filelist_new(short type)
+FileList *filelist_new(short type)
{
- FileList* p = MEM_callocN(sizeof(FileList), "filelist" );
+ FileList *p = MEM_callocN(sizeof(FileList), "filelist");
switch (type) {
case FILE_MAIN:
p->readf = filelist_read_main;
@@ -536,7 +536,7 @@ struct FileList* filelist_new(short type)
}
-void filelist_free(struct FileList* filelist)
+void filelist_free(struct FileList *filelist)
{
int i;
@@ -570,51 +570,51 @@ void filelist_free(struct FileList* filelist)
filelist->filelist = NULL;
filelist->filter = 0;
filelist->filter_glob[0] = '\0';
- filelist->numfiltered =0;
- filelist->hide_dot =0;
+ filelist->numfiltered = 0;
+ filelist->hide_dot = 0;
}
-void filelist_freelib(struct FileList* filelist)
+void filelist_freelib(struct FileList *filelist)
{
if (filelist->libfiledata)
BLO_blendhandle_close(filelist->libfiledata);
- filelist->libfiledata= NULL;
+ filelist->libfiledata = NULL;
}
-struct BlendHandle *filelist_lib(struct FileList* filelist)
+BlendHandle *filelist_lib(struct FileList *filelist)
{
return filelist->libfiledata;
}
-int filelist_numfiles(struct FileList* filelist)
+int filelist_numfiles(struct FileList *filelist)
{
return filelist->numfiltered;
}
-const char * filelist_dir(struct FileList* filelist)
+const char *filelist_dir(struct FileList *filelist)
{
return filelist->dir;
}
-void filelist_setdir(struct FileList* filelist, const char *dir)
+void filelist_setdir(struct FileList *filelist, const char *dir)
{
BLI_strncpy(filelist->dir, dir, sizeof(filelist->dir));
}
-void filelist_imgsize(struct FileList* filelist, short w, short h)
+void filelist_imgsize(struct FileList *filelist, short w, short h)
{
filelist->prv_w = w;
filelist->prv_h = h;
}
-short filelist_changed(struct FileList* filelist)
+short filelist_changed(struct FileList *filelist)
{
return filelist->changed;
}
-struct ImBuf * filelist_getimage(struct FileList* filelist, int index)
+ImBuf *filelist_getimage(struct FileList *filelist, int index)
{
- ImBuf* ibuf = NULL;
+ ImBuf *ibuf = NULL;
int fidx = 0;
if ( (index < 0) || (index >= filelist->numfiltered) ) {
return NULL;
@@ -625,10 +625,10 @@ struct ImBuf * filelist_getimage(struct FileList* filelist, int index)
return ibuf;
}
-struct ImBuf * filelist_geticon(struct FileList* filelist, int index)
+ImBuf *filelist_geticon(struct FileList *filelist, int index)
{
- ImBuf* ibuf= NULL;
- struct direntry *file= NULL;
+ ImBuf *ibuf = NULL;
+ struct direntry *file = NULL;
int fidx = 0;
if ( (index < 0) || (index >= filelist->numfiltered) ) {
return NULL;
@@ -636,7 +636,7 @@ struct ImBuf * filelist_geticon(struct FileList* filelist, int index)
fidx = filelist->fidx[index];
file = &filelist->filelist[fidx];
if (file->type & S_IFDIR) {
- if ( strcmp(filelist->filelist[fidx].relname, "..") == 0) {
+ if (strcmp(filelist->filelist[fidx].relname, "..") == 0) {
ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT];
}
else if (strcmp(filelist->filelist[fidx].relname, ".") == 0) {
@@ -675,7 +675,7 @@ struct ImBuf * filelist_geticon(struct FileList* filelist, int index)
return ibuf;
}
-struct direntry * filelist_file(struct FileList* filelist, int index)
+struct direntry *filelist_file(struct FileList *filelist, int index)
{
int fidx = 0;
@@ -687,7 +687,7 @@ struct direntry * filelist_file(struct FileList* filelist, int index)
return &filelist->filelist[fidx];
}
-int filelist_find(struct FileList* filelist, const char *filename)
+int filelist_find(struct FileList *filelist, const char *filename)
{
int index = -1;
int i;
@@ -698,7 +698,7 @@ int filelist_find(struct FileList* filelist, const char *filename)
for (i = 0; i < filelist->numfiles; ++i) {
- if ( strcmp(filelist->filelist[i].relname, filename) == 0) { /* not dealing with user input so don't need BLI_path_cmp */
+ if (strcmp(filelist->filelist[i].relname, filename) == 0) { /* not dealing with user input so don't need BLI_path_cmp */
index = i;
break;
}
@@ -713,17 +713,17 @@ int filelist_find(struct FileList* filelist, const char *filename)
return fidx;
}
-void filelist_hidedot(struct FileList* filelist, short hide)
+void filelist_hidedot(struct FileList *filelist, short hide)
{
filelist->hide_dot = hide;
}
-void filelist_setfilter(struct FileList* filelist, unsigned int filter)
+void filelist_setfilter(struct FileList *filelist, unsigned int filter)
{
filelist->filter = filter;
}
-void filelist_setfilter_types(struct FileList* filelist, const char *filter_glob)
+void filelist_setfilter_types(struct FileList *filelist, const char *filter_glob)
{
BLI_strncpy(filelist->filter_glob, filter_glob, sizeof(filelist->filter_glob));
}
@@ -731,23 +731,23 @@ void filelist_setfilter_types(struct FileList* filelist, const char *filter_glob
static int file_is_blend_backup(const char *str)
{
short a, b;
- int retval= 0;
+ int retval = 0;
- a= strlen(str);
- b= 7;
+ a = strlen(str);
+ b = 7;
- if (a==0 || b>=a);
+ if (a == 0 || b >= a) ;
else {
char *loc;
- if (a > b+1)
+ if (a > b + 1)
b++;
/* allow .blend1 .blend2 .blend32 */
- loc= BLI_strcasestr(str+a-b, ".blend");
+ loc = BLI_strcasestr(str + a - b, ".blend");
if (loc)
- retval= 1;
+ retval = 1;
}
return (retval);
@@ -801,9 +801,9 @@ static int file_extension_type(const char *relname)
int ED_file_extension_icon(const char *relname)
{
- int type= file_extension_type(relname);
+ int type = file_extension_type(relname);
- if (type == BLENDERFILE || type==BLENDERFILE_BACKUP)
+ if (type == BLENDERFILE || type == BLENDERFILE_BACKUP)
return ICON_FILE_BLEND;
else if (type == IMAGEFILE)
return ICON_FILE_IMAGE;
@@ -823,15 +823,15 @@ int ED_file_extension_icon(const char *relname)
return ICON_FILE_BLANK;
}
-static void filelist_setfiletypes(struct FileList* filelist)
+static void filelist_setfiletypes(struct FileList *filelist)
{
struct direntry *file;
int num;
- file= filelist->filelist;
+ file = filelist->filelist;
- for (num=0; num<filelist->numfiles; num++, file++) {
- file->type= file->s.st_mode; /* restore the mess below */
+ for (num = 0; num < filelist->numfiles; num++, file++) {
+ file->type = file->s.st_mode; /* restore the mess below */
/* Don't check extensions for directories */
if (file->type & S_IFDIR) {
@@ -842,21 +842,21 @@ static void filelist_setfiletypes(struct FileList* filelist)
if (filelist->filter_glob &&
BLI_testextensie_glob(file->relname, filelist->filter_glob))
{
- file->flags= OPERATORFILE;
+ file->flags = OPERATORFILE;
}
}
}
-static void filelist_read_dir(struct FileList* filelist)
+static void filelist_read_dir(struct FileList *filelist)
{
- char wdir[FILE_MAX]= "";
+ char wdir[FILE_MAX] = "";
if (!filelist) return;
filelist->fidx = NULL;
filelist->filelist = NULL;
- BLI_current_working_dir(wdir, sizeof(wdir)); /* backup cwd to restore after */
+ BLI_current_working_dir(wdir, sizeof(wdir)); /* backup cwd to restore after */
BLI_cleanup_dir(G.main->name, filelist->dir);
filelist->numfiles = BLI_dir_contents(filelist->dir, &(filelist->filelist));
@@ -866,13 +866,13 @@ static void filelist_read_dir(struct FileList* filelist)
filelist_filter(filelist);
}
-static void filelist_read_main(struct FileList* filelist)
+static void filelist_read_main(struct FileList *filelist)
{
if (!filelist) return;
filelist_from_main(filelist);
}
-static void filelist_read_library(struct FileList* filelist)
+static void filelist_read_library(struct FileList *filelist)
{
if (!filelist) return;
BLI_cleanup_dir(G.main->name, filelist->dir);
@@ -884,7 +884,7 @@ static void filelist_read_library(struct FileList* filelist)
BLI_make_exist(filelist->dir);
filelist_read_dir(filelist);
file = filelist->filelist;
- for (num=0; num<filelist->numfiles; num++, file++) {
+ for (num = 0; num < filelist->numfiles; num++, file++) {
if (BLO_has_bfile_extension(file->relname)) {
char name[FILE_MAX];
@@ -900,26 +900,26 @@ static void filelist_read_library(struct FileList* filelist)
}
}
-void filelist_readdir(struct FileList* filelist)
+void filelist_readdir(struct FileList *filelist)
{
filelist->readf(filelist);
}
-int filelist_empty(struct FileList* filelist)
+int filelist_empty(struct FileList *filelist)
{
return filelist->filelist == NULL;
}
-void filelist_parent(struct FileList* filelist)
+void filelist_parent(struct FileList *filelist)
{
BLI_parent_dir(filelist->dir);
BLI_make_exist(filelist->dir);
filelist_readdir(filelist);
}
-void filelist_select_file(struct FileList* filelist, int index, FileSelType select, unsigned int flag, FileCheckType check)
+void filelist_select_file(struct FileList *filelist, int index, FileSelType select, unsigned int flag, FileCheckType check)
{
- struct direntry* file = filelist_file(filelist, index);
+ struct direntry *file = filelist_file(filelist, index);
if (file != NULL) {
int check_ok = 0;
switch (check) {
@@ -950,7 +950,7 @@ void filelist_select_file(struct FileList* filelist, int index, FileSelType sele
}
}
-void filelist_select(struct FileList* filelist, FileSelection* sel, FileSelType select, unsigned int flag, FileCheckType check)
+void filelist_select(struct FileList *filelist, FileSelection *sel, FileSelType select, unsigned int flag, FileCheckType check)
{
/* select all valid files between first and last indicated */
if ( (sel->first >= 0) && (sel->first < filelist->numfiltered) && (sel->last >= 0) && (sel->last < filelist->numfiltered) ) {
@@ -961,9 +961,9 @@ void filelist_select(struct FileList* filelist, FileSelection* sel, FileSelType
}
}
-int filelist_is_selected(struct FileList* filelist, int index, FileCheckType check)
+int filelist_is_selected(struct FileList *filelist, int index, FileCheckType check)
{
- struct direntry* file = filelist_file(filelist, index);
+ struct direntry *file = filelist_file(filelist, index);
if (!file) {
return 0;
}
@@ -978,27 +978,27 @@ int filelist_is_selected(struct FileList* filelist, int index, FileCheckType che
}
}
-void filelist_sort(struct FileList* filelist, short sort)
+void filelist_sort(struct FileList *filelist, short sort)
{
switch (sort) {
- case FILE_SORT_ALPHA:
- qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_name);
- break;
- case FILE_SORT_TIME:
- qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_date);
- break;
- case FILE_SORT_SIZE:
- qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_size);
- break;
- case FILE_SORT_EXTENSION:
- qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_extension);
+ case FILE_SORT_ALPHA:
+ qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_name);
+ break;
+ case FILE_SORT_TIME:
+ qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_date);
+ break;
+ case FILE_SORT_SIZE:
+ qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_size);
+ break;
+ case FILE_SORT_EXTENSION:
+ qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_extension);
}
filelist_filter(filelist);
}
-int filelist_islibrary(struct FileList* filelist, char* dir, char* group)
+int filelist_islibrary(struct FileList *filelist, char *dir, char *group)
{
return BLO_is_a_library(filelist->dir, dir, group);
}
@@ -1009,27 +1009,27 @@ static int groupname_to_code(const char *group)
char *lslash;
BLI_strncpy(buf, group, sizeof(buf));
- lslash= BLI_last_slash(buf);
+ lslash = BLI_last_slash(buf);
if (lslash)
- lslash[0]= '\0';
+ lslash[0] = '\0';
return BKE_idcode_from_name(buf);
}
-void filelist_from_library(struct FileList* filelist)
+void filelist_from_library(struct FileList *filelist)
{
LinkNode *l, *names, *previews;
- struct ImBuf* ima;
+ struct ImBuf *ima;
int ok, i, nprevs, nnames, idcode;
char filename[FILE_MAX];
char dir[FILE_MAX], group[GROUP_MAX];
/* name test */
- ok= filelist_islibrary(filelist, dir, group);
+ ok = filelist_islibrary(filelist, dir, group);
if (!ok) {
/* free */
if (filelist->libfiledata) BLO_blendhandle_close(filelist->libfiledata);
- filelist->libfiledata= NULL;
+ filelist->libfiledata = NULL;
return;
}
@@ -1038,40 +1038,40 @@ void filelist_from_library(struct FileList* filelist)
/* there we go */
/* for the time being only read filedata when libfiledata==0 */
if (filelist->libfiledata == NULL) {
- filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
+ filelist->libfiledata = BLO_blendhandle_from_file(dir, NULL);
if (filelist->libfiledata == NULL) return;
}
- idcode= groupname_to_code(group);
+ idcode = groupname_to_code(group);
/* memory for strings is passed into filelist[i].relname
* and freed in freefilelist */
if (idcode) {
- previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode, &nprevs);
- names= BLO_blendhandle_get_datablock_names(filelist->libfiledata, idcode, &nnames);
+ previews = BLO_blendhandle_get_previews(filelist->libfiledata, idcode, &nprevs);
+ names = BLO_blendhandle_get_datablock_names(filelist->libfiledata, idcode, &nnames);
/* ugh, no rewind, need to reopen */
BLO_blendhandle_close(filelist->libfiledata);
- filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
+ filelist->libfiledata = BLO_blendhandle_from_file(dir, NULL);
}
else {
- previews= NULL;
- nprevs= 0;
- names= BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
- nnames= BLI_linklist_length(names);
+ previews = NULL;
+ nprevs = 0;
+ names = BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
+ nnames = BLI_linklist_length(names);
}
- filelist->numfiles= nnames + 1;
- filelist->filelist= malloc(filelist->numfiles * sizeof(*filelist->filelist));
+ filelist->numfiles = nnames + 1;
+ filelist->filelist = malloc(filelist->numfiles * sizeof(*filelist->filelist));
memset(filelist->filelist, 0, filelist->numfiles * sizeof(*filelist->filelist));
- filelist->filelist[0].relname= BLI_strdup("..");
+ filelist->filelist[0].relname = BLI_strdup("..");
filelist->filelist[0].type |= S_IFDIR;
- for (i=0, l= names; i<nnames; i++, l= l->next) {
- char *blockname= l->link;
+ for (i = 0, l = names; i < nnames; i++, l = l->next) {
+ char *blockname = l->link;
- filelist->filelist[i + 1].relname= BLI_strdup(blockname);
+ filelist->filelist[i + 1].relname = BLI_strdup(blockname);
if (idcode) {
filelist->filelist[i + 1].type |= S_IFREG;
}
@@ -1084,8 +1084,8 @@ void filelist_from_library(struct FileList* filelist)
printf("filelist_from_library: error, found %d items, %d previews\n", nnames, nprevs);
}
else if (previews) {
- for (i=0, l= previews; i<nnames; i++, l= l->next) {
- PreviewImage *img= l->link;
+ for (i = 0, l = previews; i < nnames; i++, l = l->next) {
+ PreviewImage *img = l->link;
if (img) {
unsigned int w = img->w[ICON_SIZE_PREVIEW];
@@ -1095,7 +1095,7 @@ void filelist_from_library(struct FileList* filelist)
/* first allocate imbuf for copying preview into it */
if (w > 0 && h > 0 && rect) {
ima = IMB_allocImBuf(w, h, 32, IB_rect);
- memcpy(ima->rect, rect, w*h*sizeof(unsigned int));
+ memcpy(ima->rect, rect, w * h * sizeof(unsigned int));
filelist->filelist[i + 1].image = ima;
filelist->filelist[i + 1].flags = IMAGEFILE;
}
@@ -1108,13 +1108,13 @@ void filelist_from_library(struct FileList* filelist)
filelist_sort(filelist, FILE_SORT_ALPHA);
- BLI_strncpy(G.main->name, filename, sizeof(filename)); // prevent G.main->name to change
+ BLI_strncpy(G.main->name, filename, sizeof(filename)); // prevent G.main->name to change
filelist->filter = 0;
filelist_filter(filelist);
}
-void filelist_hideparent(struct FileList* filelist, short hide)
+void filelist_hideparent(struct FileList *filelist, short hide)
{
filelist->hide_parent = hide;
}
@@ -1128,109 +1128,109 @@ void filelist_from_main(struct FileList *filelist)
// filelist->type = FILE_MAIN; // XXXXX TODO: add modes to filebrowser
- if (filelist->dir[0]=='/') filelist->dir[0]= 0;
+ if (filelist->dir[0] == '/') filelist->dir[0] = 0;
if (filelist->dir[0]) {
- idcode= groupname_to_code(filelist->dir);
- if (idcode==0) filelist->dir[0]= 0;
+ idcode = groupname_to_code(filelist->dir);
+ if (idcode == 0) filelist->dir[0] = 0;
}
- if ( filelist->dir[0]==0) {
+ if (filelist->dir[0] == 0) {
/* make directories */
- filelist->numfiles= 24;
- filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
+ filelist->numfiles = 24;
+ filelist->filelist = (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
- for (a=0; a<filelist->numfiles; a++) {
+ for (a = 0; a < filelist->numfiles; a++) {
memset(&(filelist->filelist[a]), 0, sizeof(struct direntry));
filelist->filelist[a].type |= S_IFDIR;
}
- filelist->filelist[0].relname= BLI_strdup("..");
- filelist->filelist[2].relname= BLI_strdup("Scene");
- filelist->filelist[3].relname= BLI_strdup("Object");
- filelist->filelist[4].relname= BLI_strdup("Mesh");
- filelist->filelist[5].relname= BLI_strdup("Curve");
- filelist->filelist[6].relname= BLI_strdup("Metaball");
- filelist->filelist[7].relname= BLI_strdup("Material");
- filelist->filelist[8].relname= BLI_strdup("Texture");
- filelist->filelist[9].relname= BLI_strdup("Image");
- filelist->filelist[10].relname= BLI_strdup("Ika");
- filelist->filelist[11].relname= BLI_strdup("Wave");
- filelist->filelist[12].relname= BLI_strdup("Lattice");
- filelist->filelist[13].relname= BLI_strdup("Lamp");
- filelist->filelist[14].relname= BLI_strdup("Camera");
- filelist->filelist[15].relname= BLI_strdup("Ipo");
- filelist->filelist[16].relname= BLI_strdup("World");
- filelist->filelist[17].relname= BLI_strdup("Screen");
- filelist->filelist[18].relname= BLI_strdup("VFont");
- filelist->filelist[19].relname= BLI_strdup("Text");
- filelist->filelist[20].relname= BLI_strdup("Armature");
- filelist->filelist[21].relname= BLI_strdup("Action");
- filelist->filelist[22].relname= BLI_strdup("NodeTree");
- filelist->filelist[23].relname= BLI_strdup("Speaker");
+ filelist->filelist[0].relname = BLI_strdup("..");
+ filelist->filelist[2].relname = BLI_strdup("Scene");
+ filelist->filelist[3].relname = BLI_strdup("Object");
+ filelist->filelist[4].relname = BLI_strdup("Mesh");
+ filelist->filelist[5].relname = BLI_strdup("Curve");
+ filelist->filelist[6].relname = BLI_strdup("Metaball");
+ filelist->filelist[7].relname = BLI_strdup("Material");
+ filelist->filelist[8].relname = BLI_strdup("Texture");
+ filelist->filelist[9].relname = BLI_strdup("Image");
+ filelist->filelist[10].relname = BLI_strdup("Ika");
+ filelist->filelist[11].relname = BLI_strdup("Wave");
+ filelist->filelist[12].relname = BLI_strdup("Lattice");
+ filelist->filelist[13].relname = BLI_strdup("Lamp");
+ filelist->filelist[14].relname = BLI_strdup("Camera");
+ filelist->filelist[15].relname = BLI_strdup("Ipo");
+ filelist->filelist[16].relname = BLI_strdup("World");
+ filelist->filelist[17].relname = BLI_strdup("Screen");
+ filelist->filelist[18].relname = BLI_strdup("VFont");
+ filelist->filelist[19].relname = BLI_strdup("Text");
+ filelist->filelist[20].relname = BLI_strdup("Armature");
+ filelist->filelist[21].relname = BLI_strdup("Action");
+ filelist->filelist[22].relname = BLI_strdup("NodeTree");
+ filelist->filelist[23].relname = BLI_strdup("Speaker");
filelist_sort(filelist, FILE_SORT_ALPHA);
}
else {
/* make files */
- idcode= groupname_to_code(filelist->dir);
+ idcode = groupname_to_code(filelist->dir);
- lb= which_libbase(G.main, idcode );
+ lb = which_libbase(G.main, idcode);
if (lb == NULL) return;
- id= lb->first;
- filelist->numfiles= 0;
+ id = lb->first;
+ filelist->numfiles = 0;
while (id) {
if (!filelist->hide_dot || id->name[2] != '.') {
filelist->numfiles++;
}
- id= id->next;
+ id = id->next;
}
/* XXXXX TODO: if databrowse F4 or append/link filelist->hide_parent has to be set */
- if (!filelist->hide_parent) filelist->numfiles+= 1;
- filelist->filelist= filelist->numfiles > 0 ? (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry)) : NULL;
+ if (!filelist->hide_parent) filelist->numfiles += 1;
+ filelist->filelist = filelist->numfiles > 0 ? (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry)) : NULL;
files = filelist->filelist;
if (!filelist->hide_parent) {
memset(&(filelist->filelist[0]), 0, sizeof(struct direntry));
- filelist->filelist[0].relname= BLI_strdup("..");
+ filelist->filelist[0].relname = BLI_strdup("..");
filelist->filelist[0].type |= S_IFDIR;
files++;
}
- id= lb->first;
- totlib= totbl= 0;
+ id = lb->first;
+ totlib = totbl = 0;
while (id) {
ok = 1;
if (ok) {
if (!filelist->hide_dot || id->name[2] != '.') {
memset(files, 0, sizeof(struct direntry));
- if (id->lib==NULL)
- files->relname= BLI_strdup(id->name+2);
+ if (id->lib == NULL)
+ files->relname = BLI_strdup(id->name + 2);
else {
- files->relname= MEM_mallocN(FILE_MAX+32, "filename for lib");
- sprintf(files->relname, "%s | %s", id->lib->name, id->name+2);
+ files->relname = MEM_mallocN(FILE_MAX + 32, "filename for lib");
+ sprintf(files->relname, "%s | %s", id->lib->name, id->name + 2);
}
files->type |= S_IFREG;
-#if 0 // XXXXX TODO show the selection status of the objects
+#if 0 // XXXXX TODO show the selection status of the objects
if (!filelist->has_func) { /* F4 DATA BROWSE */
- if (idcode==ID_OB) {
+ if (idcode == ID_OB) {
if ( ((Object *)id)->flag & SELECT) files->selflag |= SELECTED_FILE;
}
- else if (idcode==ID_SCE) {
+ else if (idcode == ID_SCE) {
if ( ((Scene *)id)->r.scemode & R_BG_RENDER) files->selflag |= SELECTED_FILE;
}
}
#endif
- files->nr= totbl+1;
- files->poin= id;
- fake= id->flag & LIB_FAKEUSER;
+ files->nr = totbl + 1;
+ files->poin = id;
+ fake = id->flag & LIB_FAKEUSER;
if (idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
files->flags |= IMAGEFILE;
}
@@ -1240,7 +1240,7 @@ void filelist_from_main(struct FileList *filelist)
else BLI_snprintf(files->extra, sizeof(files->extra), " %d", id->us);
if (id->lib) {
- if (totlib==0) firstlib= files;
+ if (totlib == 0) firstlib = files;
totlib++;
}
@@ -1249,11 +1249,11 @@ void filelist_from_main(struct FileList *filelist)
totbl++;
}
- id= id->next;
+ id = id->next;
}
/* only qsort of library blocks */
- if (totlib>1) {
+ if (totlib > 1) {
qsort(firstlib, totlib, sizeof(struct direntry), compare_name);
}
}
@@ -1263,10 +1263,10 @@ void filelist_from_main(struct FileList *filelist)
static void thumbnail_joblist_free(ThumbnailJob *tj)
{
- FileImage* limg = tj->loadimages.first;
+ FileImage *limg = tj->loadimages.first;
/* free the images not yet copied to the filelist -> these will get freed with the filelist */
- for ( ; limg; limg= limg->next) {
+ for (; limg; limg = limg->next) {
if ((limg->img) && (!limg->done)) {
IMB_freeImBuf(limg->img);
}
@@ -1276,26 +1276,26 @@ static void thumbnail_joblist_free(ThumbnailJob *tj)
static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *UNUSED(progress))
{
- ThumbnailJob *tj= tjv;
- FileImage* limg = tj->loadimages.first;
+ ThumbnailJob *tj = tjv;
+ FileImage *limg = tj->loadimages.first;
- tj->stop= stop;
- tj->do_update= do_update;
+ tj->stop = stop;
+ tj->do_update = do_update;
- while ( (*stop==0) && (limg) ) {
- if ( limg->flags & IMAGEFILE ) {
+ while ( (*stop == 0) && (limg) ) {
+ if (limg->flags & IMAGEFILE) {
limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE);
}
- else if ( limg->flags & BLENDERFILE ) {
+ else if (limg->flags & BLENDERFILE) {
limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_BLEND);
}
- else if ( limg->flags & MOVIEFILE ) {
+ else if (limg->flags & MOVIEFILE) {
limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_MOVIE);
if (!limg->img) {
- /* remember that file can't be loaded via IMB_open_anim */
- limg->flags &= ~MOVIEFILE;
- limg->flags |= MOVIEFILE_ICON;
- }
+ /* remember that file can't be loaded via IMB_open_anim */
+ limg->flags &= ~MOVIEFILE;
+ limg->flags |= MOVIEFILE_ICON;
+ }
}
*do_update = TRUE;
PIL_sleep_ms(10);
@@ -1305,10 +1305,10 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float
static void thumbnails_update(void *tjv)
{
- ThumbnailJob *tj= tjv;
+ ThumbnailJob *tj = tjv;
if (tj->filelist && tj->filelist->filelist) {
- FileImage* limg = tj->loadimages.first;
+ FileImage *limg = tj->loadimages.first;
while (limg) {
if (!limg->done && limg->img) {
tj->filelist->filelist[limg->index].image = limg->img;
@@ -1326,28 +1326,28 @@ static void thumbnails_update(void *tjv)
static void thumbnails_free(void *tjv)
{
- ThumbnailJob *tj= tjv;
+ ThumbnailJob *tj = tjv;
thumbnail_joblist_free(tj);
MEM_freeN(tj);
}
-void thumbnails_start(struct FileList* filelist, const struct bContext* C)
+void thumbnails_start(struct FileList *filelist, const struct bContext *C)
{
wmJob *steve;
ThumbnailJob *tj;
int idx;
/* prepare job data */
- tj= MEM_callocN(sizeof(ThumbnailJob), "thumbnails\n");
+ tj = MEM_callocN(sizeof(ThumbnailJob), "thumbnails\n");
tj->filelist = filelist;
- for (idx = 0; idx < filelist->numfiles;idx++) {
+ for (idx = 0; idx < filelist->numfiles; idx++) {
if (!filelist->filelist[idx].image) {
- if ( (filelist->filelist[idx].flags & (IMAGEFILE|MOVIEFILE|BLENDERFILE)) ) {
- FileImage* limg = MEM_callocN(sizeof(struct FileImage), "loadimage");
+ if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE)) ) {
+ FileImage *limg = MEM_callocN(sizeof(struct FileImage), "loadimage");
BLI_strncpy(limg->path, filelist->filelist[idx].path, FILE_MAX);
- limg->index= idx;
- limg->flags= filelist->filelist[idx].flags;
+ limg->index = idx;
+ limg->flags = filelist->filelist[idx].flags;
BLI_addtail(&tj->loadimages, limg);
}
}
@@ -1356,7 +1356,7 @@ void thumbnails_start(struct FileList* filelist, const struct bContext* C)
BKE_reports_init(&tj->reports, RPT_PRINT);
/* setup job */
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, "Thumbnails", 0);
+ steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, "Thumbnails", 0);
WM_jobs_customdata(steve, tj, thumbnails_free);
WM_jobs_timer(steve, 0.5, NC_WINDOW, NC_WINDOW);
WM_jobs_callbacks(steve, thumbnails_startjob, NULL, thumbnails_update, NULL);
@@ -1365,12 +1365,12 @@ void thumbnails_start(struct FileList* filelist, const struct bContext* C)
WM_jobs_start(CTX_wm_manager(C), steve);
}
-void thumbnails_stop(struct FileList* filelist, const struct bContext* C)
+void thumbnails_stop(struct FileList *filelist, const struct bContext *C)
{
WM_jobs_kill(CTX_wm_manager(C), filelist, NULL);
}
-int thumbnails_running(struct FileList* filelist, const struct bContext* C)
+int thumbnails_running(struct FileList *filelist, const struct bContext *C)
{
return WM_jobs_test(CTX_wm_manager(C), filelist);
}
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index 7a37c5fb3c5..32a31c51229 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -49,8 +49,8 @@ struct FileSelection;
typedef enum FileSelType {
FILE_SEL_REMOVE = 0,
- FILE_SEL_ADD = 1,
- FILE_SEL_TOGGLE = 2
+ FILE_SEL_ADD = 1,
+ FILE_SEL_TOGGLE = 2
} FileSelType;
typedef enum FileCheckType {
@@ -59,49 +59,49 @@ typedef enum FileCheckType {
CHECK_ALL = 3
} FileCheckType;
-struct FileList * filelist_new(short type);
-void filelist_init_icons(void);
-void filelist_free_icons(void);
-int filelist_find(struct FileList* filelist, const char *file);
-void filelist_free(struct FileList* filelist);
-void filelist_sort(struct FileList* filelist, short sort);
-int filelist_numfiles(struct FileList* filelist);
-const char * filelist_dir(struct FileList* filelist);
-void filelist_setdir(struct FileList* filelist, const char *dir);
-struct direntry * filelist_file(struct FileList* filelist, int index);
-void filelist_select(struct FileList* filelist, FileSelection* sel, FileSelType select, unsigned int flag, FileCheckType check);
-void filelist_select_file(struct FileList* filelist, int index, FileSelType select, unsigned int flag, FileCheckType check);
-int filelist_is_selected(struct FileList* filelist, int index, FileCheckType check);
-void filelist_hidedot(struct FileList* filelist, short hide);
-void filelist_setfilter(struct FileList* filelist, unsigned int filter);
-void filelist_setfilter_types(struct FileList* filelist, const char *filter_glob);
-void filelist_filter(struct FileList* filelist);
-void filelist_imgsize(struct FileList* filelist, short w, short h);
-struct ImBuf * filelist_getimage(struct FileList* filelist, int index);
-struct ImBuf * filelist_geticon(struct FileList* filelist, int index);
-short filelist_changed(struct FileList* filelist);
-void filelist_readdir(struct FileList* filelist);
+struct FileList * filelist_new(short type);
+void filelist_init_icons(void);
+void filelist_free_icons(void);
+int filelist_find(struct FileList *filelist, const char *file);
+void filelist_free(struct FileList *filelist);
+void filelist_sort(struct FileList *filelist, short sort);
+int filelist_numfiles(struct FileList *filelist);
+const char * filelist_dir(struct FileList *filelist);
+void filelist_setdir(struct FileList *filelist, const char *dir);
+struct direntry * filelist_file(struct FileList *filelist, int index);
+void filelist_select(struct FileList *filelist, FileSelection *sel, FileSelType select, unsigned int flag, FileCheckType check);
+void filelist_select_file(struct FileList *filelist, int index, FileSelType select, unsigned int flag, FileCheckType check);
+int filelist_is_selected(struct FileList *filelist, int index, FileCheckType check);
+void filelist_hidedot(struct FileList *filelist, short hide);
+void filelist_setfilter(struct FileList *filelist, unsigned int filter);
+void filelist_setfilter_types(struct FileList *filelist, const char *filter_glob);
+void filelist_filter(struct FileList *filelist);
+void filelist_imgsize(struct FileList *filelist, short w, short h);
+struct ImBuf * filelist_getimage(struct FileList *filelist, int index);
+struct ImBuf * filelist_geticon(struct FileList *filelist, int index);
+short filelist_changed(struct FileList *filelist);
+void filelist_readdir(struct FileList *filelist);
-int filelist_empty(struct FileList* filelist);
-void filelist_parent(struct FileList* filelist);
+int filelist_empty(struct FileList *filelist);
+void filelist_parent(struct FileList *filelist);
-struct BlendHandle *filelist_lib(struct FileList* filelist);
-int filelist_islibrary (struct FileList* filelist, char* dir, char* group);
-void filelist_from_main(struct FileList* filelist);
-void filelist_from_library(struct FileList* filelist);
-void filelist_freelib(struct FileList* filelist);
-void filelist_hideparent(struct FileList* filelist, short hide);
+struct BlendHandle *filelist_lib(struct FileList *filelist);
+int filelist_islibrary(struct FileList *filelist, char *dir, char *group);
+void filelist_from_main(struct FileList *filelist);
+void filelist_from_library(struct FileList *filelist);
+void filelist_freelib(struct FileList *filelist);
+void filelist_hideparent(struct FileList *filelist, short hide);
-struct ListBase * folderlist_new(void);
-void folderlist_free(struct ListBase* folderlist);
-struct ListBase * folderlist_duplicate(ListBase* folderlist);
-void folderlist_popdir(struct ListBase* folderlist, char *dir);
-void folderlist_pushdir(struct ListBase* folderlist, const char *dir);
-int folderlist_clear_next(struct SpaceFile* sfile);
+struct ListBase * folderlist_new(void);
+void folderlist_free(struct ListBase *folderlist);
+struct ListBase * folderlist_duplicate(ListBase *folderlist);
+void folderlist_popdir(struct ListBase *folderlist, char *dir);
+void folderlist_pushdir(struct ListBase *folderlist, const char *dir);
+int folderlist_clear_next(struct SpaceFile *sfile);
-void thumbnails_stop(struct FileList* filelist, const struct bContext* C);
-void thumbnails_start(struct FileList* filelist, const struct bContext* C);
-int thumbnails_running(struct FileList* filelist, const struct bContext* C);
+void thumbnails_stop(struct FileList *filelist, const struct bContext *C);
+void thumbnails_start(struct FileList *filelist, const struct bContext *C);
+int thumbnails_running(struct FileList *filelist, const struct bContext *C);
#ifdef __cplusplus
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index b0818d40e53..adb3e7acca5 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -86,7 +86,7 @@
# include <fnmatch.h>
#endif
-FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile)
+FileSelectParams *ED_fileselect_get_params(struct SpaceFile *sfile)
{
if (!sfile->params) {
ED_fileselect_set_params(sfile);
@@ -101,7 +101,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
/* create new parameters if necessary */
if (!sfile->params) {
- sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams");
+ sfile->params = MEM_callocN(sizeof(FileSelectParams), "fileselparams");
/* set path to most recently opened .blend */
BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file));
sfile->params->filter_glob[0] = '\0';
@@ -111,11 +111,11 @@ short ED_fileselect_set_params(SpaceFile *sfile)
/* set the parameters from the operator, if it exists */
if (op) {
- const short is_files= (RNA_struct_find_property(op->ptr, "files") != NULL);
- const short is_filepath= (RNA_struct_find_property(op->ptr, "filepath") != NULL);
- const short is_filename= (RNA_struct_find_property(op->ptr, "filename") != NULL);
- const short is_directory= (RNA_struct_find_property(op->ptr, "directory") != NULL);
- const short is_relative_path= (RNA_struct_find_property(op->ptr, "relative_path") != NULL);
+ const short is_files = (RNA_struct_find_property(op->ptr, "files") != NULL);
+ const short is_filepath = (RNA_struct_find_property(op->ptr, "filepath") != NULL);
+ const short is_filename = (RNA_struct_find_property(op->ptr, "filename") != NULL);
+ const short is_directory = (RNA_struct_find_property(op->ptr, "directory") != NULL);
+ const short is_relative_path = (RNA_struct_find_property(op->ptr, "relative_path") != NULL);
BLI_strncpy(params->title, RNA_struct_ui_name(op->type->srna), sizeof(params->title));
@@ -129,7 +129,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
RNA_string_get(op->ptr, "filepath", name);
if (params->type == FILE_LOADLIB) {
BLI_strncpy(params->dir, name, sizeof(params->dir));
- sfile->params->file[0]= '\0';
+ sfile->params->file[0] = '\0';
}
else {
BLI_split_dirfile(name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file));
@@ -138,7 +138,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
else {
if (is_directory && RNA_struct_property_is_set(op->ptr, "directory")) {
RNA_string_get(op->ptr, "directory", params->dir);
- sfile->params->file[0]= '\0';
+ sfile->params->file[0] = '\0';
}
if (is_filename && RNA_struct_property_is_set(op->ptr, "filename")) {
@@ -151,7 +151,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
BLI_path_abs(params->dir, G.main->name);
}
- if (is_directory==TRUE && is_filename==FALSE && is_filepath==FALSE && is_files==FALSE) {
+ if (is_directory == TRUE && is_filename == FALSE && is_filepath == FALSE && is_files == FALSE) {
params->flag |= FILE_DIRSEL_ONLY;
}
else {
@@ -183,7 +183,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
params->filter |= RNA_boolean_get(op->ptr, "filter_collada") ? COLLADAFILE : 0;
if (RNA_struct_find_property(op->ptr, "filter_glob")) {
RNA_string_get(op->ptr, "filter_glob", params->filter_glob);
- params->filter |= (OPERATORFILE|FOLDERFILE);
+ params->filter |= (OPERATORFILE | FOLDERFILE);
}
else {
params->filter_glob[0] = '\0';
@@ -213,17 +213,17 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
if (RNA_struct_find_property(op->ptr, "display_type"))
- params->display= RNA_enum_get(op->ptr, "display_type");
+ params->display = RNA_enum_get(op->ptr, "display_type");
- if (params->display==FILE_DEFAULTDISPLAY) {
+ if (params->display == FILE_DEFAULTDISPLAY) {
if (U.uiflag & USER_SHOW_THUMBNAILS) {
- if (params->filter & (IMAGEFILE|MOVIEFILE))
- params->display= FILE_IMGDISPLAY;
+ if (params->filter & (IMAGEFILE | MOVIEFILE))
+ params->display = FILE_IMGDISPLAY;
else
- params->display= FILE_SHORTDISPLAY;
+ params->display = FILE_SHORTDISPLAY;
}
else {
- params->display= FILE_SHORTDISPLAY;
+ params->display = FILE_SHORTDISPLAY;
}
}
@@ -252,7 +252,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
/* switching thumbnails needs to recalc layout [#28809] */
if (sfile->layout) {
- sfile->layout->dirty= TRUE;
+ sfile->layout->dirty = TRUE;
}
return 1;
@@ -265,28 +265,28 @@ void ED_fileselect_reset_params(SpaceFile *sfile)
sfile->params->title[0] = '\0';
}
-int ED_fileselect_layout_numfiles(FileLayout* layout, struct ARegion *ar)
+int ED_fileselect_layout_numfiles(FileLayout *layout, struct ARegion *ar)
{
int numfiles;
if (layout->flag & FILE_LAYOUT_HOR) {
- int width = (int)(ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*layout->tile_border_x);
+ int width = (int)(ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2 * layout->tile_border_x);
numfiles = (int)((float)width / (float)layout->tile_w + 0.5f);
- return numfiles*layout->rows;
+ return numfiles * layout->rows;
}
else {
- int height = (int)(ar->v2d.cur.ymax - ar->v2d.cur.ymin - 2*layout->tile_border_y);
- numfiles = (int)((float)height/(float)layout->tile_h + 0.5f);
- return numfiles*layout->columns;
+ int height = (int)(ar->v2d.cur.ymax - ar->v2d.cur.ymin - 2 * layout->tile_border_y);
+ numfiles = (int)((float)height / (float)layout->tile_h + 0.5f);
+ return numfiles * layout->columns;
}
}
static int is_inside(int x, int y, int cols, int rows)
{
- return ( (x >= 0) && (x<cols) && (y>=0) && (y<rows) );
+ return ( (x >= 0) && (x < cols) && (y >= 0) && (y < rows) );
}
-FileSelection ED_fileselect_layout_offset_rect(FileLayout* layout, const rcti* rect)
+FileSelection ED_fileselect_layout_offset_rect(FileLayout *layout, const rcti *rect)
{
int colmin, colmax, rowmin, rowmax;
FileSelection sel;
@@ -295,43 +295,43 @@ FileSelection ED_fileselect_layout_offset_rect(FileLayout* layout, const rcti* r
if (layout == NULL)
return sel;
- colmin = (rect->xmin)/(layout->tile_w + 2*layout->tile_border_x);
- rowmin = (rect->ymin)/(layout->tile_h + 2*layout->tile_border_y);
- colmax = (rect->xmax)/(layout->tile_w + 2*layout->tile_border_x);
- rowmax = (rect->ymax)/(layout->tile_h + 2*layout->tile_border_y);
+ colmin = (rect->xmin) / (layout->tile_w + 2 * layout->tile_border_x);
+ rowmin = (rect->ymin) / (layout->tile_h + 2 * layout->tile_border_y);
+ colmax = (rect->xmax) / (layout->tile_w + 2 * layout->tile_border_x);
+ rowmax = (rect->ymax) / (layout->tile_h + 2 * layout->tile_border_y);
if (is_inside(colmin, rowmin, layout->columns, layout->rows) ||
is_inside(colmax, rowmax, layout->columns, layout->rows) )
{
- CLAMP(colmin, 0, layout->columns-1);
- CLAMP(rowmin, 0, layout->rows-1);
- CLAMP(colmax, 0, layout->columns-1);
- CLAMP(rowmax, 0, layout->rows-1);
+ CLAMP(colmin, 0, layout->columns - 1);
+ CLAMP(rowmin, 0, layout->rows - 1);
+ CLAMP(colmax, 0, layout->columns - 1);
+ CLAMP(rowmax, 0, layout->rows - 1);
}
- if ((colmin > layout->columns-1) || (rowmin > layout->rows-1)) {
+ if ((colmin > layout->columns - 1) || (rowmin > layout->rows - 1)) {
sel.first = -1;
}
else {
if (layout->flag & FILE_LAYOUT_HOR)
- sel.first = layout->rows*colmin + rowmin;
+ sel.first = layout->rows * colmin + rowmin;
else
- sel.first = colmin + layout->columns*rowmin;
+ sel.first = colmin + layout->columns * rowmin;
}
- if ((colmax > layout->columns-1) || (rowmax > layout->rows-1)) {
+ if ((colmax > layout->columns - 1) || (rowmax > layout->rows - 1)) {
sel.last = -1;
}
else {
if (layout->flag & FILE_LAYOUT_HOR)
- sel.last = layout->rows*colmax + rowmax;
+ sel.last = layout->rows * colmax + rowmax;
else
- sel.last = colmax + layout->columns*rowmax;
+ sel.last = colmax + layout->columns * rowmax;
}
return sel;
}
-int ED_fileselect_layout_offset(FileLayout* layout, int x, int y)
+int ED_fileselect_layout_offset(FileLayout *layout, int x, int y)
{
int offsetx, offsety;
int active_file;
@@ -339,35 +339,35 @@ int ED_fileselect_layout_offset(FileLayout* layout, int x, int y)
if (layout == NULL)
return -1;
- offsetx = (x)/(layout->tile_w + 2*layout->tile_border_x);
- offsety = (y)/(layout->tile_h + 2*layout->tile_border_y);
+ offsetx = (x) / (layout->tile_w + 2 * layout->tile_border_x);
+ offsety = (y) / (layout->tile_h + 2 * layout->tile_border_y);
if (offsetx > layout->columns - 1) return -1;
if (offsety > layout->rows - 1) return -1;
if (layout->flag & FILE_LAYOUT_HOR)
- active_file = layout->rows*offsetx + offsety;
+ active_file = layout->rows * offsetx + offsety;
else
- active_file = offsetx + layout->columns*offsety;
+ active_file = offsetx + layout->columns * offsety;
return active_file;
}
-void ED_fileselect_layout_tilepos(FileLayout* layout, int tile, int *x, int *y)
+void ED_fileselect_layout_tilepos(FileLayout *layout, int tile, int *x, int *y)
{
if (layout->flag == FILE_LAYOUT_HOR) {
- *x = layout->tile_border_x + (tile/layout->rows)*(layout->tile_w+2*layout->tile_border_x);
- *y = layout->tile_border_y + (tile%layout->rows)*(layout->tile_h+2*layout->tile_border_y);
+ *x = layout->tile_border_x + (tile / layout->rows) * (layout->tile_w + 2 * layout->tile_border_x);
+ *y = layout->tile_border_y + (tile % layout->rows) * (layout->tile_h + 2 * layout->tile_border_y);
}
else {
- *x = layout->tile_border_x + ((tile)%layout->columns)*(layout->tile_w+2*layout->tile_border_x);
- *y = layout->tile_border_y + ((tile)/layout->columns)*(layout->tile_h+2*layout->tile_border_y);
+ *x = layout->tile_border_x + ((tile) % layout->columns) * (layout->tile_w + 2 * layout->tile_border_x);
+ *y = layout->tile_border_y + ((tile) / layout->columns) * (layout->tile_h + 2 * layout->tile_border_y);
}
}
/* Shorten a string to a given width w.
* If front is set, shorten from the front,
* otherwise shorten from the end. */
-float file_shorten_string(char* string, float w, int front)
+float file_shorten_string(char *string, float w, int front)
{
char temp[FILE_MAX];
short shortened = 0;
@@ -384,23 +384,23 @@ float file_shorten_string(char* string, float w, int front)
char *s = string;
BLI_strncpy(temp, "...", 4);
pad = file_string_width(temp);
- while ((*s) && (sw+pad>w)) {
+ while ((*s) && (sw + pad > w)) {
s++;
sw = file_string_width(s);
shortened = 1;
}
if (shortened) {
int slen = strlen(s);
- BLI_strncpy(temp+3, s, slen+1);
- temp[slen+4] = '\0';
- BLI_strncpy(string, temp, slen+4);
+ BLI_strncpy(temp + 3, s, slen + 1);
+ temp[slen + 4] = '\0';
+ BLI_strncpy(string, temp, slen + 4);
}
}
else {
char *s = string;
- while (sw>w) {
+ while (sw > w) {
int slen = strlen(string);
- string[slen-1] = '\0';
+ string[slen - 1] = '\0';
sw = file_string_width(s);
shortened = 1;
}
@@ -408,7 +408,7 @@ float file_shorten_string(char* string, float w, int front)
if (shortened) {
int slen = strlen(string);
if (slen > 3) {
- BLI_strncpy(string+slen-3, "...", 4);
+ BLI_strncpy(string + slen - 3, "...", 4);
}
}
}
@@ -416,9 +416,9 @@ float file_shorten_string(char* string, float w, int front)
return sw;
}
-float file_string_width(const char* str)
+float file_string_width(const char *str)
{
- uiStyle *style= UI_GetStyle();
+ uiStyle *style = UI_GetStyle();
uiStyleFontSet(&style->widget);
return BLF_width(style->widget.uifont_id, str);
}
@@ -428,28 +428,28 @@ float file_font_pointsize(void)
#if 0
float s;
char tmp[2] = "X";
- uiStyle *style= UI_GetStyle();
+ uiStyle *style = UI_GetStyle();
uiStyleFontSet(&style->widget);
s = BLF_height(style->widget.uifont_id, tmp);
return style->widget.points;
#else
- uiStyle *style= UI_GetStyle();
+ uiStyle *style = UI_GetStyle();
uiStyleFontSet(&style->widget);
return style->widget.points * UI_DPI_FAC;
#endif
}
-static void column_widths(struct FileList* files, struct FileLayout* layout)
+static void column_widths(struct FileList *files, struct FileLayout *layout)
{
int i;
int numfiles = filelist_numfiles(files);
- for (i=0; i<MAX_FILE_COLUMN; ++i) {
+ for (i = 0; i < MAX_FILE_COLUMN; ++i) {
layout->column_widths[i] = 0;
}
- for (i=0; (i < numfiles); ++i) {
- struct direntry* file = filelist_file(files, i);
+ for (i = 0; (i < numfiles); ++i) {
+ struct direntry *file = filelist_file(files, i);
if (file) {
float len;
len = file_string_width(file->relname);
@@ -475,8 +475,8 @@ static void column_widths(struct FileList* files, struct FileLayout* layout)
void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
{
FileSelectParams *params = ED_fileselect_get_params(sfile);
- FileLayout *layout= NULL;
- View2D *v2d= &ar->v2d;
+ FileLayout *layout = NULL;
+ View2D *v2d = &ar->v2d;
int maxlen = 0;
int numfiles;
int textheight;
@@ -501,17 +501,17 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
layout->tile_border_y = 6;
layout->prv_border_x = 6;
layout->prv_border_y = 6;
- layout->tile_w = layout->prv_w + 2*layout->prv_border_x;
- layout->tile_h = layout->prv_h + 2*layout->prv_border_y + textheight;
- layout->width= (int)(v2d->cur.xmax - v2d->cur.xmin - 2*layout->tile_border_x);
- layout->columns= layout->width / (layout->tile_w + 2*layout->tile_border_x);
+ layout->tile_w = layout->prv_w + 2 * layout->prv_border_x;
+ layout->tile_h = layout->prv_h + 2 * layout->prv_border_y + textheight;
+ layout->width = (int)(v2d->cur.xmax - v2d->cur.xmin - 2 * layout->tile_border_x);
+ layout->columns = layout->width / (layout->tile_w + 2 * layout->tile_border_x);
if (layout->columns > 0)
- layout->rows= numfiles/layout->columns + 1; // XXX dirty, modulo is zero
+ layout->rows = numfiles / layout->columns + 1; // XXX dirty, modulo is zero
else {
layout->columns = 1;
- layout->rows= numfiles + 1; // XXX dirty, modulo is zero
+ layout->rows = numfiles + 1; // XXX dirty, modulo is zero
}
- layout->height= sfile->layout->rows*(layout->tile_h+2*layout->tile_border_y) + layout->tile_border_y*2;
+ layout->height = sfile->layout->rows * (layout->tile_h + 2 * layout->tile_border_y) + layout->tile_border_y * 2;
layout->flag = FILE_LAYOUT_VER;
}
else {
@@ -521,45 +521,45 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
layout->tile_border_y = 2;
layout->prv_border_x = 0;
layout->prv_border_y = 0;
- layout->tile_h = textheight*3/2;
- layout->height= (int)(v2d->cur.ymax - v2d->cur.ymin - 2*layout->tile_border_y);
- layout->rows = layout->height / (layout->tile_h + 2*layout->tile_border_y);
+ layout->tile_h = textheight * 3 / 2;
+ layout->height = (int)(v2d->cur.ymax - v2d->cur.ymin - 2 * layout->tile_border_y);
+ layout->rows = layout->height / (layout->tile_h + 2 * layout->tile_border_y);
column_widths(sfile->files, layout);
if (params->display == FILE_SHORTDISPLAY) {
maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
- (int)layout->column_widths[COLUMN_NAME] + 12 +
- (int)layout->column_widths[COLUMN_SIZE] + 12;
+ (int)layout->column_widths[COLUMN_NAME] + 12 +
+ (int)layout->column_widths[COLUMN_SIZE] + 12;
}
else {
maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
- (int)layout->column_widths[COLUMN_NAME] + 12 +
+ (int)layout->column_widths[COLUMN_NAME] + 12 +
#ifndef WIN32
- (int)layout->column_widths[COLUMN_MODE1] + 12 +
- (int)layout->column_widths[COLUMN_MODE2] + 12 +
- (int)layout->column_widths[COLUMN_MODE3] + 12 +
- (int)layout->column_widths[COLUMN_OWNER] + 12 +
+ (int)layout->column_widths[COLUMN_MODE1] + 12 +
+ (int)layout->column_widths[COLUMN_MODE2] + 12 +
+ (int)layout->column_widths[COLUMN_MODE3] + 12 +
+ (int)layout->column_widths[COLUMN_OWNER] + 12 +
#endif
- (int)layout->column_widths[COLUMN_DATE] + 12 +
- (int)layout->column_widths[COLUMN_TIME] + 12 +
- (int)layout->column_widths[COLUMN_SIZE] + 12;
+ (int)layout->column_widths[COLUMN_DATE] + 12 +
+ (int)layout->column_widths[COLUMN_TIME] + 12 +
+ (int)layout->column_widths[COLUMN_SIZE] + 12;
}
layout->tile_w = maxlen;
if (layout->rows > 0)
- layout->columns = numfiles/layout->rows + 1; // XXX dirty, modulo is zero
+ layout->columns = numfiles / layout->rows + 1; // XXX dirty, modulo is zero
else {
layout->rows = 1;
layout->columns = numfiles + 1; // XXX dirty, modulo is zero
}
- layout->width = sfile->layout->columns * (layout->tile_w + 2*layout->tile_border_x) + layout->tile_border_x*2;
+ layout->width = sfile->layout->columns * (layout->tile_w + 2 * layout->tile_border_x) + layout->tile_border_x * 2;
layout->flag = FILE_LAYOUT_HOR;
}
- layout->dirty= FALSE;
+ layout->dirty = FALSE;
}
-FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar)
+FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar)
{
if (!sfile->layout) {
ED_fileselect_init_layout(sfile, ar);
@@ -569,13 +569,13 @@ FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar
void file_change_dir(bContext *C, int checkdir)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
ED_fileselect_clear(C, sfile);
- if (checkdir && BLI_is_dir(sfile->params->dir)==0) {
+ if (checkdir && BLI_is_dir(sfile->params->dir) == 0) {
BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
/* could return but just refresh the current dir */
}
@@ -589,28 +589,34 @@ void file_change_dir(bContext *C, int checkdir)
}
}
-int file_select_match(struct SpaceFile *sfile, const char *pattern)
+int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matched_file)
{
int match = 0;
- if (strchr(pattern, '*') || strchr(pattern, '?') || strchr(pattern, '[')) {
- int i;
- struct direntry *file;
- int n = filelist_numfiles(sfile->files);
-
- for (i = 0; i < n; i++) {
- file = filelist_file(sfile->files, i);
- if (fnmatch(pattern, file->relname, 0) == 0) {
- file->selflag |= SELECTED_FILE;
- match = 1;
+
+ int i;
+ struct direntry *file;
+ int n = filelist_numfiles(sfile->files);
+
+ /* select any file that matches the pattern, this includes exact match
+ * if the user selects a single file by entering the filename
+ */
+ for (i = 0; i < n; i++) {
+ file = filelist_file(sfile->files, i);
+ if (fnmatch(pattern, file->relname, 0) == 0) {
+ file->selflag |= SELECTED_FILE;
+ if (!match) {
+ BLI_strncpy(matched_file, file->relname, FILE_MAX);
}
+ match = 1;
}
}
+
return match;
}
void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
/* search if str matches the beginning of name */
if (str[0] && sfile->files) {
@@ -624,10 +630,10 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
dir = opendir(dirname);
if (dir) {
- AutoComplete *autocpl= autocomplete_begin(str, FILE_MAX);
+ AutoComplete *autocpl = autocomplete_begin(str, FILE_MAX);
while ((de = readdir(dir)) != NULL) {
- if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0) {
+ if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0) {
/* pass */
}
else {
@@ -658,16 +664,16 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
/* search if str matches the beginning of name */
if (str[0] && sfile->files) {
- AutoComplete *autocpl= autocomplete_begin(str, FILE_MAX);
+ AutoComplete *autocpl = autocomplete_begin(str, FILE_MAX);
int nentries = filelist_numfiles(sfile->files);
int i;
- for (i= 0; i<nentries; ++i) {
- struct direntry* file = filelist_file(sfile->files, i);
+ for (i = 0; i < nentries; ++i) {
+ struct direntry *file = filelist_file(sfile->files, i);
if (file && S_ISREG(file->type)) {
autocomplete_do_name(autocpl, file->relname);
}
@@ -686,7 +692,7 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile)
}
sfile->params->active_file = -1;
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
}
void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile)
@@ -703,7 +709,7 @@ void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile)
if (sfile->files) {
ED_fileselect_clear(C, sfile);
MEM_freeN(sfile->files);
- sfile->files= NULL;
+ sfile->files = NULL;
}
}
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 6d2381e64d5..0366043aaa0 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -449,9 +449,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i);
err = LSSharedFileListItemResolve(itemRef,
- kLSSharedFileListNoUserInteraction |
- kLSSharedFileListDoNotMountVolumes,
- &cfURL, NULL);
+ kLSSharedFileListNoUserInteraction |
+ kLSSharedFileListDoNotMountVolumes,
+ &cfURL, NULL);
if (err != noErr)
continue;
diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h
index e5b3d54ac9f..d7576d71933 100644
--- a/source/blender/editors/space_file/fsmenu.h
+++ b/source/blender/editors/space_file/fsmenu.h
@@ -45,42 +45,42 @@ typedef enum FSMenuCategory {
struct FSMenu;
-struct FSMenu* fsmenu_get (void);
+struct FSMenu *fsmenu_get(void);
- /** Returns the number of entries in the Fileselect Menu */
-int fsmenu_get_nentries (struct FSMenu* fsmenu, FSMenuCategory category);
+/** Returns the number of entries in the Fileselect Menu */
+int fsmenu_get_nentries(struct FSMenu *fsmenu, FSMenuCategory category);
- /** Returns the fsmenu entry at \a index (or NULL if a bad index)
- * or a separator.
- */
-char* fsmenu_get_entry (struct FSMenu* fsmenu, FSMenuCategory category, int index);
+/** Returns the fsmenu entry at \a index (or NULL if a bad index)
+ * or a separator.
+ */
+char *fsmenu_get_entry(struct FSMenu *fsmenu, FSMenuCategory category, int index);
- /** Inserts a new fsmenu entry with the given \a path.
- * Duplicate entries are not added.
- * \param sorted Should entry be inserted in sorted order?
- */
-void fsmenu_insert_entry (struct FSMenu* fsmenu, FSMenuCategory category, const char *path, int sorted, short save);
+/** Inserts a new fsmenu entry with the given \a path.
+ * Duplicate entries are not added.
+ * \param sorted Should entry be inserted in sorted order?
+ */
+void fsmenu_insert_entry(struct FSMenu *fsmenu, FSMenuCategory category, const char *path, int sorted, short save);
- /** Return whether the entry was created by the user and can be saved and deleted */
-short fsmenu_can_save (struct FSMenu* fsmenu, FSMenuCategory category, int index);
+/** Return whether the entry was created by the user and can be saved and deleted */
+short fsmenu_can_save(struct FSMenu *fsmenu, FSMenuCategory category, int index);
- /** Removes the fsmenu entry at the given \a index. */
-void fsmenu_remove_entry (struct FSMenu* fsmenu, FSMenuCategory category, int index);
+/** Removes the fsmenu entry at the given \a index. */
+void fsmenu_remove_entry(struct FSMenu *fsmenu, FSMenuCategory category, int index);
- /** saves the 'bookmarks' to the specified file */
-void fsmenu_write_file (struct FSMenu* fsmenu, const char *filename);
+/** saves the 'bookmarks' to the specified file */
+void fsmenu_write_file(struct FSMenu *fsmenu, const char *filename);
- /** reads the 'bookmarks' from the specified file */
-void fsmenu_read_bookmarks (struct FSMenu* fsmenu, const char *filename);
+/** reads the 'bookmarks' from the specified file */
+void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filename);
- /** adds system specific directories */
-void fsmenu_read_system (struct FSMenu* fsmenu, int read_bookmarks);
+/** adds system specific directories */
+void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks);
- /** Free's all the memory associated with the fsmenu */
-void fsmenu_free (struct FSMenu* fsmenu);
+/** Free's all the memory associated with the fsmenu */
+void fsmenu_free(struct FSMenu *fsmenu);
- /** Refresh system directory menu */
-void fsmenu_refresh_system_category (struct FSMenu* fsmenu);
+/** Refresh system directory menu */
+void fsmenu_refresh_system_category(struct FSMenu *fsmenu);
#endif
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index a90daa7e1e9..79979603f54 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -63,7 +63,7 @@
#include "UI_view2d.h"
-#include "file_intern.h" // own include
+#include "file_intern.h" // own include
#include "fsmenu.h"
#include "filelist.h"
@@ -74,36 +74,36 @@ static SpaceLink *file_new(const bContext *UNUSED(C))
ARegion *ar;
SpaceFile *sfile;
- sfile= MEM_callocN(sizeof(SpaceFile), "initfile");
- sfile->spacetype= SPACE_FILE;
+ sfile = MEM_callocN(sizeof(SpaceFile), "initfile");
+ sfile->spacetype = SPACE_FILE;
/* header */
- ar= MEM_callocN(sizeof(ARegion), "header for file");
+ ar = MEM_callocN(sizeof(ARegion), "header for file");
BLI_addtail(&sfile->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_TOP;
+ ar->regiontype = RGN_TYPE_HEADER;
+ ar->alignment = RGN_ALIGN_TOP;
/* channel list region */
- ar= MEM_callocN(sizeof(ARegion), "channel area for file");
+ ar = MEM_callocN(sizeof(ARegion), "channel area for file");
BLI_addtail(&sfile->regionbase, ar);
- ar->regiontype= RGN_TYPE_CHANNELS;
- ar->alignment= RGN_ALIGN_LEFT;
+ ar->regiontype = RGN_TYPE_CHANNELS;
+ ar->alignment = RGN_ALIGN_LEFT;
/* ui list region */
- ar= MEM_callocN(sizeof(ARegion), "ui area for file");
+ ar = MEM_callocN(sizeof(ARegion), "ui area for file");
BLI_addtail(&sfile->regionbase, ar);
- ar->regiontype= RGN_TYPE_UI;
- ar->alignment= RGN_ALIGN_TOP;
+ ar->regiontype = RGN_TYPE_UI;
+ ar->alignment = RGN_ALIGN_TOP;
/* main area */
- ar= MEM_callocN(sizeof(ARegion), "main area for file");
+ ar = MEM_callocN(sizeof(ARegion), "main area for file");
BLI_addtail(&sfile->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
+ ar->regiontype = RGN_TYPE_WINDOW;
ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
- ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
- ar->v2d.keeptot= V2D_KEEPTOT_STRICT;
- ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
+ ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
+ ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+ ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
+ ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
return (SpaceLink *)sfile;
}
@@ -111,31 +111,31 @@ static SpaceLink *file_new(const bContext *UNUSED(C))
/* not spacelink itself */
static void file_free(SpaceLink *sl)
{
- SpaceFile *sfile= (SpaceFile *) sl;
+ SpaceFile *sfile = (SpaceFile *) sl;
if (sfile->files) {
// XXXXX would need to do thumbnails_stop here, but no context available
filelist_freelib(sfile->files);
filelist_free(sfile->files);
MEM_freeN(sfile->files);
- sfile->files= NULL;
+ sfile->files = NULL;
}
if (sfile->folders_prev) {
folderlist_free(sfile->folders_prev);
MEM_freeN(sfile->folders_prev);
- sfile->folders_prev= NULL;
+ sfile->folders_prev = NULL;
}
if (sfile->folders_next) {
folderlist_free(sfile->folders_next);
MEM_freeN(sfile->folders_next);
- sfile->folders_next= NULL;
+ sfile->folders_next = NULL;
}
if (sfile->params) {
MEM_freeN(sfile->params);
- sfile->params= NULL;
+ sfile->params = NULL;
}
if (sfile->layout) {
@@ -148,27 +148,27 @@ static void file_free(SpaceLink *sl)
/* spacetype; init callback, area size changes, screen set, etc */
static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
{
- SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
+ SpaceFile *sfile = (SpaceFile *)sa->spacedata.first;
//printf("file_init\n");
/* refresh system directory list */
fsmenu_refresh_system_category(fsmenu_get());
- if (sfile->layout) sfile->layout->dirty= TRUE;
+ if (sfile->layout) sfile->layout->dirty = TRUE;
}
static SpaceLink *file_duplicate(SpaceLink *sl)
{
- SpaceFile *sfileo= (SpaceFile*)sl;
- SpaceFile *sfilen= MEM_dupallocN(sl);
+ SpaceFile *sfileo = (SpaceFile *)sl;
+ SpaceFile *sfilen = MEM_dupallocN(sl);
/* clear or remove stuff from old */
sfilen->op = NULL; /* file window doesn't own operators */
if (sfileo->params) {
sfilen->files = filelist_new(sfileo->params->type);
- sfilen->params= MEM_dupallocN(sfileo->params);
+ sfilen->params = MEM_dupallocN(sfileo->params);
filelist_setdir(sfilen->files, sfilen->params->dir);
}
@@ -179,14 +179,14 @@ static SpaceLink *file_duplicate(SpaceLink *sl)
sfilen->folders_next = folderlist_duplicate(sfileo->folders_next);
if (sfileo->layout) {
- sfilen->layout= MEM_dupallocN(sfileo->layout);
+ sfilen->layout = MEM_dupallocN(sfileo->layout);
}
return (SpaceLink *)sfilen;
}
static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
{
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
if (!sfile->folders_prev)
@@ -203,7 +203,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
if (filelist_empty(sfile->files)) {
thumbnails_stop(sfile->files, C);
filelist_readdir(sfile->files);
- if (params->sort!=FILE_SORT_NONE) {
+ if (params->sort != FILE_SORT_NONE) {
filelist_sort(sfile->files, params->sort);
}
BLI_strncpy(params->dir, filelist_dir(sfile->files), FILE_MAX);
@@ -212,7 +212,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
}
}
else {
- if (params->sort!=FILE_SORT_NONE) {
+ if (params->sort != FILE_SORT_NONE) {
thumbnails_stop(sfile->files, C);
filelist_sort(sfile->files, params->sort);
if (params->display == FILE_IMGDISPLAY) {
@@ -237,7 +237,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
if (params->renamefile[0] != '\0') {
int idx = filelist_find(sfile->files, params->renamefile);
if (idx >= 0) {
- struct direntry *file= filelist_file(sfile->files, idx);
+ struct direntry *file = filelist_file(sfile->files, idx);
if (file) {
file->selflag |= EDITING_FILE;
}
@@ -245,7 +245,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
BLI_strncpy(sfile->params->renameedit, sfile->params->renamefile, sizeof(sfile->params->renameedit));
params->renamefile[0] = '\0';
}
- if (sfile->layout) sfile->layout->dirty= TRUE;
+ if (sfile->layout) sfile->layout->dirty = TRUE;
}
@@ -307,11 +307,11 @@ static void file_main_area_listener(ARegion *ar, wmNotifier *wmn)
static void file_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- SpaceFile *sfile= CTX_wm_space_file(C);
+ SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
- FileLayout *layout=NULL;
+ FileLayout *layout = NULL;
- View2D *v2d= &ar->v2d;
+ View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
float col[3];
@@ -355,7 +355,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar)
/* on first read, find active file */
if (params->active_file == -1) {
- wmEvent *event= CTX_wm_window(C)->eventstate;
+ wmEvent *event = CTX_wm_window(C)->eventstate;
file_hilight_set(sfile, ar, event->x, event->y);
}
@@ -365,7 +365,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* scrollers */
- scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+ scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
@@ -553,58 +553,58 @@ static void file_ui_area_listener(ARegion *ar, wmNotifier *wmn)
/* only called once, from space/spacetypes.c */
void ED_spacetype_file(void)
{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype file");
+ SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype file");
ARegionType *art;
- st->spaceid= SPACE_FILE;
+ st->spaceid = SPACE_FILE;
strncpy(st->name, "File", BKE_ST_MAXNAME);
- st->new= file_new;
- st->free= file_free;
- st->init= file_init;
- st->duplicate= file_duplicate;
- st->refresh= file_refresh;
- st->listener= file_listener;
- st->operatortypes= file_operatortypes;
- st->keymap= file_keymap;
+ st->new = file_new;
+ st->free = file_free;
+ st->init = file_init;
+ st->duplicate = file_duplicate;
+ st->refresh = file_refresh;
+ st->listener = file_listener;
+ st->operatortypes = file_operatortypes;
+ st->keymap = file_keymap;
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
art->regionid = RGN_TYPE_WINDOW;
- art->init= file_main_area_init;
- art->draw= file_main_area_draw;
- art->listener= file_main_area_listener;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+ art->init = file_main_area_init;
+ art->draw = file_main_area_draw;
+ art->listener = file_main_area_listener;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
- art->init= file_header_area_init;
- art->draw= file_header_area_draw;
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
+ art->init = file_header_area_init;
+ art->draw = file_header_area_draw;
// art->listener= file_header_area_listener;
BLI_addhead(&st->regiontypes, art);
/* regions: ui */
- art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
art->regionid = RGN_TYPE_UI;
- art->prefsizey= 60;
- art->keymapflag= ED_KEYMAP_UI;
- art->listener= file_ui_area_listener;
- art->init= file_ui_area_init;
- art->draw= file_ui_area_draw;
+ art->prefsizey = 60;
+ art->keymapflag = ED_KEYMAP_UI;
+ art->listener = file_ui_area_listener;
+ art->init = file_ui_area_init;
+ art->draw = file_ui_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: channels (directories) */
- art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
art->regionid = RGN_TYPE_CHANNELS;
- art->prefsizex= 240;
- art->keymapflag= ED_KEYMAP_UI;
- art->listener= file_channel_area_listener;
- art->init= file_channel_area_init;
- art->draw= file_channel_area_draw;
+ art->prefsizex = 240;
+ art->keymapflag = ED_KEYMAP_UI;
+ art->listener = file_channel_area_listener;
+ art->init = file_channel_area_init;
+ art->draw = file_channel_area_draw;
BLI_addhead(&st->regiontypes, art);
file_panels_register(art);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 32e6f588e27..59e47363a22 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -550,7 +550,7 @@ static void image_keymap(struct wmKeyConfig *keyconf)
/* fast switch to render slots */
for (i = 0; i < MAX2(IMA_MAX_RENDER_SLOT, 9); i++) {
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_int", ONEKEY+i, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_int", ONEKEY + i, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.image.render_slot");
RNA_int_set(kmi->ptr, "value", i);
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 8aa56823baf..4ed9acf1481 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1002,7 +1002,7 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, bN
glDisable(GL_BLEND);
/* outline active and selected emphasis */
- if (node->flag & (NODE_ACTIVE | SELECT) ) {
+ if (node->flag & (NODE_ACTIVE | SELECT)) {
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
@@ -1105,7 +1105,7 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
/* XXX only kept for debugging
* selection state is indicated by socket outline below!
*/
- #if 0
+#if 0
/* body */
uiSetRoundBox(15);
UI_ThemeColor4(TH_NODE);
@@ -1116,18 +1116,18 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
/* outline active and selected emphasis */
if (node->flag & (NODE_ACTIVE | SELECT)) {
glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
/* using different shades of TH_TEXT_HI for the empasis, like triangle */
- if( node->flag & NODE_ACTIVE )
+ if (node->flag & NODE_ACTIVE)
UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
else
UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, size);
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
- #endif
+#endif
/* only draw input socket. as they all are placed on the same position.
* highlight also if node itself is selected, since we don't display the node body separately!
@@ -1194,7 +1194,7 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imap
uiLayout *col;
int source;
- if(!imaptr->data)
+ if (!imaptr->data)
return;
col = uiLayoutColumn(layout, 0);
@@ -2429,7 +2429,7 @@ static void node_composit_buts_viewer_but(uiLayout *layout, bContext *UNUSED(C),
static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL);
- uiItemR(layout, ptr, "smooth_mask", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "smooth_mask", 0, NULL, ICON_NONE);
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 463a262c09c..8be5b644afb 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -825,7 +825,7 @@ typedef struct DrawCache {
static void text_drawcache_init(SpaceText *st)
{
- DrawCache *drawcache = MEM_callocN(sizeof (DrawCache), "text draw cache");
+ DrawCache *drawcache = MEM_callocN(sizeof(DrawCache), "text draw cache");
drawcache->winx = -1;
drawcache->nlines = BLI_countlist(&st->text->lines);
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 43252111303..7d39a89a130 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -431,7 +431,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r
}
tend();
- // printf ( "Draw Time: %f\n",( float ) tval() );
+ // printf ( "Draw Time: %f\n",(float) tval() );
if (tex_shadow)
GPU_texture_unbind(tex_shadow);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 1f7dfef3871..709a73178aa 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -153,12 +153,14 @@ static void view3d_draw_clipping(RegionView3D *rv3d)
BoundBox *bb = rv3d->clipbb;
if (bb) {
- static unsigned int clipping_index[6][4] = {{0, 1, 2, 3},
- {0, 4, 5, 1},
- {4, 7, 6, 5},
- {7, 3, 2, 6},
- {1, 5, 6, 2},
- {7, 4, 0, 3}};
+ static unsigned int clipping_index[6][4] = {
+ {0, 1, 2, 3},
+ {0, 4, 5, 1},
+ {4, 7, 6, 5},
+ {7, 3, 2, 6},
+ {1, 5, 6, 2},
+ {7, 4, 0, 3}
+ };
/* fill in zero alpha for rendering & re-projection [#31530] */
unsigned char col[4];
@@ -2830,13 +2832,17 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
cliprct.ymin += ar->winrct.ymin;
cliprct.ymax += ar->winrct.ymin;
- cliprct.xmin = MAX2(cliprct.xmin, ar->winrct.xmin);
- cliprct.ymin = MAX2(cliprct.ymin, ar->winrct.ymin);
- cliprct.xmax = MIN2(cliprct.xmax, ar->winrct.xmax);
- cliprct.ymax = MIN2(cliprct.ymax, ar->winrct.ymax);
+ cliprct.xmin = CLAMPIS(cliprct.xmin, ar->winrct.xmin, ar->winrct.xmax);
+ cliprct.ymin = CLAMPIS(cliprct.ymin, ar->winrct.ymin, ar->winrct.ymax);
+ cliprct.xmax = CLAMPIS(cliprct.xmax, ar->winrct.xmin, ar->winrct.xmax);
+ cliprct.ymax = CLAMPIS(cliprct.ymax, ar->winrct.ymin, ar->winrct.ymax);
- glGetIntegerv(GL_SCISSOR_BOX, scissor);
- glScissor(cliprct.xmin, cliprct.ymin, cliprct.xmax - cliprct.xmin, cliprct.ymax - cliprct.ymin);
+ if (cliprct.xmax > cliprct.xmin && cliprct.ymax > cliprct.ymin) {
+ glGetIntegerv(GL_SCISSOR_BOX, scissor);
+ glScissor(cliprct.xmin, cliprct.ymin, cliprct.xmax - cliprct.xmin, cliprct.ymax - cliprct.ymin);
+ }
+ else
+ return 0;
}
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
@@ -2847,11 +2853,6 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
else
fdrawcheckerboard(0, 0, ar->winx, ar->winy);
- if (draw_border) {
- /* restore scissor as it was before */
- glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
- }
-
/* render result draw */
type = rv3d->render_engine->type;
type->view_draw(rv3d->render_engine, C);
@@ -2859,6 +2860,11 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
if (v3d->flag & V3D_DISPBGPICS)
view3d_draw_bgpic(scene, ar, v3d, TRUE, TRUE);
+ if (draw_border) {
+ /* restore scissor as it was before */
+ glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+ }
+
return 1;
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index d632314f3ca..cc3d2d383b8 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1669,7 +1669,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
if (rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom = RV3D_CAMZOOM_MAX;
}
else if (rv3d->dist > 0.001f * v3d->grid) {
- view_zoom_mouseloc(ar, .83333f, mx, my);
+ view_zoom_mouseloc(ar, 0.83333f, mx, my);
}
}
@@ -1921,7 +1921,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
view_dolly_mouseloc(ar, rv3d->ofs, mousevec, 1.2f);
}
else {
- view_dolly_mouseloc(ar, rv3d->ofs, mousevec, .83333f);
+ view_dolly_mouseloc(ar, rv3d->ofs, mousevec, 0.83333f);
}
if (rv3d->viewlock & RV3D_BOXVIEW)
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 9ebd43cd0d1..90b67951614 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -221,7 +221,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
setlinestyle(0);
cpack(0x0);
fdrawline(-0.020 / w, 0, -0.1 / w, 0);
- fdrawline(0.1 / w, 0, .020 / w, 0);
+ fdrawline(0.1 / w, 0, 0.020 / w, 0);
fdrawline(0, -0.020 / h, 0, -0.1 / h);
fdrawline(0, 0.1 / h, 0, 0.020 / h);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index a1bd8dcb3a3..e718a486561 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -246,7 +246,7 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap){
/* only actually enable if it's supported */
GTS.gpu_mipmap = gpu_mipmap && GLEW_EXT_framebuffer_object;
- if(old_value != GTS.gpu_mipmap) {
+ if (old_value != GTS.gpu_mipmap) {
GPU_free_images();
}
}
@@ -644,7 +644,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
}
else {
- if(GTS.gpu_mipmap) {
+ if (GTS.gpu_mipmap) {
if (use_high_bit_depth)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, rectw, recth, 0, GL_RGBA, GL_FLOAT, frect);
else
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 2370dbeebc5..f777d40dca9 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -445,7 +445,7 @@ static int startffmpeg(struct anim *anim)
int i, videoStream;
AVCodec *pCodec;
- AVFormatContext *pFormatCtx;
+ AVFormatContext *pFormatCtx = NULL;
AVCodecContext *pCodecCtx;
int frs_num;
double frs_den;
@@ -464,7 +464,7 @@ static int startffmpeg(struct anim *anim)
do_init_ffmpeg();
- if (av_open_input_file(&pFormatCtx, anim->name, NULL, 0, NULL) != 0) {
+ if (avformat_open_input(&pFormatCtx, anim->name, NULL, NULL) != 0) {
return -1;
}
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index 11da2f4af91..0ccd2680461 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -531,13 +531,6 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
rv->c->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
- if (av_set_parameters(rv->of, NULL) < 0) {
- fprintf(stderr, "Couldn't set output parameters? "
- "Proxy not built!\n");
- av_free(rv->of);
- return 0;
- }
-
if (avio_open(&rv->of->pb, fname, AVIO_FLAG_WRITE) < 0) {
fprintf(stderr, "Couldn't open outputfile! "
"Proxy not built!\n");
@@ -574,7 +567,12 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
NULL, NULL, NULL);
}
- av_write_header(rv->of);
+ if (avformat_write_header(rv->of, NULL) < 0) {
+ fprintf(stderr, "Couldn't set output parameters? "
+ "Proxy not built!\n");
+ av_free(rv->of);
+ return 0;
+ }
return rv;
}
@@ -737,7 +735,7 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim, IMB_Tim
memset(context->proxy_ctx, 0, sizeof(context->proxy_ctx));
memset(context->indexer, 0, sizeof(context->indexer));
- if (av_open_input_file(&context->iFormatCtx, anim->name, NULL, 0, NULL) != 0) {
+ if (avformat_open_input(&context->iFormatCtx, anim->name, NULL, NULL) != 0) {
MEM_freeN(context);
return NULL;
}
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index a86e2bed0e5..92c10a094d3 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -247,7 +247,7 @@ void do_init_ffmpeg(void)
static int isffmpeg(const char *filename)
{
- AVFormatContext *pFormatCtx;
+ AVFormatContext *pFormatCtx = NULL;
unsigned int i;
int videoStream;
AVCodec *pCodec;
@@ -268,7 +268,7 @@ static int isffmpeg(const char *filename)
return 0;
}
- if (av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL) != 0) {
+ if (avformat_open_input(&pFormatCtx, filename, NULL, NULL) != 0) {
if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_open_input_file failed\n");
return 0;
}
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index a10d610c6d4..9bc002b7bbe 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -361,6 +361,7 @@ typedef struct bNodeSocketValueRGBA {
#define CMP_NODE_DILATEERODE_STEP 0
#define CMP_NODE_DILATEERODE_DISTANCE_THRESH 1
#define CMP_NODE_DILATEERODE_DISTANCE 2
+#define CMP_NODE_DILATEERODE_DISTANCE_FEATHER 3
typedef struct NodeFrame {
short flag;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 24d33b49db2..83bfec3cc52 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -165,7 +165,7 @@ typedef struct Object {
unsigned int lay; /* copy of Base's layer in the scene */
- int pad6;
+ float sf; /* sf is time-offset */
short flag; /* copy of Base */
short colbits DNA_DEPRECATED; /* deprecated */
@@ -180,8 +180,6 @@ typedef struct Object {
int dupon, dupoff, dupsta, dupend;
- float sf, ctime; /* sf is time-offset, ctime is the objects current time (XXX timing needs to be revised) */
-
/* during realtime */
/* note that inertia is only called inertia for historical reasons
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index 2a12fa8b116..573e27b52c2 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -289,13 +289,15 @@ static void rna_def_movieclip(BlenderRNA *brna)
/* start_frame */
prop = RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "start_frame");
- RNA_def_property_ui_text(prop, "Start Frame", "Global scene frame number at which this movie starts playing. Affects all data associated with a clip");
+ RNA_def_property_ui_text(prop, "Start Frame", "Global scene frame number at which this movie starts playing "
+ "(affects all data associated with a clip)");
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
/* frame_offset */
prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "frame_offset");
- RNA_def_property_ui_text(prop, "Frame Offset", "Offset of footage first frame relative to it's file name. Affects only how footage is loaing, not changes data associated with a clip");
+ RNA_def_property_ui_text(prop, "Frame Offset", "Offset of footage first frame relative to it's file name "
+ "(affects only how footage is loading, does not change data associated with a clip)");
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
}
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 683a49a7690..906f9cf5b1c 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2049,10 +2049,11 @@ static void def_cmp_dilate_erode(StructRNA *srna)
PropertyRNA *prop;
static EnumPropertyItem type_items[] = {
- {CMP_NODE_DILATEERODE_STEP, "STEP", 0, "Step", ""},
+ {CMP_NODE_DILATEERODE_STEP, "STEP", 0, "Step", ""},
{CMP_NODE_DILATEERODE_DISTANCE_THRESH, "THRESHOLD", 0, "Threshold", ""},
{CMP_NODE_DILATEERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
- {0, NULL, 0, NULL, NULL}
+ {CMP_NODE_DILATEERODE_DISTANCE_FEATHER,"FEATHER", 0, "Feather", ""},
+ {0, NULL, 0, NULL, NULL}
};
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index 62c3051727d..20f58f4d16e 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -161,11 +161,11 @@ DefNode( CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, "MOVIE
DefNode( CompositorNode, CMP_NODE_TRANSFORM, dev_cmd_transform, "TRANSFORM", Transform, "Transform", "" )
DefNode( CompositorNode, CMP_NODE_STABILIZE2D, def_cmp_stabilize2d, "STABILIZE2D", Stabilize, "Stabilize 2D", "" )
DefNode( CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion,"MOVIEDISTORTION",MovieDistortion, "Movie Distortion", "" )
-DefNode( CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, "BOXMASK" ,BoxMask, "Box mask", "" )
-DefNode( CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, "ELLIPSEMASK" ,EllipseMask, "Ellipse mask", "" )
-DefNode( CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, "BOKEHIMAGE" ,BokehImage, "Bokeh image", "" )
-DefNode( CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, "BOKEHBLUR" ,BokehBlur, "Bokeh Blur", "" )
-DefNode( CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, "SWITCH" ,Switch, "Switch", "" )
+DefNode( CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, "BOXMASK", BoxMask, "Box mask", "" )
+DefNode( CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, "ELLIPSEMASK", EllipseMask, "Ellipse mask", "" )
+DefNode( CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, "BOKEHIMAGE", BokehImage, "Bokeh image", "" )
+DefNode( CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, "BOKEHBLUR", BokehBlur, "Bokeh Blur", "" )
+DefNode( CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, "SWITCH", Switch, "Switch", "" )
DefNode( CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection,"COLORCORRECTION",ColorCorrection, "ColorCorrection", "" )
DefNode( CompositorNode, CMP_NODE_MASK, def_cmp_mask, "MASK", Mask, "Mask", "" )
DefNode( CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, "KEYINGSCREEN", KeyingScreen, "KeyingScreen", "" )
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 76366efe0d1..d4611f4a268 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -39,6 +39,7 @@
#include "DNA_scene_types.h"
#include "BKE_utildefines.h"
+
#ifdef RNA_RUNTIME
#include "BKE_animsys.h"
@@ -88,16 +89,18 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name
static void rna_Scene_collada_export(
Scene *scene,
const char *filepath,
- int selected,
int apply_modifiers,
- int include_armatures,
+ int export_mesh_type,
+ int selected,
int include_children,
+ int include_armatures,
+ int deform_bones_only,
int use_object_instantiation,
- int sort_by_name,
+ int sort_by_name,
int second_life)
{
- collada_export(scene, filepath, selected, apply_modifiers,
- include_armatures, include_children,
+ collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected,
+ include_children, include_armatures, deform_bones_only,
use_object_instantiation, sort_by_name, second_life);
}
@@ -126,11 +129,14 @@ void RNA_api_scene(StructRNA *srna)
parm = RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
+ parm = RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers", "Apply modifiers");
+ parm = RNA_def_int(func, "export_mesh_type", 0, INT_MIN, INT_MAX,
+ "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX);
parm = RNA_def_boolean(func, "selected", 0, "Selection Only", "Export only selected elements");
- parm = RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers", "Apply modifiers (in Preview resolution)");
- parm = RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Include armature(s) used by the exported objects");
- parm = RNA_def_boolean(func, "include_children", 0, "Include Children", "Include all children even if not selected");
- parm = RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instantiation", "Instantiate multiple Objects from same Data");
+ parm = RNA_def_boolean(func, "include_children", 0, "Include Children", "Export all children of selected objects (even if not selected)");
+ parm = RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Export related armatures (even if not selected)");
+ parm = RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures");
+ parm = RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", "Instantiate multiple Objects from same Data");
parm = RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name");
parm = RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life");
RNA_def_function_ui_description(func, "Export to collada file");
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 71133634a96..6e5aa78b8bd 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -193,6 +193,16 @@ static void rna_def_area(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_Area_type_update");
+ prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "totrct.xmin");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the area");
+
+ prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "totrct.ymin");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the area");
+
prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "winx");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -230,6 +240,16 @@ static void rna_def_region(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Region Type", "Type of this region");
+ prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "winrct.xmin");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the region");
+
+ prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "winrct.ymin");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the region");
+
prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "winx");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index c0efff2d179..4224b3936c6 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -117,18 +117,18 @@ static int rna_SmokeModifier_density_get_length(PointerRNA *ptr, int length[RNA_
{
SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
- if (settings->fluid)
- {
+ if (settings->fluid) {
float *density = smoke_get_density(settings->fluid);
unsigned int size = settings->res[0] * settings->res[1] * settings->res[2];
- if(density)
+ if (density)
length[0] = size;
else
length[0] = 0;
}
- else
- length[0] = 0; // No smoke domain created yet
+ else {
+ length[0] = 0; /* No smoke domain created yet */
+ }
return length[0];
}
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 85dee2617d8..801bec30ecf 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -780,21 +780,21 @@ static void rna_def_trackingCamera(BlenderRNA *brna)
prop = RNA_def_property(srna, "k1", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "k1");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_range(prop, -10, 10, .1, 3);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
RNA_def_property_ui_text(prop, "K1", "First coefficient of third order polynomial radial distortion");
RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
prop = RNA_def_property(srna, "k2", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "k2");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_range(prop, -10, 10, .1, 3);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
RNA_def_property_ui_text(prop, "K2", "Second coefficient of third order polynomial radial distortion");
RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
prop = RNA_def_property(srna, "k3", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "k3");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_range(prop, -10, 10, .1, 3);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
RNA_def_property_ui_text(prop, "K3", "Third coefficient of third order polynomial radial distortion");
RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index afd10d96e99..70788dfe0c8 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -32,6 +32,8 @@
#include "node_composite_util.h"
+#include <limits.h>
+
CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
{
CompBuf *cbuf= MEM_callocN(sizeof(CompBuf), "compbuf");
@@ -1300,33 +1302,35 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy)
{
double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3];
double *X, *Y, *W;
- int i, x, y, sz;
+ const unsigned int src_width = src->x;
+ const unsigned int src_height = src->y;
+ unsigned int i, x, y, sz;
// <0.5 not valid, though can have a possibly useful sort of sharpening effect
if (sigma < 0.5f) return;
-
+
if ((xy < 1) || (xy > 3)) xy = 3;
-
+
// XXX The YVV macro defined below explicitly expects sources of at least 3x3 pixels,
// so just skiping blur along faulty direction if src's def is below that limit!
- if (src->x < 3) xy &= ~(int) 1;
- if (src->y < 3) xy &= ~(int) 2;
+ if (src_width < 3) xy &= ~(int) 1;
+ if (src_height < 3) xy &= ~(int) 2;
if (xy < 1) return;
// see "Recursive Gabor Filtering" by Young/VanVliet
// all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200
if (sigma >= 3.556f)
- q = 0.9804f*(sigma - 3.556f) + 2.5091f;
- else // sigma >= 0.5
- q = (0.0561f*sigma + 0.5784f)*sigma - 0.2568f;
- q2 = q*q;
- sc = (1.1668 + q)*(3.203729649 + (2.21566 + q)*q);
+ q = 0.9804f * (sigma - 3.556f) + 2.5091f;
+ else // sigma >= 0.5
+ q = (0.0561f * sigma + 0.5784f) * sigma - 0.2568f;
+ q2 = q * q;
+ sc = (1.1668 + q) * (3.203729649 + (2.21566 + q) * q);
// no gabor filtering here, so no complex multiplies, just the regular coefs.
// all negated here, so as not to have to recalc Triggs/Sdika matrix
- cf[1] = q*(5.788961737 + (6.76492 + 3.0*q)*q)/ sc;
- cf[2] = -q2*(3.38246 + 3.0*q)/sc;
+ cf[1] = q * (5.788961737 + (6.76492 + 3.0 * q) * q) / sc;
+ cf[2] = -q2 * (3.38246 + 3.0 * q) / sc;
// 0 & 3 unchanged
- cf[3] = q2*q/sc;
+ cf[3] = q2 * q / sc;
cf[0] = 1.0 - cf[1] - cf[2] - cf[3];
// Triggs/Sdika border corrections,
@@ -1336,59 +1340,62 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy)
// but neither seem to be quite the same, result seems to be ok so far anyway.
// Extra scale factor here to not have to do it in filter,
// though maybe this had something to with the precision errors
- sc = cf[0]/((1.0 + cf[1] - cf[2] + cf[3])*(1.0 - cf[1] - cf[2] - cf[3])*(1.0 + cf[2] + (cf[1] - cf[3])*cf[3]));
- tsM[0] = sc*(-cf[3]*cf[1] + 1.0 - cf[3]*cf[3] - cf[2]);
- tsM[1] = sc*((cf[3] + cf[1])*(cf[2] + cf[3]*cf[1]));
- tsM[2] = sc*(cf[3]*(cf[1] + cf[3]*cf[2]));
- tsM[3] = sc*(cf[1] + cf[3]*cf[2]);
- tsM[4] = sc*(-(cf[2] - 1.0)*(cf[2] + cf[3]*cf[1]));
- tsM[5] = sc*(-(cf[3]*cf[1] + cf[3]*cf[3] + cf[2] - 1.0)*cf[3]);
- tsM[6] = sc*(cf[3]*cf[1] + cf[2] + cf[1]*cf[1] - cf[2]*cf[2]);
- tsM[7] = sc*(cf[1]*cf[2] + cf[3]*cf[2]*cf[2] - cf[1]*cf[3]*cf[3] - cf[3]*cf[3]*cf[3] - cf[3]*cf[2] + cf[3]);
- tsM[8] = sc*(cf[3]*(cf[1] + cf[3]*cf[2]));
-
-#define YVV(L) \
-{ \
- W[0] = cf[0]*X[0] + cf[1]*X[0] + cf[2]*X[0] + cf[3]*X[0]; \
- W[1] = cf[0]*X[1] + cf[1]*W[0] + cf[2]*X[0] + cf[3]*X[0]; \
- W[2] = cf[0]*X[2] + cf[1]*W[1] + cf[2]*W[0] + cf[3]*X[0]; \
- for (i=3; i<L; i++) \
- W[i] = cf[0]*X[i] + cf[1]*W[i-1] + cf[2]*W[i-2] + cf[3]*W[i-3]; \
- tsu[0] = W[L-1] - X[L-1]; \
- tsu[1] = W[L-2] - X[L-1]; \
- tsu[2] = W[L-3] - X[L-1]; \
- tsv[0] = tsM[0]*tsu[0] + tsM[1]*tsu[1] + tsM[2]*tsu[2] + X[L-1]; \
- tsv[1] = tsM[3]*tsu[0] + tsM[4]*tsu[1] + tsM[5]*tsu[2] + X[L-1]; \
- tsv[2] = tsM[6]*tsu[0] + tsM[7]*tsu[1] + tsM[8]*tsu[2] + X[L-1]; \
- Y[L-1] = cf[0]*W[L-1] + cf[1]*tsv[0] + cf[2]*tsv[1] + cf[3]*tsv[2]; \
- Y[L-2] = cf[0]*W[L-2] + cf[1]*Y[L-1] + cf[2]*tsv[0] + cf[3]*tsv[1]; \
- Y[L-3] = cf[0]*W[L-3] + cf[1]*Y[L-2] + cf[2]*Y[L-1] + cf[3]*tsv[0]; \
- for (i=L-4; i>=0; i--) \
- Y[i] = cf[0]*W[i] + cf[1]*Y[i+1] + cf[2]*Y[i+2] + cf[3]*Y[i+3]; \
+ sc = cf[0] / ((1.0 + cf[1] - cf[2] + cf[3]) * (1.0 - cf[1] - cf[2] - cf[3]) * (1.0 + cf[2] + (cf[1] - cf[3]) * cf[3]));
+ tsM[0] = sc * (-cf[3] * cf[1] + 1.0 - cf[3] * cf[3] - cf[2]);
+ tsM[1] = sc * ((cf[3] + cf[1]) * (cf[2] + cf[3] * cf[1]));
+ tsM[2] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
+ tsM[3] = sc * (cf[1] + cf[3] * cf[2]);
+ tsM[4] = sc * (-(cf[2] - 1.0) * (cf[2] + cf[3] * cf[1]));
+ tsM[5] = sc * (-(cf[3] * cf[1] + cf[3] * cf[3] + cf[2] - 1.0) * cf[3]);
+ tsM[6] = sc * (cf[3] * cf[1] + cf[2] + cf[1] * cf[1] - cf[2] * cf[2]);
+ tsM[7] = sc * (cf[1] * cf[2] + cf[3] * cf[2] * cf[2] - cf[1] * cf[3] * cf[3] - cf[3] * cf[3] * cf[3] - cf[3] * cf[2] + cf[3]);
+ tsM[8] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
+
+#define YVV(L) \
+{ \
+ W[0] = cf[0] * X[0] + cf[1] * X[0] + cf[2] * X[0] + cf[3] * X[0]; \
+ W[1] = cf[0] * X[1] + cf[1] * W[0] + cf[2] * X[0] + cf[3] * X[0]; \
+ W[2] = cf[0] * X[2] + cf[1] * W[1] + cf[2] * W[0] + cf[3] * X[0]; \
+ for (i = 3; i < L; i++) { \
+ W[i] = cf[0] * X[i] + cf[1] * W[i - 1] + cf[2] * W[i - 2] + cf[3] * W[i - 3]; \
+ } \
+ tsu[0] = W[L - 1] - X[L - 1]; \
+ tsu[1] = W[L - 2] - X[L - 1]; \
+ tsu[2] = W[L - 3] - X[L - 1]; \
+ tsv[0] = tsM[0] * tsu[0] + tsM[1] * tsu[1] + tsM[2] * tsu[2] + X[L - 1]; \
+ tsv[1] = tsM[3] * tsu[0] + tsM[4] * tsu[1] + tsM[5] * tsu[2] + X[L - 1]; \
+ tsv[2] = tsM[6] * tsu[0] + tsM[7] * tsu[1] + tsM[8] * tsu[2] + X[L - 1]; \
+ Y[L - 1] = cf[0] * W[L - 1] + cf[1] * tsv[0] + cf[2] * tsv[1] + cf[3] * tsv[2]; \
+ Y[L - 2] = cf[0] * W[L - 2] + cf[1] * Y[L - 1] + cf[2] * tsv[0] + cf[3] * tsv[1]; \
+ Y[L - 3] = cf[0] * W[L - 3] + cf[1] * Y[L - 2] + cf[2] * Y[L - 1] + cf[3] * tsv[0]; \
+ /* 'i != UINT_MAX' is really 'i >= 0', but necessary for unsigned int wrapping */ \
+ for (i = L - 4; i != UINT_MAX; i--) { \
+ Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3]; \
+ } \
} (void)0
// intermediate buffers
- sz = MAX2(src->x, src->y);
- X = MEM_callocN(sz*sizeof(double), "IIR_gauss X buf");
- Y = MEM_callocN(sz*sizeof(double), "IIR_gauss Y buf");
- W = MEM_callocN(sz*sizeof(double), "IIR_gauss W buf");
- if (xy & 1) { // H
- for (y=0; y<src->y; ++y) {
- const int yx = y*src->x;
- for (x=0; x<src->x; ++x)
- X[x] = src->rect[(x + yx)*src->type + chan];
- YVV(src->x);
- for (x=0; x<src->x; ++x)
- src->rect[(x + yx)*src->type + chan] = Y[x];
+ sz = MAX2(src_width, src_height);
+ X = MEM_callocN(sz * sizeof(double), "IIR_gauss X buf");
+ Y = MEM_callocN(sz * sizeof(double), "IIR_gauss Y buf");
+ W = MEM_callocN(sz * sizeof(double), "IIR_gauss W buf");
+ if (xy & 1) { // H
+ for (y = 0; y < src_height; ++y) {
+ const int yx = y * src_width;
+ for (x = 0; x < src_width; ++x)
+ X[x] = src->rect[(x + yx) * src->type + chan];
+ YVV(src_width);
+ for (x = 0; x < src_width; ++x)
+ src->rect[(x + yx) * src->type + chan] = Y[x];
}
}
- if (xy & 2) { // V
- for (x=0; x<src->x; ++x) {
- for (y=0; y<src->y; ++y)
- X[y] = src->rect[(x + y*src->x)*src->type + chan];
- YVV(src->y);
- for (y=0; y<src->y; ++y)
- src->rect[(x + y*src->x)*src->type + chan] = Y[y];
+ if (xy & 2) { // V
+ for (x = 0; x < src_width; ++x) {
+ for (y = 0; y < src_height; ++y)
+ X[y] = src->rect[(x + y * src_width) * src->type + chan];
+ YVV(src_height);
+ for (y = 0; y < src_height; ++y)
+ src->rect[(x + y * src_width) * src->type + chan] = Y[y];
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index 1b82da372ec..2ae3cd6ba56 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -29,9 +29,10 @@
* \ingroup cmpnodes
*/
-
#include "node_composite_util.h"
+#include <limits.h>
+
/* ************ qdn: Defocus node ****************** */
static bNodeSocketTemplate cmp_node_defocus_in[]= {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
@@ -148,11 +149,13 @@ static float RI_vdC(unsigned int bits, unsigned int r)
// much faster than anything else, constant time independent of width
// should extend to multichannel and make this a node, could be useful
// note: this is an almost exact copy of 'IIR_gauss'
-static void IIR_gauss_single(CompBuf* buf, float sigma)
+static void IIR_gauss_single(CompBuf *buf, float sigma)
{
double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3];
float *X, *Y, *W;
- int i, x, y, sz;
+ const unsigned int src_width = buf->x;
+ const unsigned int src_height = buf->y;
+ unsigned int i, x, y, sz;
// single channel only for now
if (buf->type != CB_VAL) return;
@@ -180,58 +183,61 @@ static void IIR_gauss_single(CompBuf* buf, float sigma)
// it seems to work, not entirely sure if it is actually totally correct,
// Besides J.M.Geusebroek's anigauss.c (see http://www.science.uva.nl/~mark),
// found one other implementation by Cristoph Lampert,
- // but neither seem to be quite the same, result seems to be ok sofar anyway.
+ // but neither seem to be quite the same, result seems to be ok so far anyway.
// Extra scale factor here to not have to do it in filter,
// though maybe this had something to with the precision errors
- sc = cf[0]/((1.0 + cf[1] - cf[2] + cf[3])*(1.0 - cf[1] - cf[2] - cf[3])*(1.0 + cf[2] + (cf[1] - cf[3])*cf[3]));
- tsM[0] = sc*(-cf[3]*cf[1] + 1.0 - cf[3]*cf[3] - cf[2]);
- tsM[1] = sc*((cf[3] + cf[1])*(cf[2] + cf[3]*cf[1]));
- tsM[2] = sc*(cf[3]*(cf[1] + cf[3]*cf[2]));
- tsM[3] = sc*(cf[1] + cf[3]*cf[2]);
- tsM[4] = sc*(-(cf[2] - 1.0)*(cf[2] + cf[3]*cf[1]));
- tsM[5] = sc*(-(cf[3]*cf[1] + cf[3]*cf[3] + cf[2] - 1.0)*cf[3]);
- tsM[6] = sc*(cf[3]*cf[1] + cf[2] + cf[1]*cf[1] - cf[2]*cf[2]);
- tsM[7] = sc*(cf[1]*cf[2] + cf[3]*cf[2]*cf[2] - cf[1]*cf[3]*cf[3] - cf[3]*cf[3]*cf[3] - cf[3]*cf[2] + cf[3]);
- tsM[8] = sc*(cf[3]*(cf[1] + cf[3]*cf[2]));
-
-#define YVV(L)\
-{\
- W[0] = cf[0]*X[0] + cf[1]*X[0] + cf[2]*X[0] + cf[3]*X[0];\
- W[1] = cf[0]*X[1] + cf[1]*W[0] + cf[2]*X[0] + cf[3]*X[0];\
- W[2] = cf[0]*X[2] + cf[1]*W[1] + cf[2]*W[0] + cf[3]*X[0];\
- for (i=3; i<L; i++)\
- W[i] = cf[0]*X[i] + cf[1]*W[i-1] + cf[2]*W[i-2] + cf[3]*W[i-3];\
- tsu[0] = W[L-1] - X[L-1];\
- tsu[1] = W[L-2] - X[L-1];\
- tsu[2] = W[L-3] - X[L-1];\
- tsv[0] = tsM[0]*tsu[0] + tsM[1]*tsu[1] + tsM[2]*tsu[2] + X[L-1];\
- tsv[1] = tsM[3]*tsu[0] + tsM[4]*tsu[1] + tsM[5]*tsu[2] + X[L-1];\
- tsv[2] = tsM[6]*tsu[0] + tsM[7]*tsu[1] + tsM[8]*tsu[2] + X[L-1];\
- Y[L-1] = cf[0]*W[L-1] + cf[1]*tsv[0] + cf[2]*tsv[1] + cf[3]*tsv[2];\
- Y[L-2] = cf[0]*W[L-2] + cf[1]*Y[L-1] + cf[2]*tsv[0] + cf[3]*tsv[1];\
- Y[L-3] = cf[0]*W[L-3] + cf[1]*Y[L-2] + cf[2]*Y[L-1] + cf[3]*tsv[0];\
- for (i=L-4; i>=0; i--)\
- Y[i] = cf[0]*W[i] + cf[1]*Y[i+1] + cf[2]*Y[i+2] + cf[3]*Y[i+3];\
-}
+ sc = cf[0] / ((1.0 + cf[1] - cf[2] + cf[3]) * (1.0 - cf[1] - cf[2] - cf[3]) * (1.0 + cf[2] + (cf[1] - cf[3]) * cf[3]));
+ tsM[0] = sc * (-cf[3] * cf[1] + 1.0 - cf[3] * cf[3] - cf[2]);
+ tsM[1] = sc * ((cf[3] + cf[1]) * (cf[2] + cf[3] * cf[1]));
+ tsM[2] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
+ tsM[3] = sc * (cf[1] + cf[3] * cf[2]);
+ tsM[4] = sc * (-(cf[2] - 1.0) * (cf[2] + cf[3] * cf[1]));
+ tsM[5] = sc * (-(cf[3] * cf[1] + cf[3] * cf[3] + cf[2] - 1.0) * cf[3]);
+ tsM[6] = sc * (cf[3] * cf[1] + cf[2] + cf[1] * cf[1] - cf[2] * cf[2]);
+ tsM[7] = sc * (cf[1] * cf[2] + cf[3] * cf[2] * cf[2] - cf[1] * cf[3] * cf[3] - cf[3] * cf[3] * cf[3] - cf[3] * cf[2] + cf[3]);
+ tsM[8] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
+
+#define YVV(L) \
+{ \
+ W[0] = cf[0] * X[0] + cf[1] * X[0] + cf[2] * X[0] + cf[3] * X[0]; \
+ W[1] = cf[0] * X[1] + cf[1] * W[0] + cf[2] * X[0] + cf[3] * X[0]; \
+ W[2] = cf[0] * X[2] + cf[1] * W[1] + cf[2] * W[0] + cf[3] * X[0]; \
+ for (i = 3; i < L; i++) { \
+ W[i] = cf[0] * X[i] + cf[1] * W[i - 1] + cf[2] * W[i - 2] + cf[3] * W[i - 3]; \
+ } \
+ tsu[0] = W[L - 1] - X[L - 1]; \
+ tsu[1] = W[L - 2] - X[L - 1]; \
+ tsu[2] = W[L - 3] - X[L - 1]; \
+ tsv[0] = tsM[0] * tsu[0] + tsM[1] * tsu[1] + tsM[2] * tsu[2] + X[L - 1]; \
+ tsv[1] = tsM[3] * tsu[0] + tsM[4] * tsu[1] + tsM[5] * tsu[2] + X[L - 1]; \
+ tsv[2] = tsM[6] * tsu[0] + tsM[7] * tsu[1] + tsM[8] * tsu[2] + X[L - 1]; \
+ Y[L - 1] = cf[0] * W[L - 1] + cf[1] * tsv[0] + cf[2] * tsv[1] + cf[3] * tsv[2]; \
+ Y[L - 2] = cf[0] * W[L - 2] + cf[1] * Y[L - 1] + cf[2] * tsv[0] + cf[3] * tsv[1]; \
+ Y[L - 3] = cf[0] * W[L - 3] + cf[1] * Y[L - 2] + cf[2] * Y[L - 1] + cf[3] * tsv[0]; \
+ /* 'i != UINT_MAX' is really 'i >= 0', but necessary for unsigned int wrapping */ \
+ for (i = L - 4; i != UINT_MAX; i--) { \
+ Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3]; \
+ } \
+} (void)0
// intermediate buffers
- sz = MAX2(buf->x, buf->y);
- Y = MEM_callocN(sz*sizeof(float), "IIR_gauss Y buf");
- W = MEM_callocN(sz*sizeof(float), "IIR_gauss W buf");
+ sz = MAX2(src_width, src_height);
+ Y = MEM_callocN(sz * sizeof(float), "IIR_gauss Y buf");
+ W = MEM_callocN(sz * sizeof(float), "IIR_gauss W buf");
// H
- for (y=0; y<buf->y; y++) {
- X = &buf->rect[y*buf->x];
- YVV(buf->x);
- memcpy(X, Y, sizeof(float)*buf->x);
+ for (y = 0; y < src_height; y++) {
+ X = &buf->rect[y * src_width];
+ YVV(src_width);
+ memcpy(X, Y, sizeof(float) * src_width);
}
// V
- X = MEM_callocN(buf->y*sizeof(float), "IIR_gauss X buf");
- for (x=0; x<buf->x; x++) {
- for (y=0; y<buf->y; y++)
- X[y] = buf->rect[x + y*buf->x];
- YVV(buf->y);
- for (y=0; y<buf->y; y++)
- buf->rect[x + y*buf->x] = Y[y];
+ X = MEM_callocN(src_height * sizeof(float), "IIR_gauss X buf");
+ for (x = 0; x < src_width; x++) {
+ for (y = 0; y < src_height; y++)
+ X[y] = buf->rect[x + y * src_width];
+ YVV(src_height);
+ for (y = 0; y < src_height; y++)
+ buf->rect[x + y * src_width] = Y[y];
}
MEM_freeN(X);
diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c
index 8363d5928bf..2f139831cc9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_dilate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c
@@ -35,13 +35,13 @@
/* **************** Dilate/Erode ******************** */
-static bNodeSocketTemplate cmp_node_dilateerode_in[]= {
- { SOCK_FLOAT, 1, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
- { -1, 0, "" }
+static bNodeSocketTemplate cmp_node_dilateerode_in[] = {
+ { SOCK_FLOAT, 1, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { -1, 0, "" }
};
-static bNodeSocketTemplate cmp_node_dilateerode_out[]= {
- { SOCK_FLOAT, 0, N_("Mask")},
- { -1, 0, "" }
+static bNodeSocketTemplate cmp_node_dilateerode_out[] = {
+ { SOCK_FLOAT, 0, N_("Mask")},
+ { -1, 0, "" }
};
static void morpho_dilate(CompBuf *cbuf)
@@ -49,31 +49,31 @@ static void morpho_dilate(CompBuf *cbuf)
int x, y;
float *p, *rectf = cbuf->rect;
- for (y=0; y < cbuf->y; y++) {
- for (x=0; x < cbuf->x-1; x++) {
- p = rectf + cbuf->x*y + x;
- *p = MAX2(*p, *(p + 1));
+ for (y = 0; y < cbuf->y; y++) {
+ for (x = 0; x < cbuf->x - 1; x++) {
+ p = rectf + cbuf->x * y + x;
+ *p = maxf(*p, *(p + 1));
}
}
- for (y=0; y < cbuf->y; y++) {
- for (x=cbuf->x-1; x >= 1; x--) {
- p = rectf + cbuf->x*y + x;
- *p = MAX2(*p, *(p - 1));
+ for (y = 0; y < cbuf->y; y++) {
+ for (x = cbuf->x - 1; x >= 1; x--) {
+ p = rectf + cbuf->x * y + x;
+ *p = maxf(*p, *(p - 1));
}
}
- for (x=0; x < cbuf->x; x++) {
- for (y=0; y < cbuf->y-1; y++) {
- p = rectf + cbuf->x*y + x;
- *p = MAX2(*p, *(p + cbuf->x));
+ for (x = 0; x < cbuf->x; x++) {
+ for (y = 0; y < cbuf->y - 1; y++) {
+ p = rectf + cbuf->x * y + x;
+ *p = maxf(*p, *(p + cbuf->x));
}
}
- for (x=0; x < cbuf->x; x++) {
- for (y=cbuf->y-1; y >= 1; y--) {
- p = rectf + cbuf->x*y + x;
- *p = MAX2(*p, *(p - cbuf->x));
+ for (x = 0; x < cbuf->x; x++) {
+ for (y = cbuf->y - 1; y >= 1; y--) {
+ p = rectf + cbuf->x * y + x;
+ *p = maxf(*p, *(p - cbuf->x));
}
}
}
@@ -83,31 +83,31 @@ static void morpho_erode(CompBuf *cbuf)
int x, y;
float *p, *rectf = cbuf->rect;
- for (y=0; y < cbuf->y; y++) {
- for (x=0; x < cbuf->x-1; x++) {
- p = rectf + cbuf->x*y + x;
- *p = MIN2(*p, *(p + 1));
+ for (y = 0; y < cbuf->y; y++) {
+ for (x = 0; x < cbuf->x - 1; x++) {
+ p = rectf + cbuf->x * y + x;
+ *p = minf(*p, *(p + 1));
}
}
- for (y=0; y < cbuf->y; y++) {
- for (x=cbuf->x-1; x >= 1; x--) {
- p = rectf + cbuf->x*y + x;
- *p = MIN2(*p, *(p - 1));
+ for (y = 0; y < cbuf->y; y++) {
+ for (x = cbuf->x - 1; x >= 1; x--) {
+ p = rectf + cbuf->x * y + x;
+ *p = minf(*p, *(p - 1));
}
}
- for (x=0; x < cbuf->x; x++) {
- for (y=0; y < cbuf->y-1; y++) {
- p = rectf + cbuf->x*y + x;
- *p = MIN2(*p, *(p + cbuf->x));
+ for (x = 0; x < cbuf->x; x++) {
+ for (y = 0; y < cbuf->y - 1; y++) {
+ p = rectf + cbuf->x * y + x;
+ *p = minf(*p, *(p + cbuf->x));
}
}
- for (x=0; x < cbuf->x; x++) {
- for (y=cbuf->y-1; y >= 1; y--) {
- p = rectf + cbuf->x*y + x;
- *p = MIN2(*p, *(p - cbuf->x));
+ for (x = 0; x < cbuf->x; x++) {
+ for (y = cbuf->y - 1; y >= 1; y--) {
+ p = rectf + cbuf->x * y + x;
+ *p = minf(*p, *(p - cbuf->x));
}
}
@@ -117,18 +117,17 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod
{
/* stack order in: mask */
/* stack order out: mask */
- if (out[0]->hasoutput==0)
+ if (out[0]->hasoutput == 0)
return;
/* input no image? then only color operation */
- if (in[0]->data==NULL) {
- out[0]->vec[0] = out[0]->vec[1] = out[0]->vec[2] = 0.0f;
- out[0]->vec[3] = 0.0f;
+ if (in[0]->data == NULL) {
+ zero_v4(out[0]->vec);
}
else {
/* make output size of input image */
- CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_VAL);
- CompBuf *stackbuf= dupalloc_compbuf(cbuf);
+ CompBuf *cbuf = typecheck_compbuf(in[0]->data, CB_VAL);
+ CompBuf *stackbuf = dupalloc_compbuf(cbuf);
short i;
if (node->custom2 > 0) { // positive, dilate
@@ -140,10 +139,10 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod
morpho_erode(stackbuf);
}
- if (cbuf!=in[0]->data)
+ if (cbuf != in[0]->data)
free_compbuf(cbuf);
- out[0]->data= stackbuf;
+ out[0]->data = stackbuf;
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c
index d323839e690..91c3e9fbaf7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mask.c
@@ -72,7 +72,7 @@ static void exec(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **
BKE_mask_rasterize(mask, sx, sy, res, TRUE, node->custom1);
- if(node->custom1){
+ if (node->custom1) {
PLX_antialias_buffer(res,sx,sy);
}
/* pass on output and free */
diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.c b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
index 6456742e22b..beefc0b6eae 100644
--- a/source/blender/nodes/shader/nodes/node_shader_particle_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
@@ -36,13 +36,13 @@ static bNodeSocketTemplate outputs[] = {
/* node type definition */
void register_node_type_sh_particle_info(bNodeTreeType *ttype)
{
- static bNodeType ntype;
+ static bNodeType ntype;
- node_type_base(ttype, &ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT, 0);
- node_type_compatibility(&ntype, NODE_NEW_SHADING);
- node_type_socket_templates(&ntype, NULL, outputs);
- node_type_size(&ntype, 150, 60, 200);
+ node_type_base(ttype, &ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT, 0);
+ node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_socket_templates(&ntype, NULL, outputs);
+ node_type_size(&ntype, 150, 60, 200);
- nodeRegisterType(ttype, &ntype);
+ nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c
index 255ed9e51fc..28d03db1687 100644
--- a/source/blender/nodes/texture/node_texture_util.c
+++ b/source/blender/nodes/texture/node_texture_util.c
@@ -88,9 +88,9 @@ void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread)
}
if (in->hasoutput && in->sockettype == SOCK_VECTOR) {
- out[0] = out[0] * .5f + .5f;
- out[1] = out[1] * .5f + .5f;
- out[2] = out[2] * .5f + .5f;
+ out[0] = out[0] * 0.5f + 0.5f;
+ out[1] = out[1] * 0.5f + 0.5f;
+ out[2] = out[2] * 0.5f + 0.5f;
out[3] = 1;
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c
index ded3afe4c6b..2add5c820eb 100644
--- a/source/blender/nodes/texture/nodes/node_texture_coord.c
+++ b/source/blender/nodes/texture/nodes/node_texture_coord.c
@@ -40,9 +40,7 @@ static bNodeSocketTemplate outputs[]= {
static void vectorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **UNUSED(in), short UNUSED(thread))
{
- out[0] = p->co[0];
- out[1] = p->co[1];
- out[2] = p->co[2];
+ copy_v3_v3(out, p->co);
}
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
index 52455e024b4..6863eab9150 100644
--- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
+++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
@@ -80,7 +80,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
float col[4];
tex_input_rgba(col, in[4], p, thread);
- hue += 0.5f; /* [-.5, .5] -> [0, 1] */
+ hue += 0.5f; /* [-0.5, 0.5] -> [0, 1] */
do_hue_sat_fac(node, out, hue, sat, val, col, fac);
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index 0d985273eda..98382e24290 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]) < .01) ? white : red);
+ copy_v4_v4(out, (fabs(co[0] - co[1]) < 0.01) ? white : red);
}
else if (nodetex) {
TexResult texres;
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 54044b62e04..8fb3a3f74d6 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1874,7 +1874,7 @@ static PyObject *Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
{
VectorObject *vecA = NULL, *vecB = NULL;
int result = 0;
- double epsilon = .000001f;
+ double epsilon = 0.000001f;
double lenA, lenB;
if (!VectorObject_Check(objectA) || !VectorObject_Check(objectB)) {
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index c23a93a52fe..5bb3e4605a2 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -64,15 +64,17 @@ static RenderEngineType internal_render_type = {
NULL, NULL,
"BLENDER_RENDER", N_("Blender Render"), RE_INTERNAL,
NULL, NULL, NULL, NULL,
- {NULL, NULL, NULL}};
+ {NULL, NULL, NULL}
+};
#ifdef WITH_GAMEENGINE
static RenderEngineType internal_game_type = {
NULL, NULL,
- "BLENDER_GAME", N_("Blender Game"), RE_INTERNAL|RE_GAME,
+ "BLENDER_GAME", N_("Blender Game"), RE_INTERNAL | RE_GAME,
NULL, NULL, NULL, NULL,
- {NULL, NULL, NULL}};
+ {NULL, NULL, NULL}
+};
#endif
@@ -90,8 +92,8 @@ void RE_engines_exit(void)
{
RenderEngineType *type, *next;
- for (type=R_engines.first; type; type=next) {
- next= type->next;
+ for (type = R_engines.first; type; type = next) {
+ next = type->next;
BLI_remlink(&R_engines, type);
@@ -108,16 +110,16 @@ RenderEngineType *RE_engines_find(const char *idname)
{
RenderEngineType *type;
- type= BLI_findstring(&R_engines, idname, offsetof(RenderEngineType, idname));
+ type = BLI_findstring(&R_engines, idname, offsetof(RenderEngineType, idname));
if (!type)
- type= &internal_render_type;
+ type = &internal_render_type;
return type;
}
int RE_engine_is_external(Render *re)
{
- RenderEngineType *type= RE_engines_find(re->r.engine);
+ RenderEngineType *type = RE_engines_find(re->r.engine);
return (type && type->render);
}
@@ -126,7 +128,7 @@ int RE_engine_is_external(Render *re)
RenderEngine *RE_engine_create(RenderEngineType *type)
{
RenderEngine *engine = MEM_callocN(sizeof(RenderEngine), "RenderEngine");
- engine->type= type;
+ engine->type = type;
return engine;
}
@@ -149,7 +151,7 @@ void RE_engine_free(RenderEngine *engine)
RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h)
{
- Render *re= engine->re;
+ Render *re = engine->re;
RenderResult *result;
rcti disprect;
@@ -160,17 +162,17 @@ RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w,
CLAMP(h, 0, re->result->recty);
if (x + w > re->result->rectx)
- w= re->result->rectx - x;
+ w = re->result->rectx - x;
if (y + h > re->result->recty)
- h= re->result->recty - y;
+ h = re->result->recty - y;
/* allocate a render result */
disprect.xmin = x;
- disprect.xmax = x+w;
+ disprect.xmax = x + w;
disprect.ymin = y;
- disprect.ymax = y+h;
+ disprect.ymax = y + h;
- result= render_result_new(re, &disprect, 0, RR_USE_MEM);
+ result = render_result_new(re, &disprect, 0, RR_USE_MEM);
BLI_addtail(&engine->fullresult, result);
result->tilerect.xmin += re->disprect.xmin;
@@ -183,17 +185,17 @@ RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w,
void RE_engine_update_result(RenderEngine *engine, RenderResult *result)
{
- Render *re= engine->re;
+ Render *re = engine->re;
if (result) {
- result->renlay= result->layers.first; // weak, draws first layer always
+ result->renlay = result->layers.first; // weak, draws first layer always
re->display_draw(re->ddh, result, NULL);
}
}
void RE_engine_end_result(RenderEngine *engine, RenderResult *result)
{
- Render *re= engine->re;
+ Render *re = engine->re;
if (!result)
return;
@@ -204,7 +206,7 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result)
/* draw */
if (!re->test_break(re->tbh)) {
- result->renlay= result->layers.first; // weak, draws first layer always
+ result->renlay = result->layers.first; // weak, draws first layer always
re->display_draw(re->ddh, result, NULL);
}
@@ -216,7 +218,7 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result)
int RE_engine_test_break(RenderEngine *engine)
{
- Render *re= engine->re;
+ Render *re = engine->re;
if (re)
return re->test_break(re->tbh);
@@ -228,34 +230,34 @@ int RE_engine_test_break(RenderEngine *engine)
void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info)
{
- Render *re= engine->re;
+ Render *re = engine->re;
/* stats draw callback */
if (re) {
- re->i.statstr= stats;
- re->i.infostr= info;
+ re->i.statstr = stats;
+ re->i.infostr = info;
re->stats_draw(re->sdh, &re->i);
- re->i.infostr= NULL;
- re->i.statstr= NULL;
+ re->i.infostr = NULL;
+ re->i.statstr = NULL;
}
/* set engine text */
if (engine->text) {
MEM_freeN(engine->text);
- engine->text= NULL;
+ engine->text = NULL;
}
if (stats && stats[0] && info && info[0])
- engine->text= BLI_sprintfN("%s | %s", stats, info);
+ engine->text = BLI_sprintfN("%s | %s", stats, info);
else if (info && info[0])
- engine->text= BLI_strdup(info);
+ engine->text = BLI_strdup(info);
else if (stats && stats[0])
- engine->text= BLI_strdup(stats);
+ engine->text = BLI_strdup(stats);
}
void RE_engine_update_progress(RenderEngine *engine, float progress)
{
- Render *re= engine->re;
+ Render *re = engine->re;
if (re) {
CLAMP(progress, 0.0f, 1.0f);
@@ -272,7 +274,7 @@ void RE_engine_report(RenderEngine *engine, int type, const char *msg)
int RE_engine_render(Render *re, int do_all)
{
- RenderEngineType *type= RE_engines_find(re->r.engine);
+ RenderEngineType *type = RE_engines_find(re->r.engine);
RenderEngine *engine;
/* verify if we can render */
@@ -287,24 +289,24 @@ int RE_engine_render(Render *re, int do_all)
/* create render result */
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
- if (re->result==NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
+ if (re->result == NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
if (re->result)
render_result_free(re->result);
- re->result= render_result_new(re, &re->disprect, 0, 0);
+ re->result = render_result_new(re, &re->disprect, 0, 0);
}
BLI_rw_mutex_unlock(&re->resultmutex);
- if (re->result==NULL)
+ if (re->result == NULL)
return 1;
/* set render info */
- re->i.cfra= re->scene->r.cfra;
- BLI_strncpy(re->i.scenename, re->scene->id.name+2, sizeof(re->i.scenename));
- re->i.totface=re->i.totvert=re->i.totstrand=re->i.totlamp=re->i.tothalo= 0;
+ re->i.cfra = re->scene->r.cfra;
+ BLI_strncpy(re->i.scenename, re->scene->id.name + 2, sizeof(re->i.scenename));
+ re->i.totface = re->i.totvert = re->i.totstrand = re->i.totlamp = re->i.tothalo = 0;
/* render */
engine = RE_engine_create(type);
- engine->re= re;
+ engine->re = re;
if (re->flag & R_ANIMATION)
engine->flag |= RE_ENGINE_ANIMATION;
@@ -312,7 +314,7 @@ int RE_engine_render(Render *re, int do_all)
engine->flag |= RE_ENGINE_PREVIEW;
engine->camera_override = re->camera_override;
- if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0)
+ if ((re->r.scemode & (R_NO_FRAME_UPDATE | R_PREVIEWBUTS)) == 0)
BKE_scene_update_for_newframe(re->main, re->scene, re->lay);
if (type->update)
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index c0382834987..33a777381aa 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -87,12 +87,12 @@
static void init_render_jit(Render *re)
{
- static float jit[32][2]; /* simple caching */
- static float mblur_jit[32][2]; /* simple caching */
- static int lastjit= 0;
- static int last_mblur_jit= 0;
+ static float jit[32][2]; /* simple caching */
+ static float mblur_jit[32][2]; /* simple caching */
+ static int lastjit = 0;
+ static int last_mblur_jit = 0;
- if (lastjit!=re->r.osa || last_mblur_jit != re->r.mblur_samples) {
+ if (lastjit != re->r.osa || last_mblur_jit != re->r.mblur_samples) {
memset(jit, 0, sizeof(jit));
BLI_jitter_init(jit[0], re->r.osa);
@@ -100,10 +100,10 @@ static void init_render_jit(Render *re)
BLI_jitter_init(mblur_jit[0], re->r.mblur_samples);
}
- lastjit= re->r.osa;
+ lastjit = re->r.osa;
memcpy(re->jit, jit, sizeof(jit));
- last_mblur_jit= re->r.mblur_samples;
+ last_mblur_jit = re->r.mblur_samples;
memcpy(re->mblur_jit, mblur_jit, sizeof(mblur_jit));
}
@@ -113,135 +113,135 @@ static void init_render_jit(Render *re)
static float filt_quadratic(float x)
{
if (x < 0.0f) x = -x;
- if (x < 0.5f) return 0.75f-(x*x);
- if (x < 1.5f) return 0.50f*(x-1.5f)*(x-1.5f);
+ if (x < 0.5f) return 0.75f - (x * x);
+ if (x < 1.5f) return 0.50f * (x - 1.5f) * (x - 1.5f);
return 0.0f;
}
static float filt_cubic(float x)
{
- float x2= x*x;
+ float x2 = x * x;
if (x < 0.0f) x = -x;
- if (x < 1.0f) return 0.5f*x*x2 - x2 + 2.0f/3.0f;
- if (x < 2.0f) return (2.0f-x)*(2.0f-x)*(2.0f-x)/6.0f;
+ if (x < 1.0f) return 0.5f * x * x2 - x2 + 2.0f / 3.0f;
+ if (x < 2.0f) return (2.0f - x) * (2.0f - x) * (2.0f - x) / 6.0f;
return 0.0f;
}
static float filt_catrom(float x)
{
- float x2= x*x;
+ float x2 = x * x;
if (x < 0.0f) x = -x;
- if (x < 1.0f) return 1.5f*x2*x - 2.5f*x2 + 1.0f;
- if (x < 2.0f) return -0.5f*x2*x + 2.5f*x2 - 4.0f*x + 2.0f;
+ if (x < 1.0f) return 1.5f * x2 * x - 2.5f * x2 + 1.0f;
+ if (x < 2.0f) return -0.5f * x2 * x + 2.5f * x2 - 4.0f * x + 2.0f;
return 0.0f;
}
-static float filt_mitchell(float x) /* Mitchell & Netravali's two-param cubic */
+static float filt_mitchell(float x) /* Mitchell & Netravali's two-param cubic */
{
- float b = 1.0f/3.0f, c = 1.0f/3.0f;
- float p0 = ( 6.0f - 2.0f*b ) / 6.0f;
- float p2 = (-18.0f + 12.0f*b + 6.0f*c) / 6.0f;
- float p3 = ( 12.0f - 9.0f*b - 6.0f*c) / 6.0f;
- float q0 = ( 8.0f*b + 24.0f*c) / 6.0f;
- float q1 = ( - 12.0f *b - 48.0f*c) / 6.0f;
- float q2 = ( 6.0f *b + 30.0f*c) / 6.0f;
- float q3 = ( - b - 6.0f*c) / 6.0f;
-
- if (x<-2.0f) return 0.0f;
- if (x<-1.0f) return (q0-x*(q1-x*(q2-x*q3)));
- if (x< 0.0f) return (p0+x*x*(p2-x*p3));
- if (x< 1.0f) return (p0+x*x*(p2+x*p3));
- if (x< 2.0f) return (q0+x*(q1+x*(q2+x*q3)));
+ float b = 1.0f / 3.0f, c = 1.0f / 3.0f;
+ float p0 = ( 6.0f - 2.0f * b) / 6.0f;
+ float p2 = (-18.0f + 12.0f * b + 6.0f * c) / 6.0f;
+ float p3 = ( 12.0f - 9.0f * b - 6.0f * c) / 6.0f;
+ float q0 = ( 8.0f * b + 24.0f * c) / 6.0f;
+ float q1 = ( -12.0f * b - 48.0f * c) / 6.0f;
+ float q2 = ( 6.0f * b + 30.0f * c) / 6.0f;
+ float q3 = ( -b - 6.0f * c) / 6.0f;
+
+ if (x < -2.0f) return 0.0f;
+ if (x < -1.0f) return (q0 - x * (q1 - x * (q2 - x * q3)));
+ if (x < 0.0f) return (p0 + x * x * (p2 - x * p3));
+ if (x < 1.0f) return (p0 + x * x * (p2 + x * p3));
+ if (x < 2.0f) return (q0 + x * (q1 + x * (q2 + x * q3)));
return 0.0f;
}
/* x ranges from -1 to 1 */
float RE_filter_value(int type, float x)
{
- float gaussfac= 1.6f;
+ float gaussfac = 1.6f;
- x= ABS(x);
+ x = ABS(x);
switch (type) {
case R_FILTER_BOX:
- if (x>1.0f) return 0.0f;
+ if (x > 1.0f) return 0.0f;
return 1.0f;
case R_FILTER_TENT:
- if (x>1.0f) return 0.0f;
- return 1.0f-x;
+ if (x > 1.0f) return 0.0f;
+ return 1.0f - x;
case R_FILTER_GAUSS:
- x*= gaussfac;
- return (1.0f/expf(x*x) - 1.0f/expf(gaussfac*gaussfac*2.25f));
+ x *= gaussfac;
+ return (1.0f / expf(x * x) - 1.0f / expf(gaussfac * gaussfac * 2.25f));
case R_FILTER_MITCH:
- return filt_mitchell(x*gaussfac);
+ return filt_mitchell(x * gaussfac);
case R_FILTER_QUAD:
- return filt_quadratic(x*gaussfac);
+ return filt_quadratic(x * gaussfac);
case R_FILTER_CUBIC:
- return filt_cubic(x*gaussfac);
+ return filt_cubic(x * gaussfac);
case R_FILTER_CATROM:
- return filt_catrom(x*gaussfac);
+ return filt_catrom(x * gaussfac);
}
return 0.0f;
}
static float calc_weight(Render *re, float *weight, int i, int j)
{
- float x, y, dist, totw= 0.0;
+ float x, y, dist, totw = 0.0;
int a;
- for (a=0; a<re->osa; a++) {
- x= re->jit[a][0] + i;
- y= re->jit[a][1] + j;
- dist= sqrt(x*x+y*y);
+ for (a = 0; a < re->osa; a++) {
+ x = re->jit[a][0] + i;
+ y = re->jit[a][1] + j;
+ dist = sqrt(x * x + y * y);
- weight[a]= 0.0;
+ weight[a] = 0.0;
/* Weighting choices */
switch (re->r.filtertype) {
- case R_FILTER_BOX:
- if (i==0 && j==0) weight[a]= 1.0;
- break;
+ case R_FILTER_BOX:
+ if (i == 0 && j == 0) weight[a] = 1.0;
+ break;
- case R_FILTER_TENT:
- if (dist < re->r.gauss)
- weight[a]= re->r.gauss - dist;
- break;
+ case R_FILTER_TENT:
+ if (dist < re->r.gauss)
+ weight[a] = re->r.gauss - dist;
+ break;
- case R_FILTER_GAUSS:
- x = dist*re->r.gauss;
- weight[a]= (1.0f/expf(x*x) - 1.0f/expf(re->r.gauss*re->r.gauss*2.25f));
- break;
+ case R_FILTER_GAUSS:
+ x = dist * re->r.gauss;
+ weight[a] = (1.0f / expf(x * x) - 1.0f / expf(re->r.gauss * re->r.gauss * 2.25f));
+ break;
- case R_FILTER_MITCH:
- weight[a]= filt_mitchell(dist*re->r.gauss);
- break;
+ case R_FILTER_MITCH:
+ weight[a] = filt_mitchell(dist * re->r.gauss);
+ break;
- case R_FILTER_QUAD:
- weight[a]= filt_quadratic(dist*re->r.gauss);
- break;
+ case R_FILTER_QUAD:
+ weight[a] = filt_quadratic(dist * re->r.gauss);
+ break;
- case R_FILTER_CUBIC:
- weight[a]= filt_cubic(dist*re->r.gauss);
- break;
+ case R_FILTER_CUBIC:
+ weight[a] = filt_cubic(dist * re->r.gauss);
+ break;
- case R_FILTER_CATROM:
- weight[a]= filt_catrom(dist*re->r.gauss);
- break;
+ case R_FILTER_CATROM:
+ weight[a] = filt_catrom(dist * re->r.gauss);
+ break;
}
- totw+= weight[a];
+ totw += weight[a];
}
return totw;
@@ -252,21 +252,21 @@ void free_sample_tables(Render *re)
int a;
if (re->samples) {
- for (a=0; a<9; a++) {
+ for (a = 0; a < 9; a++) {
MEM_freeN(re->samples->fmask1[a]);
MEM_freeN(re->samples->fmask2[a]);
}
MEM_freeN(re->samples->centmask);
MEM_freeN(re->samples);
- re->samples= NULL;
+ re->samples = NULL;
}
}
/* based on settings in render, it makes the lookup tables */
void make_sample_tables(Render *re)
{
- static int firsttime= 1;
+ static int firsttime = 1;
SampleTables *st;
float flweight[32];
float weight[32], totw, val, *fpx1, *fpx2, *fpy1, *fpy2, *m3, *m4;
@@ -274,27 +274,27 @@ void make_sample_tables(Render *re)
/* optimization tables, only once */
if (firsttime) {
- firsttime= 0;
+ firsttime = 0;
}
free_sample_tables(re);
- init_render_jit(re); /* needed for mblur too */
+ init_render_jit(re); /* needed for mblur too */
- if (re->osa==0) {
+ if (re->osa == 0) {
/* just prevents cpu cycles for larger render and copying */
- re->r.filtertype= 0;
+ re->r.filtertype = 0;
return;
}
- st= re->samples= MEM_callocN(sizeof(SampleTables), "sample tables");
+ st = re->samples = MEM_callocN(sizeof(SampleTables), "sample tables");
- for (a=0; a<9;a++) {
- st->fmask1[a]= MEM_callocN(256*sizeof(float), "initfilt");
- st->fmask2[a]= MEM_callocN(256*sizeof(float), "initfilt");
+ for (a = 0; a < 9; a++) {
+ st->fmask1[a] = MEM_callocN(256 * sizeof(float), "initfilt");
+ st->fmask2[a] = MEM_callocN(256 * sizeof(float), "initfilt");
}
- for (a=0; a<256; a++) {
- st->cmask[a]= 0;
+ for (a = 0; a < 256; a++) {
+ st->cmask[a] = 0;
if (a & 1) st->cmask[a]++;
if (a & 2) st->cmask[a]++;
if (a & 4) st->cmask[a]++;
@@ -305,64 +305,64 @@ void make_sample_tables(Render *re)
if (a & 128) st->cmask[a]++;
}
- st->centmask= MEM_mallocN((1<<re->osa), "Initfilt3");
+ st->centmask = MEM_mallocN((1 << re->osa), "Initfilt3");
- for (a=0; a<16; a++) {
- st->centLut[a]= -0.45f+((float)a)/16.0f;
+ for (a = 0; a < 16; a++) {
+ st->centLut[a] = -0.45f + ((float)a) / 16.0f;
}
/* calculate totw */
- totw= 0.0;
- for (j= -1; j<2; j++) {
- for (i= -1; i<2; i++) {
- totw+= calc_weight(re, weight, i, j);
+ totw = 0.0;
+ for (j = -1; j < 2; j++) {
+ for (i = -1; i < 2; i++) {
+ totw += calc_weight(re, weight, i, j);
}
}
- for (j= -1; j<2; j++) {
- for (i= -1; i<2; i++) {
+ for (j = -1; j < 2; j++) {
+ for (i = -1; i < 2; i++) {
/* calculate using jit, with offset the weights */
memset(weight, 0, sizeof(weight));
calc_weight(re, weight, i, j);
- for (a=0; a<16; a++) flweight[a]= weight[a]*(1.0f/totw);
+ for (a = 0; a < 16; a++) flweight[a] = weight[a] * (1.0f / totw);
- m3= st->fmask1[ 3*(j+1)+i+1 ];
- m4= st->fmask2[ 3*(j+1)+i+1 ];
+ m3 = st->fmask1[3 * (j + 1) + i + 1];
+ m4 = st->fmask2[3 * (j + 1) + i + 1];
- for (a=0; a<256; a++) {
+ for (a = 0; a < 256; a++) {
if (a & 1) {
- m3[a]+= flweight[0];
- m4[a]+= flweight[8];
+ m3[a] += flweight[0];
+ m4[a] += flweight[8];
}
if (a & 2) {
- m3[a]+= flweight[1];
- m4[a]+= flweight[9];
+ m3[a] += flweight[1];
+ m4[a] += flweight[9];
}
if (a & 4) {
- m3[a]+= flweight[2];
- m4[a]+= flweight[10];
+ m3[a] += flweight[2];
+ m4[a] += flweight[10];
}
if (a & 8) {
- m3[a]+= flweight[3];
- m4[a]+= flweight[11];
+ m3[a] += flweight[3];
+ m4[a] += flweight[11];
}
if (a & 16) {
- m3[a]+= flweight[4];
- m4[a]+= flweight[12];
+ m3[a] += flweight[4];
+ m4[a] += flweight[12];
}
if (a & 32) {
- m3[a]+= flweight[5];
- m4[a]+= flweight[13];
+ m3[a] += flweight[5];
+ m4[a] += flweight[13];
}
if (a & 64) {
- m3[a]+= flweight[6];
- m4[a]+= flweight[14];
+ m3[a] += flweight[6];
+ m4[a] += flweight[14];
}
if (a & 128) {
- m3[a]+= flweight[7];
- m4[a]+= flweight[15];
+ m3[a] += flweight[7];
+ m4[a] += flweight[15];
}
}
}
@@ -370,71 +370,71 @@ void make_sample_tables(Render *re)
/* centmask: the correct subpixel offset per mask */
- fpx1= MEM_mallocN(256*sizeof(float), "initgauss4");
- fpx2= MEM_mallocN(256*sizeof(float), "initgauss4");
- fpy1= MEM_mallocN(256*sizeof(float), "initgauss4");
- fpy2= MEM_mallocN(256*sizeof(float), "initgauss4");
- for (a=0; a<256; a++) {
- fpx1[a]= fpx2[a]= 0.0;
- fpy1[a]= fpy2[a]= 0.0;
+ fpx1 = MEM_mallocN(256 * sizeof(float), "initgauss4");
+ fpx2 = MEM_mallocN(256 * sizeof(float), "initgauss4");
+ fpy1 = MEM_mallocN(256 * sizeof(float), "initgauss4");
+ fpy2 = MEM_mallocN(256 * sizeof(float), "initgauss4");
+ for (a = 0; a < 256; a++) {
+ fpx1[a] = fpx2[a] = 0.0;
+ fpy1[a] = fpy2[a] = 0.0;
if (a & 1) {
- fpx1[a]+= re->jit[0][0];
- fpy1[a]+= re->jit[0][1];
- fpx2[a]+= re->jit[8][0];
- fpy2[a]+= re->jit[8][1];
+ fpx1[a] += re->jit[0][0];
+ fpy1[a] += re->jit[0][1];
+ fpx2[a] += re->jit[8][0];
+ fpy2[a] += re->jit[8][1];
}
if (a & 2) {
- fpx1[a]+= re->jit[1][0];
- fpy1[a]+= re->jit[1][1];
- fpx2[a]+= re->jit[9][0];
- fpy2[a]+= re->jit[9][1];
+ fpx1[a] += re->jit[1][0];
+ fpy1[a] += re->jit[1][1];
+ fpx2[a] += re->jit[9][0];
+ fpy2[a] += re->jit[9][1];
}
if (a & 4) {
- fpx1[a]+= re->jit[2][0];
- fpy1[a]+= re->jit[2][1];
- fpx2[a]+= re->jit[10][0];
- fpy2[a]+= re->jit[10][1];
+ fpx1[a] += re->jit[2][0];
+ fpy1[a] += re->jit[2][1];
+ fpx2[a] += re->jit[10][0];
+ fpy2[a] += re->jit[10][1];
}
if (a & 8) {
- fpx1[a]+= re->jit[3][0];
- fpy1[a]+= re->jit[3][1];
- fpx2[a]+= re->jit[11][0];
- fpy2[a]+= re->jit[11][1];
+ fpx1[a] += re->jit[3][0];
+ fpy1[a] += re->jit[3][1];
+ fpx2[a] += re->jit[11][0];
+ fpy2[a] += re->jit[11][1];
}
if (a & 16) {
- fpx1[a]+= re->jit[4][0];
- fpy1[a]+= re->jit[4][1];
- fpx2[a]+= re->jit[12][0];
- fpy2[a]+= re->jit[12][1];
+ fpx1[a] += re->jit[4][0];
+ fpy1[a] += re->jit[4][1];
+ fpx2[a] += re->jit[12][0];
+ fpy2[a] += re->jit[12][1];
}
if (a & 32) {
- fpx1[a]+= re->jit[5][0];
- fpy1[a]+= re->jit[5][1];
- fpx2[a]+= re->jit[13][0];
- fpy2[a]+= re->jit[13][1];
+ fpx1[a] += re->jit[5][0];
+ fpy1[a] += re->jit[5][1];
+ fpx2[a] += re->jit[13][0];
+ fpy2[a] += re->jit[13][1];
}
if (a & 64) {
- fpx1[a]+= re->jit[6][0];
- fpy1[a]+= re->jit[6][1];
- fpx2[a]+= re->jit[14][0];
- fpy2[a]+= re->jit[14][1];
+ fpx1[a] += re->jit[6][0];
+ fpy1[a] += re->jit[6][1];
+ fpx2[a] += re->jit[14][0];
+ fpy2[a] += re->jit[14][1];
}
if (a & 128) {
- fpx1[a]+= re->jit[7][0];
- fpy1[a]+= re->jit[7][1];
- fpx2[a]+= re->jit[15][0];
- fpy2[a]+= re->jit[15][1];
+ fpx1[a] += re->jit[7][0];
+ fpy1[a] += re->jit[7][1];
+ fpx2[a] += re->jit[15][0];
+ fpy2[a] += re->jit[15][1];
}
}
- for (a= (1<<re->osa)-1; a>0; a--) {
- val= st->cmask[a & 255] + st->cmask[a>>8];
- i= 8+(15.9f*(fpy1[a & 255]+fpy2[a>>8])/val);
+ for (a = (1 << re->osa) - 1; a > 0; a--) {
+ val = st->cmask[a & 255] + st->cmask[a >> 8];
+ i = 8 + (15.9f * (fpy1[a & 255] + fpy2[a >> 8]) / val);
CLAMP(i, 0, 15);
- j= 8+(15.9f*(fpx1[a & 255]+fpx2[a>>8])/val);
+ j = 8 + (15.9f * (fpx1[a & 255] + fpx2[a >> 8]) / val);
CLAMP(j, 0, 15);
- i= j + (i<<4);
- st->centmask[a]= i;
+ i = j + (i << 4);
+ st->centmask[a] = i;
}
MEM_freeN(fpx1);
@@ -455,13 +455,13 @@ static void re_camera_params_get(Render *re, CameraParams *params, Object *cam_o
{
copy_m4_m4(re->winmat, params->winmat);
- re->clipsta= params->clipsta;
- re->clipend= params->clipend;
+ re->clipsta = params->clipsta;
+ re->clipend = params->clipend;
- re->ycor= params->ycor;
- re->viewdx= params->viewdx;
- re->viewdy= params->viewdy;
- re->viewplane= params->viewplane;
+ re->ycor = params->ycor;
+ re->viewdx = params->viewdx;
+ re->viewdy = params->viewdy;
+ re->viewplane = params->viewplane;
BKE_camera_object_mode(&re->r, cam_ob);
}
@@ -474,12 +474,12 @@ void RE_SetEnvmapCamera(Render *re, Object *cam_ob, float viewscale, float clips
BKE_camera_params_init(&params);
BKE_camera_params_from_object(&params, cam_ob);
- params.lens= 16.0f*viewscale;
- params.sensor_x= 32.0f;
- params.sensor_y= 32.0f;
+ params.lens = 16.0f * viewscale;
+ params.sensor_x = 32.0f;
+ params.sensor_y = 32.0f;
params.sensor_fit = CAMERA_SENSOR_FIT_AUTO;
- params.clipsta= clipsta;
- params.clipend= clipend;
+ params.clipsta = clipsta;
+ params.clipend = clipend;
/* compute matrix, viewplane, .. */
BKE_camera_params_compute_viewplane(&params, re->winx, re->winy, 1.0f, 1.0f);
@@ -499,9 +499,9 @@ void RE_SetCamera(Render *re, Object *cam_ob)
BKE_camera_params_init(&params);
BKE_camera_params_from_object(&params, cam_ob);
- params.use_fields= (re->r.mode & R_FIELDS);
- params.field_second= (re->flag & R_SEC_FIELD);
- params.field_odd= (re->r.mode & R_ODDFIELD);
+ params.use_fields = (re->r.mode & R_FIELDS);
+ params.field_second = (re->flag & R_SEC_FIELD);
+ params.field_odd = (re->r.mode & R_ODDFIELD);
/* compute matrix, viewplane, .. */
BKE_camera_params_compute_viewplane(&params, re->winx, re->winy, re->r.xasp, re->r.yasp);
@@ -513,13 +513,13 @@ void RE_SetCamera(Render *re, Object *cam_ob)
void RE_SetPixelSize(Render *re, float pixsize)
{
- re->viewdx= pixsize;
- re->viewdy= re->ycor*pixsize;
+ re->viewdx = pixsize;
+ re->viewdy = re->ycor * pixsize;
}
void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, float mat[][4])
{
- re->r.cfra= frame;
+ re->r.cfra = frame;
RE_SetCamera(re, camera);
copy_m4_m4(mat, re->winmat);
}
@@ -529,12 +529,12 @@ void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, flo
void freeparts(Render *re)
{
- RenderPart *part= re->parts.first;
+ RenderPart *part = re->parts.first;
while (part) {
if (part->rectp) MEM_freeN(part->rectp);
if (part->rectz) MEM_freeN(part->rectz);
- part= part->next;
+ part = part->next;
}
BLI_freelistN(&re->parts);
}
@@ -547,91 +547,91 @@ void initparts(Render *re)
freeparts(re);
/* this is render info for caller, is not reset when parts are freed! */
- re->i.totpart= 0;
- re->i.curpart= 0;
+ re->i.totpart = 0;
+ re->i.curpart = 0;
re->i.partsdone = FALSE;
/* just for readable code.. */
- xminb= re->disprect.xmin;
- yminb= re->disprect.ymin;
- xmaxb= re->disprect.xmax;
- ymaxb= re->disprect.ymax;
+ xminb = re->disprect.xmin;
+ yminb = re->disprect.ymin;
+ xmaxb = re->disprect.xmax;
+ ymaxb = re->disprect.ymax;
- xparts= re->r.xparts;
- yparts= re->r.yparts;
+ xparts = re->r.xparts;
+ yparts = re->r.yparts;
/* mininum part size, but for exr tile saving it was checked already */
- if (!(re->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE))) {
+ if (!(re->r.scemode & (R_EXR_TILE_FILE | R_FULL_SAMPLE))) {
if (re->r.mode & R_PANORAMA) {
- if (ceil(re->rectx/(float)xparts) < 8)
- xparts= 1 + re->rectx/8;
+ if (ceil(re->rectx / (float)xparts) < 8)
+ xparts = 1 + re->rectx / 8;
}
else
- if (ceil(re->rectx/(float)xparts) < 64)
- xparts= 1 + re->rectx/64;
+ if (ceil(re->rectx / (float)xparts) < 64)
+ xparts = 1 + re->rectx / 64;
- if (ceil(re->recty/(float)yparts) < 64)
- yparts= 1 + re->recty/64;
+ if (ceil(re->recty / (float)yparts) < 64)
+ yparts = 1 + re->recty / 64;
}
/* part size */
- partx= ceil(re->rectx/(float)xparts);
- party= ceil(re->recty/(float)yparts);
+ partx = ceil(re->rectx / (float)xparts);
+ party = ceil(re->recty / (float)yparts);
- re->xparts= xparts;
- re->yparts= yparts;
- re->partx= partx;
- re->party= party;
+ re->xparts = xparts;
+ re->yparts = yparts;
+ re->partx = partx;
+ re->party = party;
/* calculate rotation factor of 1 pixel */
if (re->r.mode & R_PANORAMA)
- re->panophi= panorama_pixel_rot(re);
+ re->panophi = panorama_pixel_rot(re);
- for (nr=0; nr<xparts*yparts; nr++) {
+ for (nr = 0; nr < xparts * yparts; nr++) {
rcti disprect;
int rectx, recty;
- xd= (nr % xparts);
- yd= (nr-xd)/xparts;
+ xd = (nr % xparts);
+ yd = (nr - xd) / xparts;
- disprect.xmin = xminb+ xd*partx;
- disprect.ymin = yminb+ yd*party;
+ disprect.xmin = xminb + xd * partx;
+ disprect.ymin = yminb + yd * party;
/* ensure we cover the entire picture, so last parts go to end */
- if (xd<xparts-1) {
+ if (xd < xparts - 1) {
disprect.xmax = disprect.xmin + partx;
if (disprect.xmax > xmaxb)
disprect.xmax = xmaxb;
}
else disprect.xmax = xmaxb;
- if (yd<yparts-1) {
+ if (yd < yparts - 1) {
disprect.ymax = disprect.ymin + party;
if (disprect.ymax > ymaxb)
disprect.ymax = ymaxb;
}
else disprect.ymax = ymaxb;
- rectx= disprect.xmax - disprect.xmin;
- recty= disprect.ymax - disprect.ymin;
+ rectx = disprect.xmax - disprect.xmin;
+ recty = disprect.ymax - disprect.ymin;
/* so, now can we add this part? */
- if (rectx>0 && recty>0) {
- RenderPart *pa= MEM_callocN(sizeof(RenderPart), "new part");
+ if (rectx > 0 && recty > 0) {
+ RenderPart *pa = MEM_callocN(sizeof(RenderPart), "new part");
/* Non-box filters need 2 pixels extra to work */
if ((re->r.filtertype || (re->r.mode & R_EDGE))) {
- pa->crop= 2;
+ pa->crop = 2;
disprect.xmin -= pa->crop;
disprect.ymin -= pa->crop;
disprect.xmax += pa->crop;
disprect.ymax += pa->crop;
- rectx+= 2*pa->crop;
- recty+= 2*pa->crop;
+ rectx += 2 * pa->crop;
+ recty += 2 * pa->crop;
}
- pa->disprect= disprect;
- pa->rectx= rectx;
- pa->recty= recty;
+ pa->disprect = disprect;
+ pa->rectx = rectx;
+ pa->recty = recty;
BLI_addtail(&re->parts, pa);
re->i.totpart++;
diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c
index b282cc8459f..2acf3a4bc77 100644
--- a/source/blender/render/intern/source/pixelblending.c
+++ b/source/blender/render/intern/source/pixelblending.c
@@ -78,12 +78,12 @@ void addAlphaOverFloat(float dest[4], const float source[4])
/* d = s + (1-alpha_s)d*/
float mul;
- mul= 1.0f - source[3];
+ mul = 1.0f - source[3];
- dest[0]= (mul*dest[0]) + source[0];
- dest[1]= (mul*dest[1]) + source[1];
- dest[2]= (mul*dest[2]) + source[2];
- dest[3]= (mul*dest[3]) + source[3];
+ dest[0] = (mul * dest[0]) + source[0];
+ dest[1] = (mul * dest[1]) + source[1];
+ dest[2] = (mul * dest[2]) + source[2];
+ dest[3] = (mul * dest[3]) + source[3];
}
@@ -94,12 +94,12 @@ void addAlphaUnderFloat(float dest[4], const float source[4])
{
float mul;
- mul= 1.0f - dest[3];
+ mul = 1.0f - dest[3];
- dest[0]+= (mul*source[0]);
- dest[1]+= (mul*source[1]);
- dest[2]+= (mul*source[2]);
- dest[3]+= (mul*source[3]);
+ dest[0] += (mul * source[0]);
+ dest[1] += (mul * source[1]);
+ dest[2] += (mul * source[2]);
+ dest[3] += (mul * source[3]);
}
@@ -111,36 +111,36 @@ void addalphaAddfacFloat(float dest[4], const float source[4], char addfac)
/* Addfac is a number between 0 and 1: rescale */
/* final target is to diminish the influence of dest when addfac rises */
- m = 1.0f - ( source[3] * ((255 - addfac) / 255.0f));
+ m = 1.0f - (source[3] * ((255 - addfac) / 255.0f));
/* blend colors*/
- c= (m * dest[0]) + source[0];
+ c = (m * dest[0]) + source[0];
#ifdef RE_FLOAT_COLOR_CLIPPING
if (c >= RE_FULL_COLOR_FLOAT) dest[0] = RE_FULL_COLOR_FLOAT;
else
#endif
- dest[0]= c;
+ dest[0] = c;
- c= (m * dest[1]) + source[1];
+ c = (m * dest[1]) + source[1];
#ifdef RE_FLOAT_COLOR_CLIPPING
if (c >= RE_FULL_COLOR_FLOAT) dest[1] = RE_FULL_COLOR_FLOAT;
else
#endif
- dest[1]= c;
+ dest[1] = c;
- c= (m * dest[2]) + source[2];
+ c = (m * dest[2]) + source[2];
#ifdef RE_FLOAT_COLOR_CLIPPING
if (c >= RE_FULL_COLOR_FLOAT) dest[2] = RE_FULL_COLOR_FLOAT;
else
#endif
- dest[2]= c;
+ dest[2] = c;
- c= (m * dest[3]) + source[3];
+ c = (m * dest[3]) + source[3];
#ifdef RE_ALPHA_CLIPPING
if (c >= RE_FULL_COLOR_FLOAT) dest[3] = RE_FULL_COLOR_FLOAT;
else
#endif
- dest[3]= c;
+ dest[3] = c;
}
@@ -151,81 +151,81 @@ void addalphaAddfacFloat(float dest[4], const float source[4], char addfac)
void add_filt_fmask(unsigned int mask, const float col[4], float *rowbuf, int row_w)
{
/* calc the value of mask */
- float **fmask1= R.samples->fmask1, **fmask2=R.samples->fmask2;
+ float **fmask1 = R.samples->fmask1, **fmask2 = R.samples->fmask2;
float *rb1, *rb2, *rb3;
float val, r, g, b, al;
unsigned int a, maskand, maskshift;
int j;
- r= col[0];
- g= col[1];
- b= col[2];
- al= col[3];
-
- rb2= rowbuf-4;
- rb3= rb2-4*row_w;
- rb1= rb2+4*row_w;
-
- maskand= (mask & 255);
- maskshift= (mask >>8);
-
- for (j=2; j>=0; j--) {
-
- a= j;
-
- val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if (val!=0.0f) {
- rb1[0]+= val*r;
- rb1[1]+= val*g;
- rb1[2]+= val*b;
- rb1[3]+= val*al;
+ r = col[0];
+ g = col[1];
+ b = col[2];
+ al = col[3];
+
+ rb2 = rowbuf - 4;
+ rb3 = rb2 - 4 * row_w;
+ rb1 = rb2 + 4 * row_w;
+
+ maskand = (mask & 255);
+ maskshift = (mask >> 8);
+
+ for (j = 2; j >= 0; j--) {
+
+ a = j;
+
+ val = *(fmask1[a] + maskand) + *(fmask2[a] + maskshift);
+ if (val != 0.0f) {
+ rb1[0] += val * r;
+ rb1[1] += val * g;
+ rb1[2] += val * b;
+ rb1[3] += val * al;
}
- a+=3;
+ a += 3;
- val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if (val!=0.0f) {
- rb2[0]+= val*r;
- rb2[1]+= val*g;
- rb2[2]+= val*b;
- rb2[3]+= val*al;
+ val = *(fmask1[a] + maskand) + *(fmask2[a] + maskshift);
+ if (val != 0.0f) {
+ rb2[0] += val * r;
+ rb2[1] += val * g;
+ rb2[2] += val * b;
+ rb2[3] += val * al;
}
- a+=3;
+ a += 3;
- val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if (val!=0.0f) {
- rb3[0]+= val*r;
- rb3[1]+= val*g;
- rb3[2]+= val*b;
- rb3[3]+= val*al;
+ val = *(fmask1[a] + maskand) + *(fmask2[a] + maskshift);
+ if (val != 0.0f) {
+ rb3[0] += val * r;
+ rb3[1] += val * g;
+ rb3[2] += val * b;
+ rb3[3] += val * al;
}
- rb1+= 4;
- rb2+= 4;
- rb3+= 4;
+ rb1 += 4;
+ rb2 += 4;
+ rb3 += 4;
}
}
void mask_array(unsigned int mask, float filt[][3])
{
- float **fmask1= R.samples->fmask1, **fmask2=R.samples->fmask2;
- unsigned int maskand= (mask & 255);
- unsigned int maskshift= (mask >>8);
+ float **fmask1 = R.samples->fmask1, **fmask2 = R.samples->fmask2;
+ unsigned int maskand = (mask & 255);
+ unsigned int maskshift = (mask >> 8);
int a, j;
- for (j=2; j>=0; j--) {
+ for (j = 2; j >= 0; j--) {
- a= j;
+ a = j;
- filt[2][2-j]= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
+ filt[2][2 - j] = *(fmask1[a] + maskand) + *(fmask2[a] + maskshift);
- a+=3;
+ a += 3;
- filt[1][2-j]= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
+ filt[1][2 - j] = *(fmask1[a] + maskand) + *(fmask2[a] + maskshift);
- a+=3;
+ a += 3;
- filt[0][2-j]= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
+ filt[0][2 - j] = *(fmask1[a] + maskand) + *(fmask2[a] + maskshift);
}
}
@@ -247,61 +247,61 @@ void add_filt_fmask_coord(float filt[][3], const float col[4], float *rowbuf, in
float *fpoin[3][3];
float val, r, g, b, al, lfilt[3][3];
- r= col[0];
- g= col[1];
- b= col[2];
- al= col[3];
+ r = col[0];
+ g = col[1];
+ b = col[2];
+ al = col[3];
memcpy(lfilt, filt, sizeof(lfilt));
- fpoin[0][1]= rowbuf-4*row_w;
- fpoin[1][1]= rowbuf;
- fpoin[2][1]= rowbuf+4*row_w;
-
- fpoin[0][0]= fpoin[0][1] - 4;
- fpoin[1][0]= fpoin[1][1] - 4;
- fpoin[2][0]= fpoin[2][1] - 4;
-
- fpoin[0][2]= fpoin[0][1] + 4;
- fpoin[1][2]= fpoin[1][1] + 4;
- fpoin[2][2]= fpoin[2][1] + 4;
-
- if (y==0) {
- fpoin[0][0]= fpoin[1][0];
- fpoin[0][1]= fpoin[1][1];
- fpoin[0][2]= fpoin[1][2];
+ fpoin[0][1] = rowbuf - 4 * row_w;
+ fpoin[1][1] = rowbuf;
+ fpoin[2][1] = rowbuf + 4 * row_w;
+
+ fpoin[0][0] = fpoin[0][1] - 4;
+ fpoin[1][0] = fpoin[1][1] - 4;
+ fpoin[2][0] = fpoin[2][1] - 4;
+
+ fpoin[0][2] = fpoin[0][1] + 4;
+ fpoin[1][2] = fpoin[1][1] + 4;
+ fpoin[2][2] = fpoin[2][1] + 4;
+
+ if (y == 0) {
+ fpoin[0][0] = fpoin[1][0];
+ fpoin[0][1] = fpoin[1][1];
+ fpoin[0][2] = fpoin[1][2];
/* filter needs the opposite value yes! */
- lfilt[0][0]= filt[2][0];
- lfilt[0][1]= filt[2][1];
- lfilt[0][2]= filt[2][2];
+ lfilt[0][0] = filt[2][0];
+ lfilt[0][1] = filt[2][1];
+ lfilt[0][2] = filt[2][2];
}
- else if (y==col_h-1) {
- fpoin[2][0]= fpoin[1][0];
- fpoin[2][1]= fpoin[1][1];
- fpoin[2][2]= fpoin[1][2];
-
- lfilt[2][0]= filt[0][0];
- lfilt[2][1]= filt[0][1];
- lfilt[2][2]= filt[0][2];
+ else if (y == col_h - 1) {
+ fpoin[2][0] = fpoin[1][0];
+ fpoin[2][1] = fpoin[1][1];
+ fpoin[2][2] = fpoin[1][2];
+
+ lfilt[2][0] = filt[0][0];
+ lfilt[2][1] = filt[0][1];
+ lfilt[2][2] = filt[0][2];
}
- if (x==0) {
- fpoin[2][0]= fpoin[2][1];
- fpoin[1][0]= fpoin[1][1];
- fpoin[0][0]= fpoin[0][1];
-
- lfilt[2][0]= filt[2][2];
- lfilt[1][0]= filt[1][2];
- lfilt[0][0]= filt[0][2];
+ if (x == 0) {
+ fpoin[2][0] = fpoin[2][1];
+ fpoin[1][0] = fpoin[1][1];
+ fpoin[0][0] = fpoin[0][1];
+
+ lfilt[2][0] = filt[2][2];
+ lfilt[1][0] = filt[1][2];
+ lfilt[0][0] = filt[0][2];
}
- else if (x==row_w-1) {
- fpoin[2][2]= fpoin[2][1];
- fpoin[1][2]= fpoin[1][1];
- fpoin[0][2]= fpoin[0][1];
-
- lfilt[2][2]= filt[2][0];
- lfilt[1][2]= filt[1][0];
- lfilt[0][2]= filt[0][0];
+ else if (x == row_w - 1) {
+ fpoin[2][2] = fpoin[2][1];
+ fpoin[1][2] = fpoin[1][1];
+ fpoin[0][2] = fpoin[0][1];
+
+ lfilt[2][2] = filt[2][0];
+ lfilt[1][2] = filt[1][0];
+ lfilt[0][2] = filt[0][0];
}
@@ -332,46 +332,46 @@ void add_filt_fmask_coord(float filt[][3], const float col[4], float *rowbuf, in
void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row_w, int pixsize)
{
/* calc the value of mask */
- float **fmask1= R.samples->fmask1, **fmask2=R.samples->fmask2;
+ float **fmask1 = R.samples->fmask1, **fmask2 = R.samples->fmask2;
float *rb1, *rb2, *rb3;
float val;
unsigned int a, maskand, maskshift;
int i, j;
- rb2= rowbuf-pixsize;
- rb3= rb2-pixsize*row_w;
- rb1= rb2+pixsize*row_w;
+ rb2 = rowbuf - pixsize;
+ rb3 = rb2 - pixsize * row_w;
+ rb1 = rb2 + pixsize * row_w;
- maskand= (mask & 255);
- maskshift= (mask >>8);
+ maskand = (mask & 255);
+ maskshift = (mask >> 8);
- for (j=2; j>=0; j--) {
+ for (j = 2; j >= 0; j--) {
- a= j;
+ a = j;
- val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if (val!=0.0f) {
- for (i= 0; i<pixsize; i++)
- rb1[i]+= val*in[i];
+ val = *(fmask1[a] + maskand) + *(fmask2[a] + maskshift);
+ if (val != 0.0f) {
+ for (i = 0; i < pixsize; i++)
+ rb1[i] += val * in[i];
}
- a+=3;
+ a += 3;
- val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if (val!=0.0f) {
- for (i= 0; i<pixsize; i++)
- rb2[i]+= val*in[i];
+ val = *(fmask1[a] + maskand) + *(fmask2[a] + maskshift);
+ if (val != 0.0f) {
+ for (i = 0; i < pixsize; i++)
+ rb2[i] += val * in[i];
}
- a+=3;
+ a += 3;
- val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
- if (val!=0.0f) {
- for (i= 0; i<pixsize; i++)
- rb3[i]+= val*in[i];
+ val = *(fmask1[a] + maskand) + *(fmask2[a] + maskshift);
+ if (val != 0.0f) {
+ for (i = 0; i < pixsize; i++)
+ rb3[i] += val * in[i];
}
- rb1+= pixsize;
- rb2+= pixsize;
- rb3+= pixsize;
+ rb1 += pixsize;
+ rb2 += pixsize;
+ rb3 += pixsize;
}
}
@@ -380,7 +380,7 @@ void addalphaAddFloat(float dest[4], const float source[4])
{
/* Makes me wonder whether this is required... */
- if ( dest[3] < RE_EMPTY_COLOR_FLOAT) {
+ if (dest[3] < RE_EMPTY_COLOR_FLOAT) {
dest[0] = source[0];
dest[1] = source[1];
dest[2] = source[2];
@@ -389,15 +389,12 @@ void addalphaAddFloat(float dest[4], const float source[4])
}
/* no clipping! */
- dest[0] = dest[0]+source[0];
- dest[1] = dest[1]+source[1];
- dest[2] = dest[2]+source[2];
- dest[3] = dest[3]+source[3];
+ dest[0] = dest[0] + source[0];
+ dest[1] = dest[1] + source[1];
+ dest[2] = dest[2] + source[2];
+ dest[3] = dest[3] + source[3];
}
/* ---------------------------------------------------------------------------- */
-
-
-/* eof pixelblending.c */
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index e4c4e905aa6..c1f85914479 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -376,7 +376,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3
return normalize * 1.f;
}
else { /* schlick */
- const float k = 1.55f * g - .55f * g * g * g;
+ const float k = 1.55f * g - 0.55f * g * g * g;
const float kcostheta = k * dot_v3v3(w, wp);
return normalize * (1.f - k * k) / ((1.f - kcostheta) * (1.f - kcostheta));
}
@@ -394,7 +394,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3
return normalize * (1.f - g * g) / powf(1.f + g * g - 2.f * g * costheta, 1.5f);
case MA_VOL_PH_SCHLICK:
{
- const float k = 1.55f * g - .55f * g * g * g;
+ const float k = 1.55f * g - 0.55f * g * g * g;
const float kcostheta = k * costheta;
return normalize * (1.f - k * k) / ((1.f - kcostheta) * (1.f - kcostheta));
}
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index ecde9bb2de8..c88858c44da 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -2858,7 +2858,7 @@ static void quad_bezier_2d(float *result, float *v1, float *v2, float *ipodata)
p1[0]= v1[0];
p1[1]= v1[1];
- /* official formula 2*p2 - .5*p1 - .5*p3 */
+ /* official formula 2*p2 - 0.5*p1 - 0.5*p3 */
p2[0]= -0.5f*p1[0] - 0.5f*p3[0];
p2[1]= -0.5f*p1[1] - 0.5f*p3[1];
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 0ceb903ed28..001857cbf67 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -30,6 +30,7 @@ set(INC
../blenlib
../blenloader
../editors/include
+ ../editors/io
../gpu
../imbuf
../makesdna
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index a8c94865aa5..ff1f47cbbaa 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -475,7 +475,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
glTexImage2D(triple->target, 0, GL_RGB8, triple->x[x], triple->y[y], 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(triple->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(triple->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- // The current color is ignored if the GL_REPLACE texture environment is used.
+ /* The current color is ignored if the GL_REPLACE texture environment is used. */
// glTexEnvi(triple->target, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(triple->target, 0);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index c46c382c37f..3d483c06419 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -867,7 +867,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
}
else {
/* debug, important to leave a while, should never happen */
- printf("invalid operator call '%s'\n", ot->idname);
+ printf("%s: invalid operator call '%s'\n", __func__, ot->idname);
}
/* Note, if the report is given as an argument then assume the caller will deal with displaying them
@@ -1436,8 +1436,9 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
}
}
- else
- printf("wm_handler_operator_call error\n");
+ else {
+ printf("%s: error - missing modal\n", __func__);
+ }
}
else {
wmOperatorType *ot = WM_operatortype_find(event->keymap_idname, 0);
@@ -2260,7 +2261,7 @@ wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap
wmEventHandler *handler;
if (!keymap) {
- printf("WM_event_add_keymap_handler called with NULL keymap\n");
+ printf("%s: called with NULL keymap\n", __func__);
return NULL;
}
@@ -2703,7 +2704,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event.y = evt->y = (win->sizey - 1) - cy;
}
- // Use prevx/prevy so we can calculate the delta later
+ /* Use prevx/prevy so we can calculate the delta later */
event.prevx = event.x - pd->deltaX;
event.prevy = event.y - (-pd->deltaY);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index f39b8f267a5..639039baaa7 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -157,7 +157,7 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType *))
ot->name = N_("Dummy Name");
}
- // XXX All ops should have a description but for now allow them not to.
+ /* XXX All ops should have a description but for now allow them not to. */
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description : N_("(undocumented operator)"));
RNA_def_struct_identifier(ot->srna, ot->idname);
@@ -1646,8 +1646,8 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
else
G.f &= ~G_SCRIPT_AUTOEXEC;
- // XXX wm in context is not set correctly after WM_read_file -> crash
- // do it before for now, but is this correct with multiple windows?
+ /* XXX wm in context is not set correctly after WM_read_file -> crash */
+ /* do it before for now, but is this correct with multiple windows? */
WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_read_file(C, path, op->reports);
@@ -1877,8 +1877,8 @@ static int wm_recover_last_session_exec(bContext *C, wmOperator *op)
G.fileflags |= G_FILE_RECOVER;
- // XXX wm in context is not set correctly after WM_read_file -> crash
- // do it before for now, but is this correct with multiple windows?
+ /* XXX wm in context is not set correctly after WM_read_file -> crash */
+ /* do it before for now, but is this correct with multiple windows? */
WM_event_add_notifier(C, NC_WINDOW, NULL);
/* load file */
@@ -1909,8 +1909,8 @@ static int wm_recover_auto_save_exec(bContext *C, wmOperator *op)
G.fileflags |= G_FILE_RECOVER;
- // XXX wm in context is not set correctly after WM_read_file -> crash
- // do it before for now, but is this correct with multiple windows?
+ /* XXX wm in context is not set correctly after WM_read_file -> crash */
+ /* do it before for now, but is this correct with multiple windows? */
WM_event_add_notifier(C, NC_WINDOW, NULL);
/* load file */
@@ -2134,203 +2134,6 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "relative_remap", 0, "Remap Relative", "Remap relative paths when saving in a different directory");
}
-/* XXX: move these collada operators to a more appropriate place */
-#ifdef WITH_COLLADA
-
-#include "../../collada/collada.h"
-
-static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
-{
- if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
- char filepath[FILE_MAX];
-
- if (G.main->name[0] == 0)
- BLI_strncpy(filepath, "untitled", sizeof(filepath));
- else
- BLI_strncpy(filepath, G.main->name, sizeof(filepath));
-
- BLI_replace_extension(filepath, sizeof(filepath), ".dae");
- RNA_string_set(op->ptr, "filepath", filepath);
- }
-
- WM_event_add_fileselect(C, op);
-
- return OPERATOR_RUNNING_MODAL;
-}
-
-/* function used for WM_OT_save_mainfile too */
-static int wm_collada_export_exec(bContext *C, wmOperator *op)
-{
- char filepath[FILE_MAX];
- int selected, second_life;
- int include_armatures;
- int apply_modifiers;
- int include_children;
- int use_object_instantiation;
- int sort_by_name;
-
- if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
- BKE_report(op->reports, RPT_ERROR, "No filename given");
- return OPERATOR_CANCELLED;
- }
-
- RNA_string_get(op->ptr, "filepath", filepath);
- BLI_ensure_extension(filepath, sizeof(filepath), ".dae");
-
- /* Options panel */
- selected = RNA_boolean_get(op->ptr, "selected");
- apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
- include_armatures = RNA_boolean_get(op->ptr, "include_armatures");
- include_children = RNA_boolean_get(op->ptr, "include_children");
- use_object_instantiation = RNA_boolean_get(op->ptr, "use_object_instantiation");
- sort_by_name = RNA_boolean_get(op->ptr, "sort_by_name");
- second_life = RNA_boolean_get(op->ptr, "second_life");
-
- /* get editmode results */
- ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
-
- if (collada_export(
- CTX_data_scene(C),
- filepath,
- selected,
- apply_modifiers,
- include_armatures,
- include_children,
- use_object_instantiation,
- sort_by_name,
- second_life)) {
- return OPERATOR_FINISHED;
- }
- else {
- return OPERATOR_CANCELLED;
- }
-}
-
-
-void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
-{
- ID *id = imfptr->id.data;
-
- uiLayout *box, *row;
-
- // Export Options:
- box = uiLayoutBox(layout);
- row = uiLayoutRow(box, 0);
- uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA);
-
- row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "selected", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "include_armatures", 0, NULL, ICON_NONE);
- uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
-
- row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "include_children", 0, NULL, ICON_NONE);
- uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
-
-
- // Collada options:
- box = uiLayoutBox(layout);
- row = uiLayoutRow(box, 0);
- uiItemL(row, IFACE_("Collada Options:"), ICON_MODIFIER);
-
- row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "use_object_instantiation", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "sort_by_name", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
- uiItemR(row, imfptr, "second_life", 0, NULL, ICON_NONE);
-
-}
-
-static void wm_collada_export_draw(bContext *C, wmOperator *op)
-{
- PointerRNA ptr;
-
- RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
- uiCollada_exportSettings(op->layout, &ptr);
-}
-
-static void WM_OT_collada_export(wmOperatorType *ot)
-{
- ot->name = "Export COLLADA";
- ot->description = "Save a Collada file";
- ot->idname = "WM_OT_collada_export";
-
- ot->invoke = wm_collada_export_invoke;
- ot->exec = wm_collada_export_exec;
- ot->poll = WM_operator_winactive;
-
- ot->flag |= OPTYPE_PRESET;
-
- ot->ui = wm_collada_export_draw;
-
- WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
-
-
- RNA_def_boolean(ot->srna, "selected", 0, "Selection Only",
- "Export only selected elements");
-
- RNA_def_boolean(ot->srna, "include_armatures", 0, "Include Armatures",
- "Include armature(s) even if not selected");
-
- RNA_def_boolean(ot->srna, "include_children", 0, "Include Children",
- "Include all children even if not selected");
-
- RNA_def_boolean(ot->srna, "apply_modifiers", 0, "Apply Modifiers",
- "Apply modifiers (Preview Resolution)");
-
- RNA_def_boolean(ot->srna, "use_object_instantiation", 1, "Use Object Instances",
- "Instantiate multiple Objects from same Data");
-
- RNA_def_boolean(ot->srna, "sort_by_name", 0, "Sort by Object name",
- "Sort exported data by Object name");
-
- RNA_def_boolean(ot->srna, "second_life", 0, "Export for Second Life",
- "Compatibility mode for Second Life");
-}
-
-
-/* function used for WM_OT_save_mainfile too */
-static int wm_collada_import_exec(bContext *C, wmOperator *op)
-{
- char filename[FILE_MAX];
-
- if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
- BKE_report(op->reports, RPT_ERROR, "No filename given");
- return OPERATOR_CANCELLED;
- }
-
- RNA_string_get(op->ptr, "filepath", filename);
- if (collada_import(C, filename)) return OPERATOR_FINISHED;
-
- BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document. Please see console for error log.");
-
- return OPERATOR_FINISHED;
-}
-
-static void WM_OT_collada_import(wmOperatorType *ot)
-{
- ot->name = "Import COLLADA";
- ot->description = "Load a Collada file";
- ot->idname = "WM_OT_collada_import";
-
- ot->invoke = WM_operator_filesel;
- ot->exec = wm_collada_import_exec;
- ot->poll = WM_operator_winactive;
-
- WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
-}
-
-#endif
-
-
-/* *********************** */
-
static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
{
ot->name = "Toggle Fullscreen";
@@ -2539,7 +2342,7 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
}
}
-// // Allow view navigation???
+// /* Allow view navigation??? */
// else {
// return OPERATOR_PASS_THROUGH;
// }
@@ -2558,7 +2361,7 @@ int WM_border_select_cancel(bContext *C, wmOperator *op)
/* works now only for selection or modal paint stuff, calls exec while hold mouse, exit on release */
#ifdef GESTURE_MEMORY
-int circle_select_size = 25; // XXX - need some operator memory thing\!
+int circle_select_size = 25; /* XXX - need some operator memory thing! */
#endif
int WM_gesture_circle_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -2641,7 +2444,7 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_FINISHED; /* use finish or we don't get an undo */
}
}
-// // Allow view navigation???
+// /* Allow view navigation??? */
// else {
// return OPERATOR_PASS_THROUGH;
// }
@@ -3771,14 +3574,14 @@ static void WM_OT_dependency_relations(wmOperatorType *ot)
static int wm_ndof_sensitivity_exec(bContext *UNUSED(C), wmOperator *op)
{
- const float min = 0.25f, max = 4.f; // TODO: get these from RNA property
+ const float min = 0.25f, max = 4.0f; /* TODO: get these from RNA property */
float change;
float sensitivity = U.ndof_sensitivity;
if (RNA_boolean_get(op->ptr, "fast"))
- change = 0.5f; // 50% change
+ change = 0.5f; /* 50% change */
else
- change = 0.1f; // 10%
+ change = 0.1f; /* 10% */
if (RNA_boolean_get(op->ptr, "decrease")) {
sensitivity -= sensitivity * change;
@@ -3864,12 +3667,6 @@ void wm_operatortype_init(void)
#if defined(WIN32)
WM_operatortype_append(WM_OT_console_toggle);
#endif
-
-#ifdef WITH_COLLADA
- /* XXX: move these */
- WM_operatortype_append(WM_OT_collada_export);
- WM_operatortype_append(WM_OT_collada_import);
-#endif
}
/* circleselect-like modal operators */
@@ -3904,7 +3701,7 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_SELECT);
-#if 0 // Durien guys like this :S
+#if 0 /* Durien guys like this :S */
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_DESELECT);
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_SHIFT, 0, GESTURE_MODAL_NOP);
#else
@@ -3983,7 +3780,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
-#if 0 // Durian guys like this
+#if 0 /* Durian guys like this */
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_BEGIN);
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_SHIFT, 0, GESTURE_MODAL_DESELECT);
#else
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index cf983f7795f..d599b9504e8 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -194,9 +194,8 @@ void wm_subwindow_close(wmWindow *win, int swinid)
MEM_freeN(swin);
}
else {
- printf("wm_subwindow_close: Internal error, bad winid: %d\n", swinid);
+ printf("%s: Internal error, bad winid: %d\n", __func__, swinid);
}
-
}
/* pixels go from 0-99 for a 100 pixel window */
@@ -233,7 +232,7 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct)
wmOrtho2(-0.375f, (float)width - 0.375f, -0.375f, (float)height - 0.375f);
}
else {
- printf("wm_subwindow_position: Internal error, bad winid: %d\n", swinid);
+ printf("%s: Internal error, bad winid: %d\n", __func__, swinid);
}
}
@@ -250,7 +249,7 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
_curswin = swin_from_swinid(win, swinid);
if (_curswin == NULL) {
- printf("wmSubWindowSet %d: doesn't exist\n", swinid);
+ printf("%s %d: doesn't exist\n", __func__, swinid);
return;
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 265a3c11377..dd501e6d880 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -369,7 +369,7 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
/* until screens get drawn, make it nice grey */
- glClearColor(.55, .55, .55, 0.0);
+ glClearColor(0.55, 0.55, 0.55, 0.0);
/* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */
if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
glClear(GL_COLOR_BUFFER_BIT);
@@ -402,7 +402,7 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y);
#if defined(__APPLE__) && !defined(GHOST_COCOA)
-//Cocoa provides functions to get correct max window size
+ /* Cocoa provides functions to get correct max window size */
{
extern void wm_set_apple_prefsize(int, int); /* wm_apple.c */
@@ -632,9 +632,9 @@ void wm_window_make_drawable(bContext *C, wmWindow *win)
}
/* called by ghost, here we handle events for windows themselves or send to event system */
-static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
+static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr)
{
- bContext *C = private;
+ bContext *C = C_void_ptr;
wmWindowManager *wm = CTX_wm_manager(C);
GHOST_TEventType type = GHOST_GetEventType(evt);
int time = GHOST_GetEventTime(evt);
@@ -648,14 +648,14 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
wmWindow *win;
if (!ghostwin) {
- // XXX - should be checked, why are we getting an event here, and
- // what is it?
+ /* XXX - should be checked, why are we getting an event here, and */
+ /* what is it? */
puts("<!> event has no window");
return 1;
}
else if (!GHOST_ValidWindow(g_system, ghostwin)) {
- // XXX - should be checked, why are we getting an event here, and
- // what is it?
+ /* XXX - should be checked, why are we getting an event here, and */
+ /* what is it? */
puts("<!> event has invalid window");
return 1;
}
@@ -859,7 +859,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
event = *(win->eventstate); /* copy last state, like mouse coords */
- // activate region
+ /* activate region */
event.type = MOUSEMOVE;
event.prevx = event.x;
event.prevy = event.y;
@@ -894,7 +894,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
WM_event_start_drag(C, icon, WM_DRAG_PATH, stra->strings[a], 0.0);
/* void poin should point to string, it makes a copy */
- break; // only one drop element supported now
+ break; /* only one drop element supported now */
}
}
@@ -987,7 +987,7 @@ void wm_window_testbreak(void)
/* only check for breaks every 50 milliseconds
* if we get called more often.
*/
- if ((curtime - ltime) > .05) {
+ if ((curtime - ltime) > 0.05) {
int hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
if (hasevent)